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

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

Issue 713683003: IDL: Support optional union type arguments with default values (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add unit tests 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
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 union types unittests'); 4 description('IDL union types unittests');
5 5
6 if (window.internals) { 6 if (window.internals) {
7 // The conversion rule prefers string over double, hence a value which 7 // The conversion rule prefers string over double, hence a value which
8 // is neither double nor string will be converted using ToString(). 8 // is neither double nor string will be converted using ToString().
9 9
10 var unionTypesTest = internals.unionTypesTest(); 10 var unionTypesTest = internals.unionTypesTest();
(...skipping 18 matching lines...) Expand all
29 shouldBeEqualToString('unionTypesTest.doubleOrStringArg(3.14)', 'double is p assed: 3.14'); 29 shouldBeEqualToString('unionTypesTest.doubleOrStringArg(3.14)', 'double is p assed: 3.14');
30 shouldBeEqualToString('unionTypesTest.doubleOrStringArg("foo")', 'string is passed: foo'); 30 shouldBeEqualToString('unionTypesTest.doubleOrStringArg("foo")', 'string is passed: foo');
31 shouldBeEqualToString('unionTypesTest.doubleOrStringArg(undefined)', 'string is passed: undefined'); 31 shouldBeEqualToString('unionTypesTest.doubleOrStringArg(undefined)', 'string is passed: undefined');
32 shouldBeEqualToString('unionTypesTest.doubleOrStringArg(null)', 'string is p assed: null'); 32 shouldBeEqualToString('unionTypesTest.doubleOrStringArg(null)', 'string is p assed: null');
33 shouldBeEqualToString('unionTypesTest.doubleOrStringArg({})', 'string is pas sed: [object Object]'); 33 shouldBeEqualToString('unionTypesTest.doubleOrStringArg({})', 'string is pas sed: [object Object]');
34 shouldBeEqualToString('unionTypesTest.doubleOrStringArg([])', 'string is pas sed: '); 34 shouldBeEqualToString('unionTypesTest.doubleOrStringArg([])', 'string is pas sed: ');
35 // ToString(Date) can contain timezone, so we can't specify the expectation. 35 // ToString(Date) can contain timezone, so we can't specify the expectation.
36 // Just check that doubleOrStringArg() doesn't throw an exception. 36 // Just check that doubleOrStringArg() doesn't throw an exception.
37 shouldBeEqualToString('typeof unionTypesTest.doubleOrStringArg(new Date)', ' string'); 37 shouldBeEqualToString('typeof unionTypesTest.doubleOrStringArg(new Date)', ' string');
38 shouldThrow('unionTypesTest.doubleOrStringArg()'); 38 shouldThrow('unionTypesTest.doubleOrStringArg()');
39 debug('');
40
41 debug('Tests for method arguments with defaults');
42 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultDoubleArg()', 'do uble is passed: 3.14');
43 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultDoubleArg(undefin ed)', 'double is passed: 3.14');
44 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultDoubleArg("foo")' , 'string is passed: foo');
45 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg()', 'st ring is passed: foo');
46 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg(undefin ed)', 'string is passed: foo');
47 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultStringArg(3.14)', 'double is passed: 3.14');
48 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg()', 'null is passed');
49 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(undefined )', 'null is passed');
50 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(null)', ' null is passed');
51 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg(3.14)', ' double is passed: 3.14');
52 shouldBeEqualToString('unionTypesTest.doubleOrStringDefaultNullArg("foo")', 'string is passed: foo');
53
39 } 54 }
40 </script> 55 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/idl-union-type-unittest-expected.txt » ('j') | Source/core/testing/UnionTypesTest.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698