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

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

Issue 724733002: Support for [Clamp] and [EnforceRange] to IDL dictionary. (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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 130
131 debug('Test for [Clamp] and [EnforceRange] member');
132 dictionaryTest.set({
133 longMember: 2147483648,
134 longMemberWithClamp: 2147483648
135 });
136 dict = dictionaryTest.get();
137 shouldBe('dict.longMember', '-2147483648');
138 shouldBe('dict.longMemberWithClamp', '2147483647');
139 shouldThrow('dictionaryTest.set({ longMemberWithEnforceRange: 2147483648 })' );
140 debug('');
141
131 debug('Test for derived dictionary'); 142 debug('Test for derived dictionary');
132 dictionaryTest.setDerived({}); 143 dictionaryTest.setDerived({});
133 derived = dictionaryTest.getDerived(); 144 derived = dictionaryTest.getDerived();
134 shouldBeUndefined('derived.longMember'); 145 shouldBeUndefined('derived.longMember');
135 shouldBe('derived.longMemberWithDefault', '42'); 146 shouldBe('derived.longMemberWithDefault', '42');
136 shouldBeUndefined('derived.longOrNullMember'); 147 shouldBeUndefined('derived.longOrNullMember');
137 shouldBeNull('derived.longOrNullMemberWithDefault'); 148 shouldBeNull('derived.longOrNullMemberWithDefault');
138 shouldBeUndefined('derived.booleanMember'); 149 shouldBeUndefined('derived.booleanMember');
139 shouldBeUndefined('derived.doubleMember'); 150 shouldBeUndefined('derived.doubleMember');
140 shouldBeUndefined('derived.stringMember'); 151 shouldBeUndefined('derived.stringMember');
(...skipping 22 matching lines...) Expand all
163 shouldBe('derived.longMember', '1'); 174 shouldBe('derived.longMember', '1');
164 shouldBeEqualToString('derived.stringMemberWithDefault', 'modifiedString'); 175 shouldBeEqualToString('derived.stringMemberWithDefault', 'modifiedString');
165 shouldBeEqualToString('derived.derivedStringMember', 'modifiedString2'); 176 shouldBeEqualToString('derived.derivedStringMember', 'modifiedString2');
166 shouldBeEqualToString('derived.derivedStringMemberWithDefault', 'modifiedStr ing3'); 177 shouldBeEqualToString('derived.derivedStringMemberWithDefault', 'modifiedStr ing3');
167 shouldBeUndefined('derived.invalidMember'); 178 shouldBeUndefined('derived.invalidMember');
168 179
169 debug(''); 180 debug('');
170 shouldThrow("dictionaryTest.setDerived({objectMember: 42})"); 181 shouldThrow("dictionaryTest.setDerived({objectMember: 42})");
171 } 182 }
172 </script> 183 </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