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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/constructor/audionodeoptions.js

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 unified diff | Download patch
OLDNEW
1 // Test that constructor for the node with name |nodeName| handles the 1 // Test that constructor for the node with name |nodeName| handles the
2 // various possible values for channelCount, channelCountMode, and 2 // various possible values for channelCount, channelCountMode, and
3 // channelInterpretation. 3 // channelInterpretation.
4 4
5 // The |should| parameter is the test function from new |Audit|. 5 // The |should| parameter is the test function from new |Audit|.
6 function testAudioNodeOptions(should, context, nodeName, expectedNodeOptions) { 6 function testAudioNodeOptions(should, context, nodeName, expectedNodeOptions) {
7 if (expectedNodeOptions === undefined) 7 if (expectedNodeOptions === undefined)
8 expectedNodeOptions = {}; 8 expectedNodeOptions = {};
9 let node; 9 let node;
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 if (expectedNodeOptions.channelCountMode) { 66 if (expectedNodeOptions.channelCountMode) {
67 testChannelCountMode = expectedNodeOptions.channelCountMode.value; 67 testChannelCountMode = expectedNodeOptions.channelCountMode.value;
68 } 68 }
69 should( 69 should(
70 () => { 70 () => {
71 node = new window[nodeName]( 71 node = new window[nodeName](
72 context, Object.assign({}, expectedNodeOptions.additionalOptions, { 72 context, Object.assign({}, expectedNodeOptions.additionalOptions, {
73 channelCountMode: testChannelCountMode 73 channelCountMode: testChannelCountMode
74 })); 74 }));
75 }, 75 },
76 'new ' + nodeName + '(c, {channelCountMode: "' + testChannelCountMode + '" }') 76 'new ' + nodeName + '(c, {channelCountMode: "' + testChannelCountMode +
77 '"}')
77 .notThrow(); 78 .notThrow();
78 should(node.channelCountMode, 'node.channelCountMode').beEqualTo(testChannelCo untMode); 79 should(node.channelCountMode, 'node.channelCountMode')
80 .beEqualTo(testChannelCountMode);
79 81
80 if (expectedNodeOptions.channelCountMode && 82 if (expectedNodeOptions.channelCountMode &&
81 expectedNodeOptions.channelCountMode.isFixed) { 83 expectedNodeOptions.channelCountMode.isFixed) {
82 // Channel count mode is fixed. Test setting to something else throws. 84 // Channel count mode is fixed. Test setting to something else throws.
83 let testChannelCountModeMap = { 85 let testChannelCountModeMap = {
84 'max': 'clamped-max', 86 'max': 'clamped-max',
85 'clamped-max': 'explicit', 87 'clamped-max': 'explicit',
86 'explicit': 'max' 88 'explicit': 'max'
87 }; 89 };
88 testChannelCountMode = testChannelCountModeMap[expectedNodeOptions.channelCo untMode.value]; 90 testChannelCountMode =
91 testChannelCountModeMap[expectedNodeOptions.channelCountMode.value];
89 should( 92 should(
90 () => { 93 () => {
91 node = new window[nodeName]( 94 node = new window[nodeName](
92 context, 95 context,
93 Object.assign( 96 Object.assign(
94 {}, expectedNodeOptions.additionalOptions, 97 {}, expectedNodeOptions.additionalOptions,
95 {channelCountMode: testChannelCountMode})); 98 {channelCountMode: testChannelCountMode}));
96 }, 99 },
97 'new ' + nodeName + '(c, {channelCountMode: "' + testChannelCountMode + '"}') 100 'new ' + nodeName + '(c, {channelCountMode: "' + testChannelCountMode +
101 '"}')
98 .throw(expectedNodeOptions.channelCountMode.errorType); 102 .throw(expectedNodeOptions.channelCountMode.errorType);
99 } else { 103 } else {
100 // Mode is not fixed. Verify that we can set the mode to all valid 104 // Mode is not fixed. Verify that we can set the mode to all valid
101 // values, and that we throw for invalid values. 105 // values, and that we throw for invalid values.
102 106
103 should(() => { 107 should(() => {
104 node = new window[nodeName]( 108 node = new window[nodeName](
105 context, Object.assign({}, expectedNodeOptions.additionalOptions, { 109 context, Object.assign({}, expectedNodeOptions.additionalOptions, {
106 channelCountMode: 'clamped-max' 110 channelCountMode: 'clamped-max'
107 })); 111 }));
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 items.forEach((item) => { 223 items.forEach((item) => {
220 let attr = node[item.name]; 224 let attr = node[item.name];
221 if (attr instanceof AudioParam) { 225 if (attr instanceof AudioParam) {
222 should(attr.value, prefix + '.' + item.name + '.value') 226 should(attr.value, prefix + '.' + item.name + '.value')
223 .beEqualTo(item.value); 227 .beEqualTo(item.value);
224 } else { 228 } else {
225 should(attr, prefix + '.' + item.name).beEqualTo(item.value); 229 should(attr, prefix + '.' + item.name).beEqualTo(item.value);
226 } 230 }
227 }); 231 });
228 } 232 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698