mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1819120 - [bidi] Migrate test_RemoteValue.js to a browser mochitest r=webdriver-reviewers,whimboo
Depends on D170809 Migrate the test to a browser mochitest and start testing deserialization in WindowRealm Differential Revision: https://phabricator.services.mozilla.com/D171107
This commit is contained in:
parent
c9738d3a71
commit
621bd2b0a3
@ -7,4 +7,8 @@ JAR_MANIFESTS += ["jar.mn"]
|
||||
with Files("**"):
|
||||
BUG_COMPONENT = ("Remote Protocol", "WebDriver BiDi")
|
||||
|
||||
BROWSER_CHROME_MANIFESTS += [
|
||||
"test/browser/browser.ini",
|
||||
]
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ["test/xpcshell/xpcshell.ini"]
|
||||
|
5
remote/webdriver-bidi/test/browser/browser.ini
Normal file
5
remote/webdriver-bidi/test/browser/browser.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[DEFAULT]
|
||||
tags = remote
|
||||
subsuite = remote
|
||||
|
||||
[browser_RemoteValue.js]
|
@ -418,6 +418,20 @@ add_task(function test_deserializeLocalValues() {
|
||||
}
|
||||
});
|
||||
|
||||
add_task(async function test_deserializeLocalValuesInWindowRealm() {
|
||||
for (const type of REMOTE_SIMPLE_VALUES.concat(REMOTE_COMPLEX_VALUES)) {
|
||||
const { value: expectedValue, serialized, deserializable } = type;
|
||||
|
||||
// Skip non deserializable cases
|
||||
if (!deserializable) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const value = await deserializeInWindowRealm(serialized);
|
||||
assertLocalValue(serialized.type, value, expectedValue);
|
||||
}
|
||||
});
|
||||
|
||||
add_task(function test_deserializeLocalValuesByHandle() {
|
||||
// Create two realms, realm1 will be used to serialize values, while realm2
|
||||
// will be used as a reference empty realm without any object reference.
|
||||
@ -986,3 +1000,21 @@ function assertInternalIds(serializationInternalMap, amount) {
|
||||
"Got expected amount of internalIds in serializationInternalMap"
|
||||
);
|
||||
}
|
||||
|
||||
function deserializeInWindowRealm(serialized) {
|
||||
return SpecialPowers.spawn(
|
||||
gBrowser.selectedBrowser,
|
||||
[serialized],
|
||||
async _serialized => {
|
||||
const { WindowRealm } = ChromeUtils.importESModule(
|
||||
"chrome://remote/content/webdriver-bidi/Realm.sys.mjs"
|
||||
);
|
||||
const { deserialize } = ChromeUtils.importESModule(
|
||||
"chrome://remote/content/webdriver-bidi/RemoteValue.sys.mjs"
|
||||
);
|
||||
const realm = new WindowRealm(content);
|
||||
info(`Checking '${_serialized.type}'`);
|
||||
return deserialize(realm, _serialized);
|
||||
}
|
||||
);
|
||||
}
|
@ -3,5 +3,4 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
[test_Realm.js]
|
||||
[test_RemoteValue.js]
|
||||
[test_WebDriverBiDiConnection.js]
|
||||
|
Loading…
x
Reference in New Issue
Block a user