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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Geolocation/reentrant-error.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/reentrant-error.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/reentrant-error.html b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/reentrant-error.html
index b735a7684b49d95445651ecce7dc2c04a4d69ab4..8492a6ebbce06df19e0970f58ab373642b8f3b5a 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Geolocation/reentrant-error.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Geolocation/reentrant-error.html
@@ -6,6 +6,53 @@
<script src="resources/geolocation-mock.js"></script>
</head>
<body>
-<script src="script-tests/reentrant-error.js"></script>
+<script>
+description("Tests that reentrant calls to Geolocation methods from the error callback are OK.");
+
+var mockMessage = 'test';
+
+var error;
+
+geolocationServiceMock.then(mock => {
+ mock.setGeolocationPermission(true);
+ mock.setGeolocationPositionUnavailableError(mockMessage);
+
+ var errorCallbackInvoked = false;
+ navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+ }, function(e) {
+ if (errorCallbackInvoked) {
+ testFailed('Error callback invoked unexpectedly');
+ finishJSTest();
+ }
+ errorCallbackInvoked = true;
+
+ error = e;
+ shouldBe('error.code', 'error.POSITION_UNAVAILABLE');
+ shouldBe('error.message', 'mockMessage');
+ debug('');
+ continueTest();
+ });
+
+ function continueTest() {
+ mockMessage += ' repeat';
+
+ mock.setGeolocationPositionUnavailableError(mockMessage);
+
+ navigator.geolocation.getCurrentPosition(function(p) {
+ testFailed('Success callback invoked unexpectedly');
+ finishJSTest();
+ }, function(e) {
+ error = e;
+ shouldBe('error.code', 'error.POSITION_UNAVAILABLE');
+ shouldBe('error.message', 'mockMessage');
+ finishJSTest();
+ });
+ }
+});
+
+window.jsTestIsAsync = true;
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698