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

Side by Side Diff: LayoutTests/inspector/geolocation-emulation-tests.html

Issue 172393006: LayoutTest emulating geolocation with inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add sniffer code back Created 6 years, 9 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
« no previous file with comments | « no previous file | LayoutTests/inspector/geolocation-emulation-tests-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../http/tests/inspector/inspector-test.js"></script>
4 <script>
5
6 function overrideGeolocation()
7 {
8 function testSuccess(position)
9 {
10 if (position && position.coords)
11 console.log("Latitude: " + position.coords.latitude + " Longitude: " + position.coords.longitude);
12 else
13 console.log("Unexpected error occured. Test failed.");
14 }
15
16 function testFailed(error)
17 {
18 console.log(error.message);
19 }
20
21 var mockLatitude = 100;
22 var mockLongitude = 200;
23 var mockAccuracy = 94;
24
25 if (window.internals)
26 internals.setGeolocationPosition(document, mockLatitude, mockLongitude, mockAccuracy);
27
28 navigator.geolocation.getCurrentPosition(testSuccess, testFailed);
29 }
30
31 function setup()
32 {
33 if (window.internals) {
34 internals.setGeolocationClientMock(document);
35 internals.setGeolocationPermission(document, true);
36 }
37 }
38
39 function test()
40 {
41 InspectorTest.runTestSuite([
42 function setUp(next)
43 {
44 InspectorTest.evaluateInPage("setup()", next);
45 },
46
47 function testGeolocationUnavailable(next)
48 {
49 GeolocationAgent.setGeolocationOverride();
50 InspectorTest.addConsoleSniffer(next);
51 InspectorTest.evaluateInPage("overrideGeolocation()");
52 },
53
54 function testOverridenGeolocation(next)
55 {
56 GeolocationAgent.setGeolocationOverride(-510, 500, 100);
57 InspectorTest.addConsoleSniffer(next);
58 InspectorTest.evaluateInPage("overrideGeolocation()");
59 },
60
61 function testClearOverridenGeolocation(next)
62 {
63 GeolocationAgent.setGeolocationOverride(-510, 500, 100);
64 GeolocationAgent.clearGeolocationOverride();
65 InspectorTest.addConsoleSniffer(next);
66 InspectorTest.evaluateInPage("overrideGeolocation()");
67 },
68
69 function testInvalidParam(next)
70 {
71 GeolocationAgent.setGeolocationOverride(true, 500, 100);
72 next();
73 }
74 ]);
75 }
76 </script>
77 </head>
78 <body onload="runTest()">
79 <p>
80 Tests that geolocation emulation with latitude and longitude works as expected.
81 </p>
82 </body>
83 </html>
OLDNEW
« 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