Skip to content

Commit 82e64de

Browse files
nsatragnomoz-wptsync-bot
authored andcommitted
Bug 1598763 [wpt PR 20409] - wptrunner: Fail with NotImplementedError when appropriate, a=testonly
Automatic update from web-platform-tests wptrunner: Fail with NotImplementedError when appropriate (#20409) Modify the base executor so that if a certain protocol message is not implemented, we fail with NotImplementedError instead of raising an exception and crashing the browser. Have unimplemented APIs explicitly throw this error on marionette. -- wpt-commits: 54bed30a94eb09200f8fa3d0dbf7360c271db2df wpt-pr: 20409
1 parent a875463 commit 82e64de

File tree

8 files changed

+96
-11
lines changed

8 files changed

+96
-11
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[generate_test_report.html]
2-
expected:
3-
if product == "firefox": ERROR
4-
if product == "safari" or product == "epiphany" or product == "webkit": ERROR
2+
[TestDriver generate_test_report method]
3+
expected:
4+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
[set_permission.https.html]
2-
expected:
3-
if product != "chrome": ERROR
2+
[Grant Permission for one realm]
3+
expected:
4+
if product != "chrome": FAIL
5+
6+
[Deny Permission, omit one realm]
7+
expected:
8+
if product != "chrome": FAIL
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
11
[virtual_authenticator.html]
2-
expected:
3-
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": ERROR
2+
[Can create an authenticator]
3+
expected:
4+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL
5+
6+
[Can add a credential]
7+
expected:
8+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL
9+
10+
[Can get the credentials]
11+
expected:
12+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL
13+
14+
[Can remove a credential]
15+
expected:
16+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL
17+
18+
[Can remove all credentials]
19+
expected:
20+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL
21+
22+
[Can set user verified]
23+
expected:
24+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL
25+
26+
[Can remove a virtual authenticator]
27+
expected:
28+
if product == "firefox" or product == "safari" or product == "epiphany" or product == "webkit": FAIL

testing/web-platform/tests/infrastructure/testdriver/virtual_authenticator.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
isResidentCredential: false,
2525
};
2626

27-
let authenticator_id;
27+
let authenticator_id = null;
2828

2929
promise_test(async t => {
3030
authenticator_id = await test_driver.add_virtual_authenticator({

testing/web-platform/tests/tools/wptrunner/wptrunner/executors/base.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from ..testrunner import Stop
1515
from .protocol import Protocol, BaseProtocolPart
16+
import webdriver as client
1617

1718
here = os.path.split(__file__)[0]
1819

@@ -700,6 +701,9 @@ def process_action(self, url, payload):
700701
raise ValueError("Unknown action %s" % action)
701702
try:
702703
result = action_handler(payload)
704+
except (NotImplementedError, client.UnknownCommandException):
705+
self.logger.warning("Action %s not implemented" % action)
706+
self._send_message("complete", "error", "Action %s not implemented" % action)
703707
except Exception:
704708
self.logger.warning("Action %s failed" % action)
705709
self.logger.warning(traceback.format_exc())

testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
ClickProtocolPart,
3232
SendKeysProtocolPart,
3333
TestDriverProtocolPart,
34-
CoverageProtocolPart)
34+
CoverageProtocolPart,
35+
GenerateTestReportProtocolPart,
36+
VirtualAuthenticatorProtocolPart,
37+
SetPermissionProtocolPart)
3538
from ..testrunner import Stop
3639
from ..webdriver_server import GeckoDriverServer
3740

@@ -481,6 +484,44 @@ def dump(self):
481484
# This usually happens if the process crashed
482485
pass
483486

487+
class MarionetteGenerateTestReportProtocolPart(GenerateTestReportProtocolPart):
488+
def setup(self):
489+
self.marionette = self.parent.marionette
490+
491+
def generate_test_report(self, config):
492+
raise NotImplementedError("generate_test_report not yet implemented")
493+
494+
class MarionetteVirtualAuthenticatorProtocolPart(VirtualAuthenticatorProtocolPart):
495+
def setup(self):
496+
self.marionette = self.parent.marionette
497+
498+
def add_virtual_authenticator(self, config):
499+
raise NotImplementedError("add_virtual_authenticator not yet implemented")
500+
501+
def remove_virtual_authenticator(self, authenticator_id):
502+
raise NotImplementedError("remove_virtual_authenticator not yet implemented")
503+
504+
def add_credential(self, authenticator_id, credential):
505+
raise NotImplementedError("add_credential not yet implemented")
506+
507+
def get_credentials(self, authenticator_id):
508+
raise NotImplementedError("get_credentials not yet implemented")
509+
510+
def remove_credential(self, authenticator_id, credential_id):
511+
raise NotImplementedError("remove_credential not yet implemented")
512+
513+
def remove_all_credentials(self, authenticator_id):
514+
raise NotImplementedError("remove_all_credentials not yet implemented")
515+
516+
def set_user_verified(self, authenticator_id, uv):
517+
raise NotImplementedError("set_user_verified not yet implemented")
518+
519+
class MarionetteSetPermissionProtocolPart(SetPermissionProtocolPart):
520+
def setup(self):
521+
self.marionette = self.parent.marionette
522+
523+
def set_permission(self, name, state, one_realm):
524+
raise NotImplementedError("set_permission not yet implemented")
484525

485526
class MarionetteProtocol(Protocol):
486527
implements = [MarionetteBaseProtocolPart,
@@ -493,7 +534,10 @@ class MarionetteProtocol(Protocol):
493534
MarionetteActionSequenceProtocolPart,
494535
MarionetteTestDriverProtocolPart,
495536
MarionetteAssertsProtocolPart,
496-
MarionetteCoverageProtocolPart]
537+
MarionetteCoverageProtocolPart,
538+
MarionetteGenerateTestReportProtocolPart,
539+
MarionetteVirtualAuthenticatorProtocolPart,
540+
MarionetteSetPermissionProtocolPart]
497541

498542
def __init__(self, executor, browser, capabilities=None, timeout_multiplier=1, e10s=True, ccov=False):
499543
do_delayed_imports()

testing/web-platform/tests/tools/wptrunner/wptrunner/testdriver-extra.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
result = JSON.parse(data.message).result
2020
pending_resolve(result);
2121
} else {
22-
pending_reject();
22+
pending_reject(`${data.status}: ${data.message}`);
2323
}
2424
});
2525

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import os
2+
import sys
3+
4+
here = os.path.abspath(os.path.split(__file__)[0])
5+
sys.path.insert(0, os.path.join(here, os.pardir, os.pardir, os.pardir))
6+
7+
import localpaths as _localpaths # noqa: F401

0 commit comments

Comments
 (0)