Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import wpt@c85aa3307c29c969c3d153e1207e59738fa7764f
Using wpt-import in Chromium 6f43270. With Chromium commits locally applied on WPT: d2f2e4f "[Anonymous iframe] Improve test for popup" 1d0cf39 "[ResourceTiming]: Refactor initiatorType tests" 85d0a2a "Update split-cache.html test." aa46421 "[GridNG] Proper relayout of grid and out of flow items" Note to sheriffs: This CL imports external tests and adds expectations for those tests; if this CL is large and causes a few new failures, please fix the failures by adding new lines to TestExpectations rather than reverting. See: https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md Directory owners for changes in this CL: mcasas@chromium.org: external/wpt/geolocation-API NOAUTOREVERT=true R=rubber-stamper@appspot.gserviceaccount.com No-Export: true Cq-Include-Trybots: luci.chromium.try:linux-wpt-identity-fyi-rel,linux-wpt-input-fyi-rel Change-Id: I3ee58c60437ecfa66dd63dfde3d583e82bb5b6f3 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3061879 Auto-Submit: WPT Autoroller <wpt-autoroller@chops-service-accounts.iam.gserviceaccount.com> Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Cr-Commit-Position: refs/heads/master@{#907031}
- Loading branch information
Chromium WPT Sync
authored and
Chromium LUCI CQ
committed
Jul 30, 2021
1 parent
ad929a6
commit c089380
Showing
5 changed files
with
125 additions
and
0 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
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
103 changes: 103 additions & 0 deletions
103
third_party/blink/web_tests/external/wpt/geolocation-API/non-fully-active.https.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8" /> | ||
<title>Geolocation Test: non-fully active document</title> | ||
<link rel="help" href="https://github.com/w3c/geolocation-api/pull/97" /> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="support.js"></script> | ||
|
||
<script> | ||
promise_test(async function () { | ||
await test_driver.set_permission({ name: "geolocation" }, "granted"); | ||
|
||
// Create the iframe, wait for it to load... | ||
const iframe = document.createElement("iframe"); | ||
iframe.src = "resources/iframe.html"; | ||
iframe.allow = "geolocation"; | ||
document.body.appendChild(iframe); | ||
|
||
// ...wait for the iframe to load... | ||
await new Promise((resolve) => | ||
iframe.addEventListener("load", resolve, { once: true }) | ||
); | ||
|
||
// Steal geolocation. | ||
const geo = iframe.contentWindow.navigator.geolocation; | ||
|
||
// No longer fully active. | ||
iframe.remove(); | ||
|
||
// Try to watch a position while not fully active... | ||
const watchError = await new Promise((resolve, reject) => { | ||
const watchId = geo.watchPosition( | ||
reject, // We don't want a position | ||
resolve // We want an error! | ||
); | ||
// Always return 0. | ||
assert_equals( | ||
watchId, | ||
0, | ||
"watchId is 0 when document is not fully-active" | ||
); | ||
// And again, to make sure it's not changing | ||
const watchId2 = geo.watchPosition( | ||
() => {}, | ||
() => {} | ||
); | ||
assert_equals( | ||
watchId2, | ||
0, | ||
"watchId remains 0 when document is not fully-active" | ||
); | ||
}); | ||
|
||
assert_equals( | ||
watchError.code, | ||
GeolocationPositionError.POSITION_UNAVAILABLE, | ||
"watchPosition() returns an error on non-fully-active document" | ||
); | ||
|
||
// Now try to get current position while not fully active... | ||
const positionError = await new Promise((resolve, reject) => { | ||
geo.getCurrentPosition( | ||
reject, // We don't want a position | ||
resolve // We want an error! | ||
); | ||
}); | ||
assert_equals( | ||
positionError.code, | ||
GeolocationPositionError.POSITION_UNAVAILABLE, | ||
"getCurrentPosition() calls the errorCallback with POSITION_UNAVAILABLE" | ||
); | ||
|
||
// Re-attach, and go back to fully active. | ||
document.body.appendChild(iframe); | ||
iframe.contentWindow.opener = window; | ||
await new Promise((resolve) => | ||
window.addEventListener("load", resolve, { once: true }) | ||
); | ||
|
||
// And we are back to fully active. | ||
let watchId; | ||
let position = await new Promise((resolve, reject) => { | ||
watchId = iframe.contentWindow.navigator.geolocation.watchPosition( | ||
resolve, | ||
reject | ||
); | ||
}); | ||
assert_true(Number.isInteger(watchId), "Expected some number for watchId"); | ||
assert_true(position, "Expected a position"); | ||
|
||
// Finally, let's get the position from the reattached document. | ||
position = await new Promise((resolve, reject) => { | ||
iframe.contentWindow.navigator.geolocation.getCurrentPosition( | ||
resolve, | ||
reject | ||
); | ||
}); | ||
assert_true(Boolean(position), "Expected a position"); | ||
iframe.contentWindow.navigator.geolocation.clearWatch(watchId); | ||
}, "non-fully active document behavior"); | ||
</script> |
3 changes: 3 additions & 0 deletions
3
third_party/blink/web_tests/external/wpt/geolocation-API/resources/iframe.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<h1>Just a support file</h1> |