summaryrefslogtreecommitdiffstats
path: root/remote/cdp/test/browser
diff options
context:
space:
mode:
Diffstat (limited to 'remote/cdp/test/browser')
-rw-r--r--remote/cdp/test/browser/browser_httpd.js4
-rw-r--r--remote/cdp/test/browser/input/doc_events.html3
-rw-r--r--remote/cdp/test/browser/log/browser_entryAdded.js4
-rw-r--r--remote/cdp/test/browser/network/browser_responseReceived.js20
-rw-r--r--remote/cdp/test/browser/network/browser_setCacheDisabled.js9
-rw-r--r--remote/cdp/test/browser/network/head.js10
-rw-r--r--remote/cdp/test/browser/page/browser_captureScreenshot.js10
-rw-r--r--remote/cdp/test/browser/page/browser_getLayoutMetrics.js30
-rw-r--r--remote/cdp/test/browser/page/browser_lifecycleEvent.js7
-rw-r--r--remote/cdp/test/browser/runtime/browser_exceptionThrown.js7
-rw-r--r--remote/cdp/test/browser/runtime/browser_getProperties.js6
-rw-r--r--remote/cdp/test/browser/security/browser_setIgnoreCertificateErrors.js2
-rw-r--r--remote/cdp/test/browser/systemInfo/browser_getProcessInfo.js10
-rw-r--r--remote/cdp/test/browser/target/browser_activateTarget.js4
-rw-r--r--remote/cdp/test/browser/target/browser_attachToTarget.js4
-rw-r--r--remote/cdp/test/browser/target/browser_closeTarget.js6
-rw-r--r--remote/cdp/test/browser/target/browser_targetDestroyed.js2
17 files changed, 80 insertions, 58 deletions
diff --git a/remote/cdp/test/browser/browser_httpd.js b/remote/cdp/test/browser/browser_httpd.js
index fb74ae8b70..f3d7b6581f 100644
--- a/remote/cdp/test/browser/browser_httpd.js
+++ b/remote/cdp/test/browser/browser_httpd.js
@@ -188,7 +188,7 @@ add_task(async function json_activate_target({ client, tab }) {
is(invalidResponse, "No such target id: does-not-exist");
});
-add_task(async function json_close_target({ CDP, client, tab }) {
+add_task(async function json_close_target({ CDP, client }) {
const { Target } = client;
const { targetInfo, newTab } = await openTab(Target);
@@ -224,7 +224,7 @@ add_task(async function json_close_target({ CDP, client, tab }) {
target => target.id === targetInfo.targetId
);
- ok(afterTarget == null, "New target is gone");
+ Assert.equal(afterTarget, null, "New target is gone");
const invalidResponse = await requestJSON("/json/close/does-not-exist", {
status: 404,
diff --git a/remote/cdp/test/browser/input/doc_events.html b/remote/cdp/test/browser/input/doc_events.html
index 74df931233..0cedc82e38 100644
--- a/remote/cdp/test/browser/input/doc_events.html
+++ b/remote/cdp/test/browser/input/doc_events.html
@@ -133,6 +133,9 @@
<div id="trackPointer" class="block"></div>
<div>
<h2>KeyReporter</h2>
+ <!-- Dummy Button is used to ensure pressing Shift+Tab on <input> will make the new focus
+ - remains in the same document, rather than the Chrome UI. -->
+ <button>Dummy Button</button>
<input type="text" id="keys" size="80">
</div>
<div>
diff --git a/remote/cdp/test/browser/log/browser_entryAdded.js b/remote/cdp/test/browser/log/browser_entryAdded.js
index 1c6ba2e0a8..7eb85a4e49 100644
--- a/remote/cdp/test/browser/log/browser_entryAdded.js
+++ b/remote/cdp/test/browser/log/browser_entryAdded.js
@@ -100,7 +100,7 @@ add_task(async function eventsForScriptErrorContent({ client }) {
is(events[0].lineNumber, 2, "Got expected line number");
});
-async function runEntryAddedTest(client, eventCount, callback, options = {}) {
+async function runEntryAddedTest(client, eventCount, callback) {
const { Log } = client;
const EVENT_ENTRY_ADDED = "Log.entryAdded";
@@ -109,7 +109,7 @@ async function runEntryAddedTest(client, eventCount, callback, options = {}) {
history.addRecorder({
event: Log.entryAdded,
eventName: EVENT_ENTRY_ADDED,
- messageFn: payload => `Received "${EVENT_ENTRY_ADDED}"`,
+ messageFn: () => `Received "${EVENT_ENTRY_ADDED}"`,
});
const timeBefore = Date.now();
diff --git a/remote/cdp/test/browser/network/browser_responseReceived.js b/remote/cdp/test/browser/network/browser_responseReceived.js
index 41e854de8a..5319f0eb65 100644
--- a/remote/cdp/test/browser/network/browser_responseReceived.js
+++ b/remote/cdp/test/browser/network/browser_responseReceived.js
@@ -74,8 +74,9 @@ add_task(async function documentNavigationWithResource({ client }) {
"127.0.0.1",
"Document response has the expected IP address"
);
- ok(
- typeof docResponse.response.remotePort == "number",
+ Assert.equal(
+ typeof docResponse.response.remotePort,
+ "number",
"Document response has a remotePort"
);
}
@@ -112,8 +113,9 @@ add_task(async function documentNavigationWithResource({ client }) {
docResponse.response.remoteIPAddress,
"Script response has same IP address as document response"
);
- ok(
- typeof scriptResponse.response.remotePort == "number",
+ Assert.equal(
+ typeof scriptResponse.response.remotePort,
+ "number",
"Script response has a remotePort"
);
}
@@ -166,8 +168,9 @@ add_task(async function documentNavigationWithResource({ client }) {
"127.0.0.1",
"Subdocument response has the expected IP address"
);
- ok(
- typeof frameDocResponse.response.remotePort == "number",
+ Assert.equal(
+ typeof frameDocResponse.response.remotePort,
+ "number",
"Subdocument response has a remotePort"
);
}
@@ -207,8 +210,9 @@ add_task(async function documentNavigationWithResource({ client }) {
docResponse.response.remoteIPAddress,
"Script response has same IP address as document response"
);
- ok(
- typeof frameScriptResponse.response.remotePort == "number",
+ Assert.equal(
+ typeof frameScriptResponse.response.remotePort,
+ "number",
"Script response has a remotePort"
);
}
diff --git a/remote/cdp/test/browser/network/browser_setCacheDisabled.js b/remote/cdp/test/browser/network/browser_setCacheDisabled.js
index 4af9f0fc07..a7272bfc54 100644
--- a/remote/cdp/test/browser/network/browser_setCacheDisabled.js
+++ b/remote/cdp/test/browser/network/browser_setCacheDisabled.js
@@ -18,7 +18,7 @@ add_task(async function cacheEnabledAfterDisabled({ client }) {
await waitForLoadFlags();
});
-add_task(async function cacheEnabledByDefault({ Network }) {
+add_task(async function cacheEnabledByDefault() {
await watchLoadFlags(LOAD_NORMAL, TEST_PAGE);
await loadURL(TEST_PAGE);
await waitForLoadFlags();
@@ -67,7 +67,7 @@ function watchLoadFlags(flags, url) {
);
},
- onStateChange(webProgress, request, flags, status) {
+ onStateChange(webProgress, request, flags) {
// We are checking requests - if there isn't one, ignore it.
if (!request) {
return;
@@ -99,8 +99,9 @@ function watchLoadFlags(flags, url) {
if (request.name == this.url && (flags & stopFlags) == stopFlags) {
this.docShell.removeProgressListener(this);
- ok(
- this.requestCount > 1,
+ Assert.greater(
+ this.requestCount,
+ 1,
this.url + " saw " + this.requestCount + " requests"
);
this.callback();
diff --git a/remote/cdp/test/browser/network/head.js b/remote/cdp/test/browser/network/head.js
index 3347e79e0f..2910f1c080 100644
--- a/remote/cdp/test/browser/network/head.js
+++ b/remote/cdp/test/browser/network/head.js
@@ -47,14 +47,16 @@ function assertEventOrder(first, second, options = {}) {
const firstDescription = getDescriptionForEvent(first);
const secondDescription = getDescriptionForEvent(second);
- ok(
- first.index < second.index,
+ Assert.less(
+ first.index,
+ second.index,
`${firstDescription} received before ${secondDescription})`
);
if (!ignoreTimestamps) {
- ok(
- first.payload.timestamp <= second.payload.timestamp,
+ Assert.lessOrEqual(
+ first.payload.timestamp,
+ second.payload.timestamp,
`Timestamp of ${firstDescription}) is earlier than ${secondDescription})`
);
}
diff --git a/remote/cdp/test/browser/page/browser_captureScreenshot.js b/remote/cdp/test/browser/page/browser_captureScreenshot.js
index ecd688fd14..1ccd54bc36 100644
--- a/remote/cdp/test/browser/page/browser_captureScreenshot.js
+++ b/remote/cdp/test/browser/page/browser_captureScreenshot.js
@@ -135,12 +135,14 @@ add_task(async function asJPEGFormatAndQuality({ client }) {
is(info10.height, (viewport.height - viewport.y) * scale);
// Images of different quality result in different content sizes
- ok(
- info100.length > infoDefault.length,
+ Assert.greater(
+ info100.length,
+ infoDefault.length,
"Size of quality 100 is larger than default"
);
- ok(
- info10.length < infoDefault.length,
+ Assert.less(
+ info10.length,
+ infoDefault.length,
"Size of quality 10 is smaller than default"
);
});
diff --git a/remote/cdp/test/browser/page/browser_getLayoutMetrics.js b/remote/cdp/test/browser/page/browser_getLayoutMetrics.js
index db8b3e8f3c..ad17e97aec 100644
--- a/remote/cdp/test/browser/page/browser_getLayoutMetrics.js
+++ b/remote/cdp/test/browser/page/browser_getLayoutMetrics.js
@@ -21,12 +21,14 @@ add_task(async function documentSmallerThanViewport({ client }) {
layoutViewport.pageY,
"Y position of content is equal to layout viewport"
);
- ok(
- contentSize.width <= layoutViewport.clientWidth,
+ Assert.lessOrEqual(
+ contentSize.width,
+ layoutViewport.clientWidth,
"Width of content is smaller than the layout viewport"
);
- ok(
- contentSize.height <= layoutViewport.clientHeight,
+ Assert.lessOrEqual(
+ contentSize.height,
+ layoutViewport.clientHeight,
"Height of content is smaller than the layout viewport"
);
});
@@ -49,12 +51,14 @@ add_task(async function documentLargerThanViewport({ client }) {
layoutViewport.pageY,
"Y position of content is equal to layout viewport"
);
- ok(
- contentSize.width > layoutViewport.clientWidth,
+ Assert.greater(
+ contentSize.width,
+ layoutViewport.clientWidth,
"Width of content is larger than the layout viewport"
);
- ok(
- contentSize.height > layoutViewport.clientHeight,
+ Assert.greater(
+ contentSize.height,
+ layoutViewport.clientHeight,
"Height of content is larger than the layout viewport"
);
});
@@ -81,12 +85,14 @@ add_task(async function documentLargerThanViewportScrolledXY({ client }) {
contentSize.y + 100,
"Y position of content is equal to layout viewport"
);
- ok(
- contentSize.width > layoutViewport.clientWidth,
+ Assert.greater(
+ contentSize.width,
+ layoutViewport.clientWidth,
"Width of content is larger than the layout viewport"
);
- ok(
- contentSize.height > layoutViewport.clientHeight,
+ Assert.greater(
+ contentSize.height,
+ layoutViewport.clientHeight,
"Height of content is larger than the layout viewport"
);
});
diff --git a/remote/cdp/test/browser/page/browser_lifecycleEvent.js b/remote/cdp/test/browser/page/browser_lifecycleEvent.js
index da5f5da9e8..eecf18f310 100644
--- a/remote/cdp/test/browser/page/browser_lifecycleEvent.js
+++ b/remote/cdp/test/browser/page/browser_lifecycleEvent.js
@@ -178,9 +178,10 @@ async function runPageLifecycleTest(client, expectedEventSets, callback) {
// Check data as exposed by each of these events
let lastTimestamp = frameEvents[0].payload.timestamp;
- frameEvents.forEach(({ payload }, index) => {
- ok(
- payload.timestamp >= lastTimestamp,
+ frameEvents.forEach(({ payload }) => {
+ Assert.greaterOrEqual(
+ payload.timestamp,
+ lastTimestamp,
"timestamp succeeds the one from the former event"
);
lastTimestamp = payload.timestamp;
diff --git a/remote/cdp/test/browser/runtime/browser_exceptionThrown.js b/remote/cdp/test/browser/runtime/browser_exceptionThrown.js
index 23e6dc2de9..ad46ae25a9 100644
--- a/remote/cdp/test/browser/runtime/browser_exceptionThrown.js
+++ b/remote/cdp/test/browser/runtime/browser_exceptionThrown.js
@@ -76,12 +76,7 @@ add_task(async function eventsForScriptErrorWithException({ client }) {
is(callFrames[1].url, PAGE_CONSOLE_EVENTS, "Got expected url");
});
-async function runExceptionThrownTest(
- client,
- eventCount,
- callback,
- options = {}
-) {
+async function runExceptionThrownTest(client, eventCount, callback) {
const { Runtime } = client;
const EVENT_EXCEPTION_THROWN = "Runtime.exceptionThrown";
diff --git a/remote/cdp/test/browser/runtime/browser_getProperties.js b/remote/cdp/test/browser/runtime/browser_getProperties.js
index f897c3dfcd..f004480a22 100644
--- a/remote/cdp/test/browser/runtime/browser_getProperties.js
+++ b/remote/cdp/test/browser/runtime/browser_getProperties.js
@@ -102,7 +102,11 @@ async function testGetPrototypeProperties({ Runtime }, contextId) {
objectId: result.objectId,
ownProperties: false,
});
- ok(result2.length > 1, "We have more properties than just the object one");
+ Assert.greater(
+ result2.length,
+ 1,
+ "We have more properties than just the object one"
+ );
const foo = result2.find(p => p.name == "foo");
ok(foo, "The object property is described");
ok(foo.isOwn, "and is reported as 'own' property");
diff --git a/remote/cdp/test/browser/security/browser_setIgnoreCertificateErrors.js b/remote/cdp/test/browser/security/browser_setIgnoreCertificateErrors.js
index d21e737ebe..969541f842 100644
--- a/remote/cdp/test/browser/security/browser_setIgnoreCertificateErrors.js
+++ b/remote/cdp/test/browser/security/browser_setIgnoreCertificateErrors.js
@@ -68,7 +68,7 @@ function isSecurityState(browser, expectedState) {
);
}
-add_task(async function testDefault({ Security }) {
+add_task(async function testDefault() {
for (const url of BAD_CERTS) {
info(`Navigating to ${url}`);
const loaded = BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser);
diff --git a/remote/cdp/test/browser/systemInfo/browser_getProcessInfo.js b/remote/cdp/test/browser/systemInfo/browser_getProcessInfo.js
index fb491e248f..d2ee0096e9 100644
--- a/remote/cdp/test/browser/systemInfo/browser_getProcessInfo.js
+++ b/remote/cdp/test/browser/systemInfo/browser_getProcessInfo.js
@@ -51,9 +51,13 @@ function assertProcesses(processInfo, tabs) {
ok(Array.isArray(processInfo), "Process info is an array");
for (const info of processInfo) {
- ok(typeof info.id === "number", "Info has a numeric id");
- ok(typeof info.type === "string", "Info has a string type");
- ok(typeof info.cpuTime === "number", "Info has a numeric cpuTime");
+ Assert.strictEqual(typeof info.id, "number", "Info has a numeric id");
+ Assert.strictEqual(typeof info.type, "string", "Info has a string type");
+ Assert.strictEqual(
+ typeof info.cpuTime,
+ "number",
+ "Info has a numeric cpuTime"
+ );
}
const getByType = type => processInfo.filter(info => info.type === type);
diff --git a/remote/cdp/test/browser/target/browser_activateTarget.js b/remote/cdp/test/browser/target/browser_activateTarget.js
index 03c5a96e07..9f4762dfae 100644
--- a/remote/cdp/test/browser/target/browser_activateTarget.js
+++ b/remote/cdp/test/browser/target/browser_activateTarget.js
@@ -3,7 +3,7 @@
"use strict";
-add_task(async function raisesWithoutArguments({ client, tab }) {
+add_task(async function raisesWithoutArguments({ client }) {
const { Target } = client;
await Assert.rejects(
@@ -13,7 +13,7 @@ add_task(async function raisesWithoutArguments({ client, tab }) {
);
});
-add_task(async function raisesWithUnknownTargetId({ client, tab }) {
+add_task(async function raisesWithUnknownTargetId({ client }) {
const { Target } = client;
await Assert.rejects(
diff --git a/remote/cdp/test/browser/target/browser_attachToTarget.js b/remote/cdp/test/browser/target/browser_attachToTarget.js
index 944d7a9984..2ffebc15a9 100644
--- a/remote/cdp/test/browser/target/browser_attachToTarget.js
+++ b/remote/cdp/test/browser/target/browser_attachToTarget.js
@@ -3,7 +3,7 @@
"use strict";
-add_task(async function raisesWithoutArguments({ client, tab }) {
+add_task(async function raisesWithoutArguments({ client }) {
const { Target } = client;
await Assert.rejects(
@@ -13,7 +13,7 @@ add_task(async function raisesWithoutArguments({ client, tab }) {
);
});
-add_task(async function raisesWithUnknownTargetId({ client, tab }) {
+add_task(async function raisesWithUnknownTargetId({ client }) {
const { Target } = client;
await Assert.rejects(
diff --git a/remote/cdp/test/browser/target/browser_closeTarget.js b/remote/cdp/test/browser/target/browser_closeTarget.js
index 694994148b..b1a980b8e0 100644
--- a/remote/cdp/test/browser/target/browser_closeTarget.js
+++ b/remote/cdp/test/browser/target/browser_closeTarget.js
@@ -3,7 +3,7 @@
"use strict";
-add_task(async function raisesWithoutArguments({ client, tab }) {
+add_task(async function raisesWithoutArguments({ client }) {
const { Target } = client;
await Assert.rejects(
@@ -13,7 +13,7 @@ add_task(async function raisesWithoutArguments({ client, tab }) {
);
});
-add_task(async function raisesWithUnknownTargetId({ client, tab }) {
+add_task(async function raisesWithUnknownTargetId({ client }) {
const { Target } = client;
await Assert.rejects(
@@ -23,7 +23,7 @@ add_task(async function raisesWithUnknownTargetId({ client, tab }) {
);
});
-add_task(async function triggersTargetDestroyed({ client, tab }) {
+add_task(async function triggersTargetDestroyed({ client }) {
const { Target } = client;
const { targetInfo, newTab } = await openTab(Target);
diff --git a/remote/cdp/test/browser/target/browser_targetDestroyed.js b/remote/cdp/test/browser/target/browser_targetDestroyed.js
index 2ad657b135..6668787ddc 100644
--- a/remote/cdp/test/browser/target/browser_targetDestroyed.js
+++ b/remote/cdp/test/browser/target/browser_targetDestroyed.js
@@ -3,7 +3,7 @@
"use strict";
-add_task(async function eventFiredWhenTabIsClosed({ client, tab }) {
+add_task(async function eventFiredWhenTabIsClosed({ client }) {
const { Target } = client;
const { newTab } = await openTab(Target);