Bug 1656398 - part6 : use 'controller.playbackState' in test. r=chunmin

Differential Revision: https://phabricator.services.mozilla.com/D86627
This commit is contained in:
alwu 2020-08-18 06:44:18 +00:00
Родитель 0b9d0ae82c
Коммит e27e44aff0
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -95,12 +95,15 @@ function setGuessedPlaybackState(tab, state) {
return Promise.resolve();
}
function isActualPlaybackStateEqualTo(tab, expectedState) {
const currentState = MediaControlService.getCurrentMediaSessionPlaybackState();
async function isActualPlaybackStateEqualTo(tab, expectedState) {
const controller = tab.linkedBrowser.browsingContext.mediaController;
if (controller.playbackState != expectedState) {
await new Promise(r => (controller.onplaybackstatechange = r));
}
is(
currentState,
controller.playbackState,
expectedState,
`current state '${currentState}'' is equal to '${expectedState}'`
`current state '${controller.playbackState}' is equal to '${expectedState}'`
);
}