Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script src="../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../http/tests/inspector/inspector-test.js"></script> |
| 4 <script src="../resources/permissions-helper.js"></script> | |
| 4 <script> | 5 <script> |
| 5 | 6 |
| 7 function grantGeolocationPermission() { | |
|
whywhat
2015/09/16 15:05:22
you also need to update the expected results for t
| |
| 8 PermissionsHelper.setPermission('geolocation', 'granted').then(function(p) { | |
| 9 console.log("Permission granted."); | |
| 10 }); | |
| 11 } | |
| 12 | |
| 6 function serializeGeolocationError(error) { | 13 function serializeGeolocationError(error) { |
| 7 var result = "Unknown error" | 14 var result = "Unknown error" |
| 8 switch (error.code) | 15 switch (error.code) |
| 9 { | 16 { |
| 10 case error.PERMISSION_DENIED: | 17 case error.PERMISSION_DENIED: |
| 11 result = "Permission denied"; | 18 result = "Permission denied"; |
| 12 break; | 19 break; |
| 13 case error.POSITION_UNAVAILABLE: | 20 case error.POSITION_UNAVAILABLE: |
| 14 result = "Position unavailable"; | 21 result = "Position unavailable"; |
| 15 break; | 22 break; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 function testFailed(error) | 60 function testFailed(error) |
| 54 { | 61 { |
| 55 console.log(serializeGeolocationError(error)); | 62 console.log(serializeGeolocationError(error)); |
| 56 } | 63 } |
| 57 | 64 |
| 58 navigator.geolocation.getCurrentPosition(testSuccess, testFailed); | 65 navigator.geolocation.getCurrentPosition(testSuccess, testFailed); |
| 59 } | 66 } |
| 60 | 67 |
| 61 function test() | 68 function test() |
| 62 { | 69 { |
| 63 if (window.testRunner) | 70 InspectorTest.runTestSuite([ |
| 64 window.testRunner.setPermission('geolocation', 'granted', location.origi n, location.origin); | 71 function testPermissionGranted(next) |
| 72 { | |
| 73 InspectorTest.addConsoleSniffer(next); | |
| 74 InspectorTest.evaluateInPage("grantGeolocationPermission()"); | |
| 75 }, | |
| 65 | 76 |
| 66 InspectorTest.runTestSuite([ | |
| 67 function testGeolocationUnavailable(next) | 77 function testGeolocationUnavailable(next) |
| 68 { | 78 { |
| 69 InspectorTest.EmulationAgent.setGeolocationOverride(); | 79 InspectorTest.EmulationAgent.setGeolocationOverride(); |
| 70 InspectorTest.addConsoleSniffer(next); | 80 InspectorTest.addConsoleSniffer(next); |
| 71 InspectorTest.evaluateInPage("overrideGeolocation()"); | 81 InspectorTest.evaluateInPage("overrideGeolocation()"); |
| 72 }, | 82 }, |
| 73 | 83 |
| 74 function testOverridenGeolocation(next) | 84 function testOverridenGeolocation(next) |
| 75 { | 85 { |
| 76 InspectorTest.EmulationAgent.setGeolocationOverride(50, 100, 95); | 86 InspectorTest.EmulationAgent.setGeolocationOverride(50, 100, 95); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 100 ]); | 110 ]); |
| 101 } | 111 } |
| 102 </script> | 112 </script> |
| 103 </head> | 113 </head> |
| 104 <body onload="runTest()"> | 114 <body onload="runTest()"> |
| 105 <p> | 115 <p> |
| 106 Tests that geolocation emulation with latitude and longitude works as expected. | 116 Tests that geolocation emulation with latitude and longitude works as expected. |
| 107 </p> | 117 </p> |
| 108 </body> | 118 </body> |
| 109 </html> | 119 </html> |
| OLD | NEW |