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

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

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/Geolocation/argument-types.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/argument-types.html b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/argument-types.html
index 5436383169757f5340f43a6366c257c564abc689..113b732642801523722297ef76e3c47131718709 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/argument-types.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/argument-types.html
@@ -4,6 +4,125 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/argument-types.js"></script>
+<script>
+description("Tests the acceptable types for arguments to Geolocation methods.");
+
+function shouldNotThrow(expression)
+{
+ try {
+ eval(expression);
+ testPassed(expression + " did not throw exception.");
+ } catch(e) {
+ testFailed(expression + " should not throw exception. Threw exception " + e);
+ }
+}
+
+function test(expression, expressionShouldThrow, expectedException) {
+ if (expressionShouldThrow) {
+ if (expectedException)
+ shouldThrow(expression, '(function() { return "' + expectedException + '"; })();');
+ else
+ shouldThrow(expression);
+ } else {
+ shouldNotThrow(expression);
+ }
+}
+
+var emptyFunction = function() {};
+
+function ObjectThrowingException() {};
+ObjectThrowingException.prototype.valueOf = function() {
+ throw new Error('valueOf threw exception');
+}
+ObjectThrowingException.prototype.__defineGetter__("enableHighAccuracy", function() {
+ throw new Error('enableHighAccuracy getter exception');
+});
+var objectThrowingException = new ObjectThrowingException();
+
+
+test('navigator.geolocation.getCurrentPosition()', true);
+
+test('navigator.geolocation.getCurrentPosition(undefined)', true);
+test('navigator.geolocation.getCurrentPosition(null)', true);
+test('navigator.geolocation.getCurrentPosition({})', true);
+test('navigator.geolocation.getCurrentPosition(objectThrowingException)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction)', false);
+test('navigator.geolocation.getCurrentPosition(Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(true)', true);
+test('navigator.geolocation.getCurrentPosition(42)', true);
+test('navigator.geolocation.getCurrentPosition(Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(-Infinity)', true);
+test('navigator.geolocation.getCurrentPosition("string")', true);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, null)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, {})', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, objectThrowingException)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, emptyFunction)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, Math.abs)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, true)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, 42)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, -Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, "string")', true);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, undefined)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, null)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, objectThrowingException)', true, 'Error: enableHighAccuracy getter exception');
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, emptyFunction)', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, true)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, 42)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, -Infinity)', true);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, "string")', true);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:objectThrowingException})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {dummyProperty:"string"})', false);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:objectThrowingException})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {enableHighAccuracy:"string"})', false);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:objectThrowingException})', true, 'Error: valueOf threw exception');
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {maximumAge:"string"})', false);
+
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:undefined})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:null})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:{}})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:objectThrowingException})', true, 'Error: valueOf threw exception');
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:emptyFunction})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:true})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:42})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:-Infinity})', false);
+test('navigator.geolocation.getCurrentPosition(emptyFunction, undefined, {timeout:"string"})', false);
+
+window.jsTestIsAsync = false;
+
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698