AppTestDelegate.sys.mjs |
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ |
2682 |
AppTestDelegateChild.sys.mjs |
|
561 |
AppTestDelegateParent.sys.mjs |
This module provides the bridge between the "AppTestDelegate" helper in
mochitests and the supporting implementations in AppUiTestDelegate.sys.mjs.
"AppTestDelegate" is documented in AppTestDelegate.sys.mjs and enables
mochitests to invoke common functionality whose implementation is different
(e.g. in browser/ and mobile/ instead of toolkit/).
Tests can use this common interface after importing AppTestDelegate.sys.mjs:
// head.js, in the scope of a plain mochitest:
var { AppTestDelegate } = SpecialPowers.ChromeUtils.importESModule(
"resource://specialpowers/AppTestDelegate.sys.mjs"
);
// test usage example: open and close a tab.
let tab = await AppTestDelegate.openNewForegroundTab(window, url);
await AppTestDelegate.removeTab(window, tab);
## Overview of files supporting "AppTestDelegate":
MOZ_BUILD_APP-specific AppUiTestDelegate.sys.mjs implementations:
- browser/components/extensions/test/AppUiTestDelegate.sys.mjs
- mobile/shared/modules/test/AppUiTestDelegate.sys.mjs
- mail/components/extensions/test/AppUiTestDelegate.sys.mjs (in comm-central)
Glue between AppUiTestDelegate.sys.mjs in parent and test code in child:
- testing/specialpowers/content/AppTestDelegateParent.sys.mjs (this file)
- testing/specialpowers/content/AppTestDelegateChild.sys.mjs
- testing/specialpowers/content/AppTestDelegate.sys.mjs
Setup for usage by test code in child (i.e. plain mochitests):
- Import AppTestDelegate.sys.mjs (e.g. in head.js or the test)
Note: some browser-chrome tests import AppUiTestDelegate.sys.mjs directly,
but that is not part of this API contract. They merely reuse code.
## How to add new AppTestDelegate methods
- Add the method to AppTestDelegate.sys.mjs
- Add a message forwarder in AppTestDelegateChild.sys.mjs
- Add a message handler in AppTestDelegateParent.sys.mjs
- Add an implementation in AppUiTestDelegate.sys.mjs for each MOZ_BUILD_APP,
by defining the method on the exported AppUiTestDelegate object.
All AppUiTestDelegate implementations must be kept in sync to have the
same interface!
You should use the same method name across all of these files for ease of
lookup and maintainability.
|
4976 |
ContentTaskUtils.sys.mjs |
This module implements a number of utility functions that can be loaded
into content scope.
All asynchronous helper methods should return promises, rather than being
callback based.
|
8020 |
MockColorPicker.sys.mjs |
|
3610 |
MockFilePicker.sys.mjs |
|
9130 |
MockPermissionPrompt.sys.mjs |
|
2178 |
MockSound.sys.mjs |
|
1858 |
SpecialPowersChild.sys.mjs |
This code is loaded in every child process that is started by mochitest.
|
67718 |
SpecialPowersEventUtils.sys.mjs |
Loads a stub copy of EventUtils.js which can be used by things like
content tasks without holding any direct references to windows.
|
1076 |
SpecialPowersParent.sys.mjs |
|
45743 |
SpecialPowersSandbox.sys.mjs |
This modules handles creating and provisioning Sandboxes for
executing cross-process code from SpecialPowers. This allows all such
sandboxes to have a similar environment, and in particular allows
them to run test assertions in the target process and propagate
results back to the caller.
|
3546 |
WrapPrivileged.sys.mjs |
This module handles wrapping privileged objects so that they can be exposed
to unprivileged contexts. It is only to be used in automated tests.
Its exact semantics are also liable to change at any time, so any callers
relying on undocumented behavior or subtle platform features should expect
breakage. Those callers should, wherever possible, migrate to fully
chrome-privileged scripts when they need to interact with privileged APIs.
|
11543 |