Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[Geolocation] Expose Coordinates.floorLevel
https://bugs.webkit.org/show_bug.cgi?id=178173 <rdar://problem/34918936> Reviewed by Ryosuke Niwa. Source/WebCore: Expose Coordinates.floorLevel via the Geolocation API. This is currently a WebKit-specific extension and it is only populated on iOS / WKTR / DRT. It is null on other platforms. Test: fast/dom/Geolocation/floorLevel.html * Modules/geolocation/Coordinates.h: (WebCore::Coordinates::floorLevel const): * Modules/geolocation/Coordinates.idl: * Modules/geolocation/GeolocationPosition.h: (WebCore::GeolocationPosition::encode const): (WebCore::GeolocationPosition::decode): * Modules/geolocation/ios/GeolocationPositionIOS.mm: (WebCore::GeolocationPosition::GeolocationPosition): * page/Settings.in: Source/WebKit: * UIProcess/API/C/WKGeolocationPosition.cpp: (WKGeolocationPositionCreate): (WKGeolocationPositionCreate_b): (WKGeolocationPositionCreate_c): * UIProcess/API/C/WKGeolocationPosition.h: Tools: Add test infrastructure for testing Coordinates.floorLevel. * DumpRenderTree/TestRunner.cpp: (setMockGeolocationPositionCallback): * DumpRenderTree/TestRunner.h: * DumpRenderTree/mac/TestRunnerMac.mm: (TestRunner::setMockGeolocationPosition): * DumpRenderTree/win/TestRunnerWin.cpp: (TestRunner::setMockGeolocationPosition): * WebKitTestRunner/GeolocationProviderMock.cpp: (WTR::GeolocationProviderMock::setPosition): * WebKitTestRunner/GeolocationProviderMock.h: * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp: (WTR::InjectedBundle::setMockGeolocationPosition): * WebKitTestRunner/InjectedBundle/InjectedBundle.h: * WebKitTestRunner/InjectedBundle/TestRunner.cpp: (WTR::TestRunner::setMockGeolocationPosition): * WebKitTestRunner/InjectedBundle/TestRunner.h: * WebKitTestRunner/TestController.cpp: (WTR::TestController::setMockGeolocationPosition): * WebKitTestRunner/TestController.h: * WebKitTestRunner/TestInvocation.cpp: (WTR::TestInvocation::didReceiveMessageFromInjectedBundle): LayoutTests: Add layout test coverage. * fast/dom/Geolocation/floorLevel-expected.txt: Added. * fast/dom/Geolocation/floorLevel.html: Added. Canonical link: https://commits.webkit.org/194440@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223211 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
27 changed files
with
208 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,17 @@ | ||
Tests support for Geolocation's floorLevel | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS coords.latitude is mockLatitude | ||
PASS coords.longitude is mockLongitude | ||
PASS coords.accuracy is mockAccuracy | ||
PASS coords.altitude is mockAltitude | ||
PASS coords.altitudeAccuracy is mockAltitudeAccuracy | ||
PASS coords.heading is mockHeading | ||
PASS coords.speed is mockSpeed | ||
PASS coords.floorLevel is mockFloorLevel | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,39 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<script src="../../../resources/js-test.js"></script> | ||
<script> | ||
description("Tests support for Geolocation's floorLevel"); | ||
jsTestIsAsync = true; | ||
|
||
const mockLatitude = 51.478; | ||
const mockLongitude = -0.166; | ||
const mockAccuracy = 100.0; | ||
const mockAltitude = 10.1; | ||
const mockAltitudeAccuracy = 0.1; | ||
const mockHeading = 223.3; | ||
const mockSpeed = 123.4; | ||
const mockFloorLevel = 3; | ||
|
||
if (window.testRunner) { | ||
testRunner.setGeolocationPermission(true); | ||
testRunner.setMockGeolocationPosition(mockLatitude, mockLongitude, mockAccuracy, mockAltitude, mockAltitudeAccuracy, mockHeading, mockSpeed, mockFloorLevel); | ||
} | ||
|
||
function checkPosition(position) { | ||
coords = position.coords; | ||
shouldBe("coords.latitude", "mockLatitude"); | ||
shouldBe("coords.longitude", "mockLongitude"); | ||
shouldBe("coords.accuracy", "mockAccuracy"); | ||
shouldBe("coords.altitude", "mockAltitude"); | ||
shouldBe("coords.altitudeAccuracy", "mockAltitudeAccuracy"); | ||
shouldBe("coords.heading", "mockHeading"); | ||
shouldBe("coords.speed", "mockSpeed"); | ||
shouldBe("coords.floorLevel", "mockFloorLevel"); | ||
finishJSTest(); | ||
} | ||
|
||
navigator.geolocation.getCurrentPosition(checkPosition); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -46,6 +46,8 @@ | ||
speed = location.speed; | ||
if (location.course >= 0.0) | ||
heading = location.course; | ||
if (location.floor) | ||
floorLevel = location.floor.level; | ||
} | ||
|
||
} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.