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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/ChannelMerger/audiochannelmerger-input.html

Issue 2895963003: Apply layout-test-tidy to LayoutTests/webaudio (Closed)
Patch Set: Created 3 years, 7 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/ChannelMerger/audiochannelmerger-input.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/ChannelMerger/audiochannelmerger-input.html b/third_party/WebKit/LayoutTests/webaudio/ChannelMerger/audiochannelmerger-input.html
index 1cf66e2354b3b64c719bf7430b604f5e6e25be44..88a7704f0ada4088cd4b313a7617c2445a95dfec 100644
--- a/third_party/WebKit/LayoutTests/webaudio/ChannelMerger/audiochannelmerger-input.html
+++ b/third_party/WebKit/LayoutTests/webaudio/ChannelMerger/audiochannelmerger-input.html
@@ -1,116 +1,113 @@
<!DOCTYPE html>
<html>
+ <head>
+ <title>
+ audiochannelmerger-input.html
+ </title>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="../resources/audit-util.js"></script>
+ <script src="../resources/audit.js"></script>
+ <script src="../resources/merger-testing.js"></script>
+ </head>
+ <body>
+ <script id="layout-test-code">
+ let audit = Audit.createTaskRunner();
+
+ // Task: Check if an inactive input renders a silent mono channel in the
+ // output.
+ audit.define('silent-channel', (task, should) => {
+ testMergerInput(should, {
+ numberOfChannels: 6,
+
+ // Create a mono source buffer filled with '1'.
+ testBufferContent: [1],
+
+ // Connect the output of source into the 4th input of merger.
+ mergerInputIndex: 3,
+
+ // All channels should contain 0, except channel 4 which should be 1.
+ expected: [0, 0, 0, 1, 0, 0],
+ }).then(() => task.done());
+ });
+
+
+ // Task: Check if a stereo input is being down-mixed to mono channel
+ // correctly based on the mixing rule.
+ audit.define('stereo-down-mixing', (task, should) => {
+ testMergerInput(should, {
+ numberOfChannels: 6,
+
+ // Create a stereo buffer filled with '1' and '2' for left and right
+ // channels respectively.
+ testBufferContent: [1, 2],
+
+ // Connect the output of source into the 1st input of merger.
+ mergerInputIndex: undefined,
-<head>
- <script src="../../resources/testharness.js"></script>
- <script src="../../resources/testharnessreport.js"></script>
- <script src="../resources/audit-util.js"></script>
- <script src="../resources/audit.js"></script>
- <script src="../resources/merger-testing.js"></script>
-</head>
-
-<body>
- <script>
-
- var audit = Audit.createTaskRunner();
-
- // Task: Check if an inactive input renders a silent mono channel in the
- // output.
- audit.define('silent-channel', (task, should) => {
- testMergerInput(should, {
- numberOfChannels: 6,
-
- // Create a mono source buffer filled with '1'.
- testBufferContent: [1],
-
- // Connect the output of source into the 4th input of merger.
- mergerInputIndex: 3,
-
- // All channels should contain 0, except channel 4 which should be 1.
- expected: [0, 0, 0, 1, 0, 0],
- })
- .then(() => task.done());
- });
-
-
- // Task: Check if a stereo input is being down-mixed to mono channel
- // correctly based on the mixing rule.
- audit.define('stereo-down-mixing', (task, should) => {
- testMergerInput(should, {
- numberOfChannels: 6,
-
- // Create a stereo buffer filled with '1' and '2' for left and right
- // channels respectively.
- testBufferContent: [1, 2],
-
- // Connect the output of source into the 1st input of merger.
- mergerInputIndex: undefined,
-
- // The result of summed and down-mixed stereo audio should be 1.5.
- // (= 1 * 0.5 + 2 * 0.5)
- expected: [1.5, 0, 0, 0, 0, 0],
- })
- .then(() => task.done());
- });
-
-
- // Task: Check if 3-channel input gets processed by the 'discrete' mixing
- // rule.
- audit.define('undefined-channel-layout', (task, should) => {
- testMergerInput(should, {
- numberOfChannels: 6,
-
- // Create a 3-channel buffer filled with '1', '2', and '3' respectively.
- testBufferContent: [1, 2, 3],
-
- // Connect the output of source into the 1st input of merger.
- mergerInputIndex: undefined,
-
- // The result of summed stereo audio should be 1 because 3-channel is
- // not a canonical layout, so the input channel 2 and 3 should be
- // dropped by 'discrete' mixing rule.
- expected: [1, 0, 0, 0, 0, 0],
- })
- .then(() => task.done());
- });
-
-
- // Task: Merging two inputs into a single stereo stream.
- audit.define('merging-to-stereo', (task, should) => {
-
- // For this test, the number of channel should be 2.
- var context = new OfflineAudioContext(2, 128, 44100);
- var merger = context.createChannelMerger();
- var source1 = context.createBufferSource();
- var source2 = context.createBufferSource();
-
- // Create a DC offset buffer (mono) filled with 1 and assign it to BS
- // nodes.
- var positiveDCOffset = createConstantBuffer(context, 128, 1);
- var negativeDCOffset = createConstantBuffer(context, 128, -1);
- source1.buffer = positiveDCOffset;
- source2.buffer = negativeDCOffset;
-
- // Connect: BS#1 => merger_input#0, BS#2 => Inverter => merger_input#1
- source1.connect(merger, 0, 0);
- source2.connect(merger, 0, 1);
- merger.connect(context.destination);
- source1.start();
- source2.start();
-
- context.startRendering().then(function (buffer) {
-
- // Channel#0 = 1, Channel#1 = -1
- should(buffer.getChannelData(0), 'Channel #0').beConstantValueOf(1);
- should(buffer.getChannelData(1), 'Channel #1').beConstantValueOf(-1);
-
- task.done();
+ // The result of summed and down-mixed stereo audio should be 1.5.
+ // (= 1 * 0.5 + 2 * 0.5)
+ expected: [1.5, 0, 0, 0, 0, 0],
+ }).then(() => task.done());
});
- });
- audit.run();
- </script>
-</body>
+ // Task: Check if 3-channel input gets processed by the 'discrete' mixing
+ // rule.
+ audit.define('undefined-channel-layout', (task, should) => {
+ testMergerInput(should, {
+ numberOfChannels: 6,
+
+ // Create a 3-channel buffer filled with '1', '2', and '3'
+ // respectively.
+ testBufferContent: [1, 2, 3],
+
+ // Connect the output of source into the 1st input of merger.
+ mergerInputIndex: undefined,
+
+ // The result of summed stereo audio should be 1 because 3-channel is
+ // not a canonical layout, so the input channel 2 and 3 should be
+ // dropped by 'discrete' mixing rule.
+ expected: [1, 0, 0, 0, 0, 0],
+ }).then(() => task.done());
+ });
+
+
+ // Task: Merging two inputs into a single stereo stream.
+ audit.define('merging-to-stereo', (task, should) => {
+
+ // For this test, the number of channel should be 2.
+ let context = new OfflineAudioContext(2, 128, 44100);
+ let merger = context.createChannelMerger();
+ let source1 = context.createBufferSource();
+ let source2 = context.createBufferSource();
+
+ // Create a DC offset buffer (mono) filled with 1 and assign it to BS
+ // nodes.
+ let positiveDCOffset = createConstantBuffer(context, 128, 1);
+ let negativeDCOffset = createConstantBuffer(context, 128, -1);
+ source1.buffer = positiveDCOffset;
+ source2.buffer = negativeDCOffset;
+
+ // Connect: BS#1 => merger_input#0, BS#2 => Inverter => merger_input#1
+ source1.connect(merger, 0, 0);
+ source2.connect(merger, 0, 1);
+ merger.connect(context.destination);
+ source1.start();
+ source2.start();
+
+ context.startRendering().then(function(buffer) {
+
+ // Channel#0 = 1, Channel#1 = -1
+ should(buffer.getChannelData(0), 'Channel #0').beConstantValueOf(1);
+ should(buffer.getChannelData(1), 'Channel #1').beConstantValueOf(-1);
+
+ task.done();
+ });
+ });
+
+ audit.run();
+ </script>
+ </body>
</html>

Powered by Google App Engine
This is Rietveld 408576698