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

Unified Diff: LayoutTests/inspector/geolocation-emulation-tests.html

Issue 620343002: DevTools: Remove geolocation override from renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | LayoutTests/inspector/geolocation-emulation-tests-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/inspector/geolocation-emulation-tests.html
diff --git a/LayoutTests/inspector/geolocation-emulation-tests.html b/LayoutTests/inspector/geolocation-emulation-tests.html
index 850d9a998828b04c36fa1b246a3ac81d610e6bc8..470007615d7f7b9896afdeecf2521d3d2471f5f6 100644
--- a/LayoutTests/inspector/geolocation-emulation-tests.html
+++ b/LayoutTests/inspector/geolocation-emulation-tests.html
@@ -3,6 +3,25 @@
<script src="../http/tests/inspector/inspector-test.js"></script>
<script>
+function serializeGeolocationError(error) {
+ var result = "Unknown error"
+ switch (error.code)
+ {
+ case error.PERMISSION_DENIED:
+ result = "Permission denied";
+ break;
+ case error.POSITION_UNAVAILABLE:
+ result = "Position unavailable";
+ break;
+ case error.TIMEOUT:
+ result = "Request timed out";
+ break;
+ }
+ if (error.message)
+ result += " (" + error.message + ")";
+ return result;
+}
+
function overrideGeolocation()
{
function testSuccess(position)
@@ -15,7 +34,7 @@ function overrideGeolocation()
function testFailed(error)
{
- console.log(error.message);
+ console.log(serializeGeolocationError(error));
}
navigator.geolocation.getCurrentPosition(testSuccess, testFailed);
@@ -33,64 +52,45 @@ function overridenTimestampGeolocation()
function testFailed(error)
{
- console.log(error.message);
+ console.log(serializeGeolocationError(error));
}
navigator.geolocation.getCurrentPosition(testSuccess, testFailed);
}
-function setup()
-{
- var mockLatitude = 100;
- var mockLongitude = 200;
- var mockAccuracy = 94;
-
- if (window.internals) {
- internals.setGeolocationClientMock(document);
- internals.setGeolocationPermission(document, true);
- internals.setGeolocationPosition(document, mockLatitude, mockLongitude, mockAccuracy);
- }
-}
-
function test()
{
InspectorTest.runTestSuite([
- function setUp(next)
- {
- InspectorTest.evaluateInPage("setup()", next);
- },
-
function testGeolocationUnavailable(next)
{
- GeolocationAgent.setGeolocationOverride();
+ PageAgent.setGeolocationOverride();
InspectorTest.addConsoleSniffer(next);
InspectorTest.evaluateInPage("overrideGeolocation()");
},
function testOverridenGeolocation(next)
{
- GeolocationAgent.setGeolocationOverride(-510, 500, 100);
+ PageAgent.setGeolocationOverride(50, 100, 95);
InspectorTest.addConsoleSniffer(next);
InspectorTest.evaluateInPage("overrideGeolocation()");
},
- function testClearOverridenGeolocation(next)
+ function testInvalidParam(next)
{
- GeolocationAgent.setGeolocationOverride(-510, 500, 100);
- GeolocationAgent.clearGeolocationOverride();
- InspectorTest.addConsoleSniffer(next);
- InspectorTest.evaluateInPage("overrideGeolocation()");
+ PageAgent.setGeolocationOverride(true, 100, 95);
+ next();
},
- function testInvalidParam(next)
+ function testInvalidGeolocation(next)
{
- GeolocationAgent.setGeolocationOverride(true, 500, 100);
- next();
+ PageAgent.setGeolocationOverride(200, 300, 95);
+ InspectorTest.addConsoleSniffer(next);
+ InspectorTest.evaluateInPage("overrideGeolocation()");
},
function testTimestampOfOverridenPosition(next)
{
- GeolocationAgent.setGeolocationOverride(-510, 500, 100);
+ PageAgent.setGeolocationOverride(50, 100, 95);
InspectorTest.addConsoleSniffer(next);
InspectorTest.evaluateInPage("overridenTimestampGeolocation()");
}
« no previous file with comments | « no previous file | LayoutTests/inspector/geolocation-emulation-tests-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698