Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-constructor.html

Issue 2680033002: Convert OfflineAudioContext tests to testharness (Closed)
Patch Set: Remove expected results and minor cleanup Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-constructor.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-constructor.html b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-constructor.html
index 783a212b2ce66af770a058b4cd661f6ed58f0cd6..40eec4c8e8916925e027bffa5378210e21d4d9a2 100644
--- a/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-constructor.html
+++ b/third_party/WebKit/LayoutTests/webaudio/OfflineAudioContext/offlineaudiocontext-constructor.html
@@ -1,47 +1,114 @@
<!DOCTYPE html>
<html>
<head>
-<script src="../../resources/js-test.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../resources/audit.js"></script>
</head>
<body>
<script>
-description("Tests the OfflineAudioContext constructor");
+let audit = Audit.createTaskRunner();
-var context;
-// Make sure we don't crash when giving 0 as number of frames.
-shouldThrow("new OfflineAudioContext(1, 0, 44100)");
-// Make sure we don't throw exceptions for supported ranges of sample rates for an OfflineAudioContext.
-shouldThrow("context = new OfflineAudioContext(2, 512, 2999)");
-shouldNotThrow("context = new OfflineAudioContext(2, 512, 3000)");
-shouldBeEqualToNumber("context.length", 512);
-shouldNotThrow("context = new OfflineAudioContext(2, 1024, 384000)");
-shouldBeEqualToNumber("context.length", 1024);
-shouldThrow("context = new OfflineAudioContext(2, 1024, 384001)");
-shouldNotThrow("context = new OfflineAudioContext(2, 2048, 8000)");
-shouldBeEqualToNumber("context.length", 2048);
-shouldNotThrow("context = new OfflineAudioContext(2, 4096, 11025)");
-shouldBeEqualToNumber("context.length", 4096);
-shouldNotThrow("context = new OfflineAudioContext(2, 512, 22050)");
-shouldBeEqualToNumber("context.length", 512);
-shouldNotThrow("context = new OfflineAudioContext(2, 512, 44100)");
-shouldBeEqualToNumber("context.length", 512);
-shouldNotThrow("context = new OfflineAudioContext(2, 512, 48000)");
-shouldBeEqualToNumber("context.length", 512);
-shouldNotThrow("context = new OfflineAudioContext(2, 512, 88200)");
-shouldBeEqualToNumber("context.length", 512);
-// Make sure length is read-only.
-shouldNotThrow("context.length = 99");
-shouldBeEqualToNumber("context.length", 512);
-shouldNotThrow("context = new OfflineAudioContext(2, 512, 96000)");
-// Make sure we throw exceptions for non-finite sample rates.
-shouldThrow("context = new OfflineAudioContext(1, 0, NaN)");
-shouldThrow("context = new OfflineAudioContext(1, 0, Infinity)");
-// Verify channel counts and other destination attributes are set correctly.
-shouldNotThrow("context = new OfflineAudioContext(7, 512, 48000)");
-shouldBeEqualToNumber("context.destination.channelCount", 7);
-shouldBeEqualToNumber("context.destination.maxChannelCount", 7);
-shouldBeEqualToString("context.destination.channelCountMode", "explicit");
-shouldBeEqualToString("context.destination.channelInterpretation", "speakers");
+audit.define('test', (task, should) => {
+ task.describe('OfflineAudioContext constructor');
+ let context;
+ // Make sure we don't crash when giving 0 as number of frames.
+ should(
+ () => new OfflineAudioContext(1, 0, 44100),
+ 'new OfflineAudioContext(1, 0, 44100)')
+ .throw();
+ // Make sure we don't throw exceptions for supported ranges of sample rates
+ // for an OfflineAudioContext.
+ should(
+ () => context = new OfflineAudioContext(2, 512, 2999),
+ 'context = new OfflineAudioContext(2, 512, 2999)')
+ .throw();
+ should(
+ () => context = new OfflineAudioContext(2, 512, 3000),
+ 'context = new OfflineAudioContext(2, 512, 3000)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(512);
+ should(
+ () => context = new OfflineAudioContext(2, 1024, 384000),
+ 'context = new OfflineAudioContext(2, 1024, 384000)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(1024);
+ should(
+ () => context = new OfflineAudioContext(2, 1024, 384001),
+ 'context = new OfflineAudioContext(2, 1024, 384001)')
+ .throw();
+ should(
+ () => context = new OfflineAudioContext(2, 2048, 8000),
+ 'context = new OfflineAudioContext(2, 2048, 8000)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(2048);
+ should(
+ () => context = new OfflineAudioContext(2, 4096, 11025),
+ 'context = new OfflineAudioContext(2, 4096, 11025)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(4096);
+ should(
+ () => context = new OfflineAudioContext(2, 512, 22050),
+ 'context = new OfflineAudioContext(2, 512, 22050)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(512);
+ should(
+ () => context = new OfflineAudioContext(2, 512, 44100),
+ 'context = new OfflineAudioContext(2, 512, 44100)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(512);
+ should(
+ () => context = new OfflineAudioContext(2, 512, 48000),
+ 'context = new OfflineAudioContext(2, 512, 48000)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(512);
+
+ should(
+ () => context = new OfflineAudioContext(2, 512, 88200),
+ 'context = new OfflineAudioContext(2, 512, 88200)')
+ .notThrow();
+ should(context.length, 'context.length').beEqualTo(512);
+
+ // Make sure length is read-only.
+ should(() => context.length = 99, 'context.length = 99').notThrow();
+ should(context.length, 'context.length').beEqualTo(512);
+ should(
+ () => context = new OfflineAudioContext(2, 512, 96000),
+ 'context = new OfflineAudioContext(2, 512, 96000)')
+ .notThrow();
+ // Make sure we throw exceptions for non-finite sample rates.
+ should(
+ () => context = new OfflineAudioContext(1, 0, NaN),
+ 'context = new OfflineAudioContext(1, 0, NaN)')
+ .throw();
+ should(
+ () => context = new OfflineAudioContext(1, 0, Infinity),
+ 'context = new OfflineAudioContext(1, 0, Infinity)')
+ .throw();
+ // Verify channel counts and other destination attributes are set correctly.
+ should(
+ () => context = new OfflineAudioContext(7, 512, 48000),
+ 'context = new OfflineAudioContext(7, 512, 48000)')
+ .notThrow();
+ should(context.destination.channelCount, 'context.destination.channelCount')
+ .beEqualTo(7);
+ should(
+ context.destination.maxChannelCount,
+ 'context.destination.maxChannelCount')
+ .beEqualTo(7);
+ should(
+ context.destination.channelCountMode,
+ 'context.destination.channelCountMode')
+ .beEqualTo('explicit');
+ should(
+ context.destination.channelInterpretation,
+ 'context.destination.channelInterpretation')
+ .beEqualTo('speakers');
+
+ task.done();
+});
+
+audit.run();
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698