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

Side by Side Diff: LayoutTests/fast/dom/idl-dictionary-unittest.html

Issue 740453004: IDL: Basic dictionary inheritance support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | LayoutTests/fast/dom/idl-dictionary-unittest-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <script> 3 <script>
4 description('IDL dictionary unittest'); 4 description('IDL dictionary unittest');
5 5
6 var testObject1 = { foo: 'x' }; 6 var testObject1 = { foo: 'x' };
7 var testObject2 = { bar: 'y' }; 7 var testObject2 = { bar: 'y' };
8 8
9 if (window.internals && internals.dictionaryTest) { 9 if (window.internals && internals.dictionaryTest) {
10 var dictionaryTest = window.internals.dictionaryTest(); 10 var dictionaryTest = window.internals.dictionaryTest();
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 debug('Test for setting invalid object value'); 121 debug('Test for setting invalid object value');
122 shouldThrow("dictionaryTest.set({objectMember: 42})"); 122 shouldThrow("dictionaryTest.set({objectMember: 42})");
123 shouldThrow("dictionaryTest.set({objectMember: 'invalid'})"); 123 shouldThrow("dictionaryTest.set({objectMember: 'invalid'})");
124 debug(''); 124 debug('');
125 125
126 debug('Test for passing invalid dictionary values'); 126 debug('Test for passing invalid dictionary values');
127 shouldThrow("dictionaryTest.set(42)"); 127 shouldThrow("dictionaryTest.set(42)");
128 shouldThrow("dictionaryTest.set('string')"); 128 shouldThrow("dictionaryTest.set('string')");
129 debug(''); 129 debug('');
130
131 debug('Test for derived dictionary');
132 dictionaryTest.setDerived({});
133 derived = dictionaryTest.getDerived();
134 shouldBeUndefined('derived.longMember');
135 shouldBe('derived.longMemberWithDefault', '42');
136 shouldBeUndefined('derived.longOrNullMember');
137 shouldBeNull('derived.longOrNullMemberWithDefault');
138 shouldBeUndefined('derived.booleanMember');
139 shouldBeUndefined('derived.doubleMember');
140 shouldBeUndefined('derived.stringMember');
141 shouldBeEqualToString('derived.stringMemberWithDefault', 'defaultStringValue ');
142 shouldBeUndefined('derived.stringSequenceMember');
143 shouldBeUndefined('derived.stringSequenceOrNullMember');
144 shouldBeUndefined('derived.elementMember');
145 shouldBeUndefined('derived.elementOrNullMember');
146 shouldBeUndefined('derived.enumMember');
147 shouldBeEqualToString('derived.enumMemberWithDefault', 'foo');
148 shouldBeUndefined('derived.enumOrNullMember');
149 shouldBeUndefined('derived.objectMember');
150 shouldBeNull('derived.objectOrNullMemberWithDefault');
151 shouldBeUndefined('derived.derivedStringMember');
152 shouldBeEqualToString('derived.derivedStringMemberWithDefault', 'derivedDefa ultStringValue');
153 debug('');
154
155 dictionaryTest.setDerived({
156 longMember: 1,
157 stringMemberWithDefault: 'modifiedString',
158 derivedStringMember: 'modifiedString2',
159 derivedStringMemberWithDefault: 'modifiedString3',
160 invalidMember: 'shouldNotBeSet',
161 });
162 derived = dictionaryTest.getDerived();
163 shouldBe('derived.longMember', '1');
164 shouldBeEqualToString('derived.stringMemberWithDefault', 'modifiedString');
165 shouldBeEqualToString('derived.derivedStringMember', 'modifiedString2');
166 shouldBeEqualToString('derived.derivedStringMemberWithDefault', 'modifiedStr ing3');
167 shouldBeUndefined('derived.invalidMember');
168
169 debug('');
170 shouldThrow("dictionaryTest.setDerived({objectMember: 42})");
130 } 171 }
131 </script> 172 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/idl-dictionary-unittest-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698