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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/argument-types.html

Issue 2671933003: Move Geolocation out from fast/dom. (Closed)
Patch Set: . Created 3 years, 10 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
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
8 description("Tests the acceptable types for arguments to Geolocation methods.");
9
10 function shouldNotThrow(expression)
11 {
12 try {
13 eval(expression);
14 testPassed(expression + " did not throw exception.");
15 } catch(e) {
16 testFailed(expression + " should not throw exception. Threw exception " + e) ;
17 }
18 }
19
20 function test(expression, expressionShouldThrow, expectedException) {
21 if (expressionShouldThrow) {
22 if (expectedException)
23 shouldThrow(expression, '(function() { return "' + expectedException + '"; })();');
24 else
25 shouldThrow(expression);
26 } else {
27 shouldNotThrow(expression);
28 }
29 }
30
31 var emptyFunction = function() {};
32
33 function ObjectThrowingException() {};
34 ObjectThrowingException.prototype.valueOf = function() {
35 throw new Error('valueOf threw exception');
36 }
37 ObjectThrowingException.prototype.__defineGetter__("enableHighAccuracy", functio n() {
38 throw new Error('enableHighAccuracy getter exception');
39 });
40 var objectThrowingException = new ObjectThrowingException();
41
42
43 test('navigator.geolocation.getCurrentPosition()', true);
44
45 test('navigator.geolocation.getCurrentPosition(undefined)', true);
46 test('navigator.geolocation.getCurrentPosition(null)', true);
47 test('navigator.geolocation.getCurrentPosition({})', true);
48 test('navigator.geolocation.getCurrentPosition(objectThrowingException)', true);
49 test('navigator.geolocation.getCurrentPosition(emptyFunction)', false);
50 test('navigator.geolocation.getCurrentPosition(Math.abs)', false);
51 test('navigator.geolocation.getCurrentPosition(true)', true);
52 test('navigator.geolocation.getCurrentPosition(42)', true);
53 test('navigator.geolocation.getCurrentPosition(Infinity)', true);
54 test('navigator.geolocation.getCurrentPosition(-Infinity)', true);
55 test('navigator.geolocation.getCurrentPosition("string")', true);
56
57 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined)', false );
58 test('navigator.geolocation.getCurrentPosition(emptyFunction, null)', false);
59 test('navigator.geolocation.getCurrentPosition(emptyFunction, {})', true);
60 test('navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingExce ption)', true);
61 test('navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction)', f alse);
62 test('navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs)', false) ;
63 test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true);
64 test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true);
65 test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true);
66 test('navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity)', true) ;
67 test('navigator.geolocation.getCurrentPosition(emptyFunction, "string")', true);
68
69 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefin ed)', false);
70 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null)', false);
71 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {})', f alse);
72 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, objectT hrowingException)', true, 'Error: enableHighAccuracy getter exception');
73 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, emptyFu nction)', false);
74 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true)', true);
75 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42)', t rue);
76 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinit y)', true);
77 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infini ty)', true);
78 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string ")', true);
79
80 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:undefined})', false);
81 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:null})', false);
82 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:{}})', false);
83 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:objectThrowingException})', false);
84 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:emptyFunction})', false);
85 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:true})', false);
86 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:42})', false);
87 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:Infinity})', false);
88 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:-Infinity})', false);
89 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyP roperty:"string"})', false);
90
91 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:undefined})', false);
92 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:null})', false);
93 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:{}})', false);
94 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:objectThrowingException})', false);
95 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:emptyFunction})', false);
96 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:true})', false);
97 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:42})', false);
98 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:Infinity})', false);
99 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:-Infinity})', false);
100 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enable HighAccuracy:"string"})', false);
101
102 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:undefined})', false);
103 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:null})', false);
104 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:{}})', false);
105 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:objectThrowingException})', true, 'Error: valueOf threw exception');
106 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:emptyFunction})', false);
107 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:true})', false);
108 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:42})', false);
109 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:Infinity})', false);
110 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:-Infinity})', false);
111 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximu mAge:"string"})', false);
112
113 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:undefined})', false);
114 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:null})', false);
115 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:{}})', false);
116 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:objectThrowingException})', true, 'Error: valueOf threw exception');
117 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:emptyFunction})', false);
118 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:true})', false);
119 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:42})', false);
120 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:Infinity})', false);
121 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:-Infinity})', false);
122 test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeou t:"string"})', false);
123
124 window.jsTestIsAsync = false;
125
126 </script>
127 </body>
128 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698