From 119e077108aa9ee83af41c47dfda8512a75e9ccc Mon Sep 17 00:00:00 2001 From: "Mark Foltz (Google)" Date: Mon, 18 Sep 2023 03:52:00 -0700 Subject: [PATCH] [remote-playback] Editorial improvements to text and code (#41852) --- remote-playback/README.md | 14 +++++++++---- .../cancel-watch-availability.html | 20 +++++++++---------- ...back-cancel-watch-availability-throws.html | 13 ++++++------ ...disable-remote-playback-prompt-throws.html | 5 ++--- ...te-playback-watch-availability-throws.html | 5 ++--- remote-playback/event-handlers-manual.html | 8 +++++--- remote-playback/prepare-device.js | 6 ++---- .../prompt-and-cancel-selection-manual.html | 8 ++++---- .../prompt-and-select-device-manual.html | 6 +++--- ...d-watch-availability-no-device-manual.html | 9 ++++----- ...watch-availability-with-device-manual.html | 8 ++++---- .../remote-video-control-pausing-manual.html | 8 ++++---- .../remote-video-control-seek-manual.html | 8 ++++---- .../remote-video-playback-manual.html | 6 +++--- ...-changes-when-selecting-device-manual.html | 4 ++-- ...te-changes-with-event-handlers-manual.html | 4 ++-- ...watch-availability-callback-parameter.html | 6 +++--- .../watch-availability-initial-callback.html | 6 +++--- ...ailability-promise-return-callback-id.html | 9 ++++----- 19 files changed, 77 insertions(+), 76 deletions(-) diff --git a/remote-playback/README.md b/remote-playback/README.md index b9342275937d801..da9bbc387f41ab0 100644 --- a/remote-playback/README.md +++ b/remote-playback/README.md @@ -8,7 +8,13 @@ File an issue: https://github.com/w3c/remote-playback/issues/new ## Hardware/network dependency -The Remote Playback API requires to communicate with a device over the network. -Some behavior would require a real devices to be implemented. In order to keep -these tests automated, only behaviors that can be run without user gesture or -specific configurations are available here. +The Remote Playback API requires communication with a device over the network. +Tests that end in `-manual.html` require a compatible device available on the +local area network to run the tests; these tests must be run manually. + +Known browser/device combinations that can be used to run manual tests: + +| Browser | Device | +| ------- | ------ | +| Chrome for Android | [Chromecast](https://store.google.com/product/chromecast_google_tv?pli=1&hl=en-US) | +| Safari | Apple TV | diff --git a/remote-playback/cancel-watch-availability.html b/remote-playback/cancel-watch-availability.html index a3fc96799390e7b..41cad7c272e2a32 100644 --- a/remote-playback/cancel-watch-availability.html +++ b/remote-playback/cancel-watch-availability.html @@ -1,23 +1,23 @@ - Tests various ways to call cancelWatchAvailability() + Tests cancelWatchAvailability() diff --git a/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html b/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html index 4783f64504ac84a..7b93f8e3af7aef1 100644 --- a/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html +++ b/remote-playback/disable-remote-playback-cancel-watch-availability-throws.html @@ -1,34 +1,33 @@ - Test that calling cancelWatchAvailability() when disableRemotePlayback - attribute is set throws an exception + Test that calling cancelWatchAvailability() when disableRemotePlayback attribute is set throws InvalidStateError diff --git a/remote-playback/disable-remote-playback-prompt-throws.html b/remote-playback/disable-remote-playback-prompt-throws.html index cd44045eb9343dd..b47e30eebaa1082 100644 --- a/remote-playback/disable-remote-playback-prompt-throws.html +++ b/remote-playback/disable-remote-playback-prompt-throws.html @@ -1,14 +1,13 @@ - Test that calling prompt() when disableRemotePlayback attribute is set - throws an exception + Test that calling prompt() when disableRemotePlayback attribute is set throws an exception @@ -30,7 +32,7 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let onConnectingCalled = false; let onConnectCalled = false; let onDisconnectCalled = false; @@ -55,6 +57,6 @@ assert_true(onDisconnectCalled, "ondisconnect was called"); }) ); - }, "Test that all event handlers are called."); + }, "Test that all event handlers are called when a remote playback device is connected."); diff --git a/remote-playback/prepare-device.js b/remote-playback/prepare-device.js index 825768f2db62b9d..a12dbaf28717cf3 100644 --- a/remote-playback/prepare-device.js +++ b/remote-playback/prepare-device.js @@ -1,10 +1,8 @@ -var startButton = document.getElementById("start-button"); -startButton.onclick = function () { +document.getElementById("start-button").onclick = () => { document.getElementById("prep").style.display = "none"; document.getElementById("pick-device").style.display = "block"; }; -var promptPrepButton = document.getElementById("prompt-button-prep"); -promptPrepButton.onclick = function () { +document.getElementById("prompt-button-prep").onclick = () => { v.remote .prompt() .then(() => {}) diff --git a/remote-playback/prompt-and-cancel-selection-manual.html b/remote-playback/prompt-and-cancel-selection-manual.html index eb93df83abfbfba..89a73730efaf640 100644 --- a/remote-playback/prompt-and-cancel-selection-manual.html +++ b/remote-playback/prompt-and-cancel-selection-manual.html @@ -1,7 +1,7 @@ - Test that promise is rejected when user cancels device selection. + Test that the Promise returned by prompt() is rejected when user cancels device selection @@ -17,7 +17,7 @@ diff --git a/remote-playback/prompt-and-select-device-manual.html b/remote-playback/prompt-and-select-device-manual.html index 0038c0f2dc76174..77973af6667925d 100644 --- a/remote-playback/prompt-and-select-device-manual.html +++ b/remote-playback/prompt-and-select-device-manual.html @@ -1,6 +1,6 @@ - Test that promise is resolved when user selects a device. + Test that the Promise returned by prompt() is resolved when user selects a device @@ -26,13 +26,13 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let button = document.getElementById("prompt-button"); button.onclick = t.step_func_done(() => { promise_test(() => { return v.remote.prompt(); }, "Prompt resolves"); }); - }, "Test that promise is resolved when user selects a device."); + }, "Test that the Promise returned by prompt() is resolved when user selects a device."); diff --git a/remote-playback/prompt-and-watch-availability-no-device-manual.html b/remote-playback/prompt-and-watch-availability-no-device-manual.html index 59f6d52bb140164..7d69f09afccf6d4 100644 --- a/remote-playback/prompt-and-watch-availability-no-device-manual.html +++ b/remote-playback/prompt-and-watch-availability-no-device-manual.html @@ -1,8 +1,7 @@ - Test that watchAvailability returned false when there is no device for the - user to select. + Test that watchAvailability() runs the callback with false when there is no device for the user to select @@ -29,12 +28,12 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let deviceAvailable = false; let button = document.getElementById("prompt-button"); button.onclick = function () { v.remote - .watchAvailability(t.step_func((avail) => (deviceAvailable = avail))) + .watchAvailability(t.step_func(avail => (deviceAvailable = avail))) .then( t.step_func(() => { promise_rejects_js(t, NotFoundError, v.remote.prompt()); @@ -43,6 +42,6 @@ t.unreached_func() ); }; - }, "Test that watchAvailability returned false when there is no device for the user to select."); + }, "Test that watchAvailability() runs the callback with false when there is no device for the user to select."); diff --git a/remote-playback/prompt-and-watch-availability-with-device-manual.html b/remote-playback/prompt-and-watch-availability-with-device-manual.html index fff8a38dad61919..fa8644931bfcb9e 100644 --- a/remote-playback/prompt-and-watch-availability-with-device-manual.html +++ b/remote-playback/prompt-and-watch-availability-with-device-manual.html @@ -1,7 +1,7 @@ - Test that watchAvailability returned true when user selects device. + Test that watchAvailability() runs the callback with true when user selects a device @@ -28,12 +28,12 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { let deviceAvailable = false; let button = document.getElementById("prompt-button"); button.onclick = () => { v.remote - .watchAvailability(t.step_func((avail) => (deviceAvailable = avail))) + .watchAvailability(t.step_func(avail => (deviceAvailable = avail))) .then( t.step_func(() => { v.remote @@ -51,6 +51,6 @@ t.unreached_func() ); }; - }, "Test that watchAvailability returned true when user selects device."); + }, "Test that watchAvailability() runs the callback with true when user selects a device."); diff --git a/remote-playback/remote-video-control-pausing-manual.html b/remote-playback/remote-video-control-pausing-manual.html index 21e8f9f12bcb4b8..8dfc19bf774ae5f 100644 --- a/remote-playback/remote-video-control-pausing-manual.html +++ b/remote-playback/remote-video-control-pausing-manual.html @@ -1,7 +1,7 @@ - Test that pause() on the local video is reflected on the remote device. + Test that pause() on the local video is reflected on the remote device @@ -36,7 +36,7 @@ diff --git a/remote-playback/remote-video-control-seek-manual.html b/remote-playback/remote-video-control-seek-manual.html index 5dc32667ae52692..56156d987105385 100644 --- a/remote-playback/remote-video-control-seek-manual.html +++ b/remote-playback/remote-video-control-seek-manual.html @@ -1,7 +1,7 @@ - Test that seek() on the local video is reflected on the remote device. + Test that seek() on the local video is reflected on the remote device @@ -39,7 +39,7 @@ diff --git a/remote-playback/remote-video-playback-manual.html b/remote-playback/remote-video-playback-manual.html index fb51c48a6c39665..223a5b4a289000a 100644 --- a/remote-playback/remote-video-playback-manual.html +++ b/remote-playback/remote-video-playback-manual.html @@ -1,6 +1,6 @@ - Test if video is playing on remote device. + Test if video is playing on remote device @@ -36,7 +36,7 @@ @@ -28,7 +28,7 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { assert_equals(v.remote.state, "disconnected"); function callback(available) { diff --git a/remote-playback/state-attribute-changes-with-event-handlers-manual.html b/remote-playback/state-attribute-changes-with-event-handlers-manual.html index e0e849a17f30e7d..725613e413c6a78 100644 --- a/remote-playback/state-attribute-changes-with-event-handlers-manual.html +++ b/remote-playback/state-attribute-changes-with-event-handlers-manual.html @@ -1,7 +1,7 @@ - Test that remote playback state changes when connecting and disconnecting. + Test that remote playback state changes when connecting and disconnecting @@ -32,7 +32,7 @@ let v = document.createElement("video"); v.src = getVideoURI("/media/movie_5"); - async_test((t) => { + async_test(t => { v.remote.onconnecting = () => assert_equals(v.remote.state, "connecting"); v.remote.onconneced = () => assert_equals(v.remote.state, "connected"); v.remote.ondisconnected = () => diff --git a/remote-playback/watch-availability-callback-parameter.html b/remote-playback/watch-availability-callback-parameter.html index e05507e7bfe12e0..fe407a9c03cbddd 100644 --- a/remote-playback/watch-availability-callback-parameter.html +++ b/remote-playback/watch-availability-callback-parameter.html @@ -2,13 +2,13 @@ Test that the callback is called with boolean parameter when calling - watchAvailability(). + watchAvailability() diff --git a/remote-playback/watch-availability-promise-return-callback-id.html b/remote-playback/watch-availability-promise-return-callback-id.html index 771a36c035deb87..c3df0b31f16af66 100644 --- a/remote-playback/watch-availability-promise-return-callback-id.html +++ b/remote-playback/watch-availability-promise-return-callback-id.html @@ -1,25 +1,24 @@ - Test that the promise returns the callback id when calling - watchAvailability(). + Test that the Promise returned by watchAvailability() resolves with a numeric callback id