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

Side by Side Diff: LayoutTests/inspector/geolocation-emulation/emulate-geolocation-with-overrides.html

Issue 172393006: LayoutTest emulating geolocation with inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update review comments Created 6 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 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script>
5
6 function testLocationMock()
7 {
8 function testSuccess(position)
9 {
10 if (position.message) console.log("Error " + position.message)
11 else console.log("Latitude: " + position.coords.latitude + " Longitude: " + position.coords.longitude);
12 }
13
14 function testFailed()
15 {
16 console.log("Unexpected error occured. Test failed.");
17 }
18
19 var mockLatitude = 100;
20 var mockLongitude = 200;
21 var mockAccuracy = 94;
22
23 internals.setGeolocationPosition(document, mockLatitude, mockLongitude, mock Accuracy);
24 navigator.geolocation.getCurrentPosition(testSuccess, testFailed);
25 }
26
27 function setup()
28 {
29 if (window.internals) {
30 internals.setGeolocationClientMock(document);
31 internals.setGeolocationPermission(document, true);
32 }
33 }
34
35 function test()
36 {
37 InspectorTest.runTestSuite([
38 function setUp(next)
39 {
40 InspectorTest.evaluateInPage("setup()", next);
41 },
42
43 function setOverride(next)
44 {
45 InspectorTest.addConsoleSniffer(next);
46 // Override positions
47 GeolocationAgent.setGeolocationOverride(-510, 512, 100);
48 InspectorTest.evaluateInPage("testLocationMock()", next);
49 },
50
51 function clearOverride(next)
52 {
53 GeolocationAgent.clearGeolocationOverride(next);
54 }
55 ]);
56 }
57 </script>
58 </head>
59 <body onload="runTest()">
60 <p>
61 Tests that geolocation emulation with latitude and longitude works as expected.
62 </p>
63 </body>
64 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698