Skip to content

Commit 4c532cd

Browse files
author
Alvin Ji
committed
feat(emulation): move accuracyMode into GeolocationCoordinates and refactor setGeolocationOverride
1 parent 0e36053 commit 4c532cd

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

index.bs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6292,6 +6292,7 @@ The <dfn export for=commands>emulation.setGeolocationOverride</dfn> command modi
62926292
? altitudeAccuracy: (float .ge 0.0) / null .default null,
62936293
? heading: (0.0...360.0) / null .default null,
62946294
? speed: (float .ge 0.0) / null .default null,
6295+
? accuracyMode: "approximate" / "precise",
62956296
}
62966297

62976298
emulation.GeolocationPositionError = {
@@ -6307,14 +6308,7 @@ The <dfn export for=commands>emulation.setGeolocationOverride</dfn> command modi
63076308
</dd>
63086309
</dl>
63096310

6310-
A <dfn>geolocation override</dfn> is a [=struct=] with:
6311-
* [=struct/item=] named <dfn attribute for="geolocation override">latitude</dfn> which is a float;
6312-
* [=struct/item=] named <dfn attribute for="geolocation override">longitude</dfn> which is a float;
6313-
* [=struct/item=] named <dfn attribute for="geolocation override">accuracy</dfn> which is a float;
6314-
* [=struct/item=] named <dfn attribute for="geolocation override">altitude</dfn> which is a float or null;
6315-
* [=struct/item=] named <dfn attribute for="geolocation override">altitudeAccuracy</dfn> which is a float or null;
6316-
* [=struct/item=] named <dfn attribute for="geolocation override">heading</dfn> which is a float or null;
6317-
* [=struct/item=] named <dfn attribute for="geolocation override">speed</dfn> which is a float or null.
6311+
A <dfn>geolocation override</dfn> is a [=/map=].
63186312

63196313
A [=remote end=] has a <dfn>geolocation override configuration</dfn>, which is
63206314
[=WebDriver configuration=] with [=WebDriver configuration/associated type=] [=geolocation override=].
@@ -6336,28 +6330,35 @@ To <dfn>update geolocation override</dfn> for [=/navigable=] |navigable|:
63366330

63376331
The [=remote end steps=] with |command parameters| are:
63386332

6339-
1. If |command parameters| [=map/contains=] "<code>coordinates</code>" and
6340-
|command parameters|["<code>coordinates</code>"] [=map/contains=]
6341-
"<code>altitudeAccuracy</code>" and
6342-
|command parameters|["<code>coordinates</code>"] doesn't [=map/contain=]
6343-
"<code>altitude</code>", return [=error=] with [=error code=]
6344-
[=invalid argument=].
6333+
1. Let |emulated position data| be [=WebDriver configuration/unset=].
63456334

63466335
1. If |command parameters| [=map/contains=] "<code>error</code>":
63476336

63486337
1. Assert |command parameters|["<code>error</code>"]["<code>type</code>"] equals
63496338
"<code>positionUnavailable</code>".
63506339

6351-
1. Let |emulated position data| be a [=/map=] matching [=GeolocationPositionError=]
6352-
production, with <code>code</code> field set to [=POSITION_UNAVAILABLE=] and
6353-
<code>message</code> field set to the empty string.
6340+
1. Set |emulated position data| to a new [=/map=].
63546341

6355-
Note: <code>message</code> will be ignored by implementation according to the geolocation spec.
6342+
1. [=map/set|Set=] |emulated position data|["<code>error</code>"] to
6343+
|command parameters|["<code>error</code>"].
63566344

6357-
1. Otherwise, let |emulated position data| be |command parameters|["<code>coordinates</code>"].
6345+
1. Otherwise, if |command parameters| [=map/contains=] "<code>coordinates</code>":
63586346

6359-
1. If |emulated position data| is null, set |emulated position data| to
6360-
[=WebDriver configuration/unset=].
6347+
1. If |command parameters|["<code>coordinates</code>"] is not null:
6348+
6349+
1. Assert |command parameters|["<code>coordinates</code>"] [=map/contains=]
6350+
"<code>latitude</code>" and |command parameters|["<code>coordinates</code>"]
6351+
[=map/contains=] "<code>longitude</code>".
6352+
6353+
1. If |command parameters|["<code>coordinates</code>"] [=map/contains=] "<code>accuracyMode</code>":
6354+
6355+
1. Assert |command parameters|["<code>coordinates</code>"]["<code>accuracyMode</code>"] is "<code>precise</code>"
6356+
or "<code>approximate</code>".
6357+
6358+
1. Set |emulated position data| to a new [=/map=].
6359+
6360+
1. [=map/set|Set=] |emulated position data|["<code>coordinates</code>"] to
6361+
|command parameters|["<code>coordinates</code>"].
63616362

63626363
1. Let |affected navigables| be the result of [=trying=] to [=store WebDriver configuration=]
63636364
[=geolocation override configuration=] |emulated position data| for |command parameters|.

0 commit comments

Comments
 (0)