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

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/resources/context-properties.js

Issue 2386303002: Expose BaseAudioContext prototype (Closed)
Patch Set: fixed cross-origin-objects Created 4 years, 1 month 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
(Empty)
1 // The list of the 'own' properties in various AudioContexts. These lists were
2 // populated by running:
3 //
4 // Object.getOwnPropertyNames(FooAudioContext.prototype);
5 //
6 // https://webaudio.github.io/web-audio-api/#BaseAudioContext
7
8
9 let BaseAudioContextOwnProperties = [
10 'constructor',
11 'createAnalyser',
12 'createBiquadFilter',
13 'createBuffer',
14 'createBufferSource',
15 'createChannelMerger',
16 'createChannelSplitter',
17 'createConstantSource',
18 'createConvolver',
19 'createDelay',
20 'createDynamicsCompressor',
21 'createGain',
22 'createIIRFilter',
23 'createOscillator',
24 'createPanner',
25 'createPeriodicWave',
26 'createScriptProcessor',
27 'createStereoPanner',
28 'createWaveShaper',
29 'currentTime',
30 'decodeAudioData',
31 'destination',
32 'listener',
33 'onstatechange',
34 'resume',
35 'sampleRate',
36 'state',
37
38 // TODO(hongchan): these belong to AudioContext.
39 'createMediaElementSource',
40 'createMediaStreamDestination',
41 'createMediaStreamSource',
42
43 // TODO(hongchan): Not implemented yet.
44 // 'baseLatency'
45 ];
46
47
48 let AudioContextOwnProperties = [
49 'close',
50 'constructor',
51 'suspend',
52
53 // TODO(hongchan): Not implemented yet.
54 // 'outputLatency',
55 // 'getOutputTimestamp'
56 ];
57
58
59 let OfflineAudioContextOwnProperties = [
60 'constructor',
61 'length',
62 'oncomplete',
63 'startRendering',
64 'suspend',
65 ];
66
67
68 /**
69 * Verify properties in the prototype with the pre-populated list. This is a
70 * 2-way comparison to detect the missing and the unexpected property at the
71 * same time.
72 * @param {Object} targetPrototype Target prototype.
73 * @param {Array} populatedList Property dictionary.
74 * @param {Function} should |Should| assertion function.
75 * @return {Map} Verification result map.
76 */
77 function verifyPrototypeOwnProperties (targetPrototype, populatedList, should) {
78 let propertyMap = new Map();
79 let generatedList = Object.getOwnPropertyNames(targetPrototype);
80
81 for (let index in populatedList) {
82 propertyMap.set(populatedList[index], {
83 actual: false,
84 expected: true
85 });
86 }
87
88 for (let index in generatedList) {
89 if (propertyMap.has(generatedList[index])) {
90 propertyMap.get(generatedList[index]).actual = true;
91 } else {
92 propertyMap.set(generatedList[index], {
93 actual: true,
94 expected: false
95 });
96 }
97 }
98
99 // TODO(hongchan): replace the Should assertion when the new test infra lands.
100 for (let [property, result] of propertyMap) {
101 if (result.expected && result.actual) {
102 // The test meets the expectation.
103 should('The property "' + property + '"')
104 ._testPassed('was expected and found successfully', false);
105 } else if (result.expected && !result.actual) {
106 // The expected property is missing.
107 should('The property "' + property + '" was expected but not found.')
108 ._testFailed('', false);
109 } else if (!result.expected && result.actual) {
110 // Something unexpected was found.
111 should('The property "' + property + '" was not expected but found.')
112 ._testFailed('', false);
113 }
114 }
115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698