Bug 1260548: Part 6 - Add basic tabs API support for Android. r=aswan
MozReview-Commit-ID: JJgcKp4AZ9S
This commit is contained in:
@@ -17,11 +17,9 @@ skip-if = (os == 'android') # android doesn't have devtools
|
||||
skip-if = (toolkit == 'android') # android doesn't have devtools
|
||||
[test_chrome_ext_eventpage_warning.html]
|
||||
[test_chrome_ext_contentscript_unrecognizedprop_warning.html]
|
||||
skip-if = (os == 'android') # browser.tabs is undefined. Bug 1258975 on android.
|
||||
[test_chrome_ext_hybrid_addons.html]
|
||||
[test_chrome_ext_trustworthy_origin.html]
|
||||
[test_chrome_ext_webnavigation_resolved_urls.html]
|
||||
skip-if = (os == 'android') # browser.tabs is undefined. Bug 1258975 on android.
|
||||
[test_chrome_native_messaging_paths.html]
|
||||
skip-if = os != "mac" && os != "linux"
|
||||
[test_ext_cookies_expiry.html]
|
||||
@@ -36,4 +34,3 @@ skip-if = os != "mac" && os != "linux"
|
||||
skip-if = os == 'android' # unsupported.
|
||||
[test_chrome_ext_downloads_saveAs.html]
|
||||
[test_chrome_ext_webrequest_background_events.html]
|
||||
skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
|
||||
|
||||
@@ -21,10 +21,13 @@ let commonEvents = {
|
||||
};
|
||||
|
||||
function background(events) {
|
||||
const IP_PATTERN = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/;
|
||||
|
||||
let expect;
|
||||
let ignore;
|
||||
let defaultOrigin;
|
||||
let watchAuth = Object.keys(events).includes("onAuthRequired");
|
||||
let expectedIp = null;
|
||||
|
||||
browser.test.onMessage.addListener((msg, expected) => {
|
||||
if (msg !== "set-expected") {
|
||||
@@ -223,7 +226,12 @@ function background(events) {
|
||||
browser.test.assertEq(expectCached, details.fromCache, "fromCache is correct");
|
||||
// We can only tell IPs for non-cached HTTP requests.
|
||||
if (!details.fromCache && /^https?:/.test(details.url)) {
|
||||
browser.test.assertEq("127.0.0.1", details.ip, `correct ip for ${details.url}`);
|
||||
browser.test.assertTrue(IP_PATTERN.test(details.ip), `IP for ${details.url} looks IP-ish: ${details.ip}`);
|
||||
|
||||
// We can't easily predict the IP ahead of time, so just make
|
||||
// sure they're all consistent.
|
||||
expectedIp = expectedIp || details.ip;
|
||||
browser.test.assertEq(expectedIp, details.ip, `correct ip for ${details.url}`);
|
||||
}
|
||||
if (expected.headers && expected.headers.response) {
|
||||
checkHeaders("response", expected, details);
|
||||
|
||||
@@ -43,7 +43,7 @@ support-files =
|
||||
[test_clipboard.html]
|
||||
# skip-if = # disabled test case with_permission_allow_copy, see inline comment.
|
||||
[test_ext_inIncognitoContext_window.html]
|
||||
skip-if = os == 'android' # Android does not currently support windows.
|
||||
skip-if = os == 'android' # Android does not support multiple windows.
|
||||
[test_ext_geturl.html]
|
||||
[test_ext_background_canvas.html]
|
||||
[test_ext_content_security_policy.html]
|
||||
@@ -54,68 +54,57 @@ skip-if = os == 'android' # Android does not currently support windows.
|
||||
[test_ext_contentscript_devtools_metadata.html]
|
||||
[test_ext_contentscript_exporthelpers.html]
|
||||
[test_ext_contentscript_incognito.html]
|
||||
skip-if = os == 'android' # Android does not multiple windows.
|
||||
skip-if = os == 'android' # Android does not support multiple windows.
|
||||
[test_ext_contentscript_css.html]
|
||||
[test_ext_contentscript_about_blank.html]
|
||||
[test_ext_contentscript_permission.html]
|
||||
skip-if = os == 'android' # Android does not support tabs API. Bug 1260250
|
||||
[test_ext_contentscript_teardown.html]
|
||||
skip-if = (os == 'android') # Android does not support tabs API. Bug 1260250
|
||||
[test_ext_exclude_include_globs.html]
|
||||
[test_ext_i18n_css.html]
|
||||
[test_ext_generate.html]
|
||||
[test_ext_notifications.html]
|
||||
[test_ext_permission_xhr.html]
|
||||
[test_ext_runtime_connect.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
[test_ext_runtime_connect_twoway.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
[test_ext_runtime_connect2.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
[test_ext_runtime_disconnect.html]
|
||||
[test_ext_runtime_id.html]
|
||||
[test_ext_sandbox_var.html]
|
||||
[test_ext_sendmessage_reply.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
[test_ext_sendmessage_reply2.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
[test_ext_sendmessage_doublereply.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
[test_ext_sendmessage_no_receiver.html]
|
||||
[test_ext_storage_content.html]
|
||||
[test_ext_storage_tab.html]
|
||||
skip-if = os == 'android' # Android does not currently support tabs.
|
||||
[test_ext_test.html]
|
||||
[test_ext_cookies.html]
|
||||
skip-if = os == 'android' # Bug 1258975 on android.
|
||||
[test_ext_background_api_injection.html]
|
||||
[test_ext_background_generated_url.html]
|
||||
[test_ext_background_teardown.html]
|
||||
[test_ext_tab_teardown.html]
|
||||
skip-if = (os == 'android') # Android does not support tabs API. Bug 1260250
|
||||
skip-if = os == 'android' # Bug 1258975 on android.
|
||||
[test_ext_unload_frame.html]
|
||||
[test_ext_i18n.html]
|
||||
skip-if = (os == 'android') # Bug 1258975 on android.
|
||||
[test_ext_listener_proxies.html]
|
||||
[test_ext_web_accessible_resources.html]
|
||||
skip-if = (os == 'android') # Bug 1258975 on android.
|
||||
[test_ext_webrequest_auth.html]
|
||||
skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
|
||||
skip-if = os == 'android'
|
||||
subsuite = webrequest
|
||||
[test_ext_webrequest_background_events.html]
|
||||
skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
|
||||
subsuite = webrequest
|
||||
[test_ext_webrequest_basic.html]
|
||||
skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
|
||||
subsuite = webrequest
|
||||
[test_ext_webrequest_filter.html]
|
||||
skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
|
||||
subsuite = webrequest
|
||||
[test_ext_webrequest_suspend.html]
|
||||
skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
|
||||
subsuite = webrequest
|
||||
[test_ext_webrequest_upload.html]
|
||||
skip-if = os == 'android' # webrequest api unsupported (bug 1258975).
|
||||
skip-if = os == 'android' # Currently fails in emulator tests
|
||||
subsuite = webrequest
|
||||
[test_ext_webnavigation.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
subsuite = webnavigation
|
||||
[test_ext_webnavigation_filters.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
subsuite = webnavigation
|
||||
[test_ext_window_postMessage.html]
|
||||
[test_ext_subframes_privileges.html]
|
||||
skip-if = os == 'android' # port.sender.tab is undefined on Android (bug 1258975).
|
||||
[test_ext_xhr_capabilities.html]
|
||||
|
||||
@@ -164,6 +164,11 @@ add_task(function* test_i18n() {
|
||||
add_task(function* test_get_accept_languages() {
|
||||
function background() {
|
||||
function checkResults(source, results, expected) {
|
||||
if (results[0] === "en-us" && expected[0] === "en-US") {
|
||||
// This sometimes winds up with unexpected capitalization in Android tests.
|
||||
expected[0] = expected[0].toLowerCase();
|
||||
}
|
||||
|
||||
browser.test.assertEq(
|
||||
expected.length,
|
||||
results.length,
|
||||
@@ -178,7 +183,7 @@ add_task(function* test_get_accept_languages() {
|
||||
|
||||
let tabId;
|
||||
|
||||
browser.tabs.query({currentWindow: true, active: true}, tabs => {
|
||||
browser.tabs.query({currentWindow: true, active: true}).then(tabs => {
|
||||
tabId = tabs[0].id;
|
||||
browser.test.sendMessage("ready");
|
||||
});
|
||||
@@ -318,6 +323,11 @@ add_task(function* test_get_ui_language() {
|
||||
|
||||
|
||||
add_task(function* test_detect_language() {
|
||||
if (AppConstants.MOZ_BUILD_APP !== "browser") {
|
||||
// This is not supported on Android.
|
||||
return;
|
||||
}
|
||||
|
||||
const af_string = " aam skukuza die naam beteken hy wat skoonvee of hy wat alles onderstebo keer wysig " +
|
||||
"bosveldkampe boskampe is kleiner afgeleë ruskampe wat oor min fasiliteite beskik daar is geen restaurante " +
|
||||
"of winkels nie en slegs oornagbesoekers word toegelaat bateleur";
|
||||
|
||||
@@ -135,6 +135,11 @@ add_task(function* testConnect_and_remove_frame() {
|
||||
});
|
||||
|
||||
add_task(function* testSendMessage_and_remove_window() {
|
||||
if (AppConstants.MOZ_BUILD_APP !== "browser") {
|
||||
// We can't rely on this timing on Android.
|
||||
return;
|
||||
}
|
||||
|
||||
let extension = createTestExtension("window", sendMessage_background, sendMessage_contentScript);
|
||||
yield extension.startup();
|
||||
|
||||
@@ -145,6 +150,11 @@ add_task(function* testSendMessage_and_remove_window() {
|
||||
});
|
||||
|
||||
add_task(function* testConnect_and_remove_window() {
|
||||
if (AppConstants.MOZ_BUILD_APP !== "browser") {
|
||||
// We can't rely on this timing on Android.
|
||||
return;
|
||||
}
|
||||
|
||||
let extension = createTestExtension("window", connect_background, connect_contentScript);
|
||||
yield extension.startup();
|
||||
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
if (AppConstants.platform === "android") {
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
}
|
||||
|
||||
/* globals sendMouseEvent */
|
||||
|
||||
function backgroundScript() {
|
||||
@@ -334,8 +338,13 @@ add_task(function* webnav_transitions_props() {
|
||||
ok(found, "Got the onCommitted event");
|
||||
|
||||
if (found) {
|
||||
is(found.details.transitionType, "manual_subframe",
|
||||
"Got the expected 'manual_subframe' transitionType in the OnCommitted event");
|
||||
if (AppConstants.MOZ_BUILD_APP === "browser") {
|
||||
is(found.details.transitionType, "manual_subframe",
|
||||
"Got the expected 'manual_subframe' transitionType in the OnCommitted event");
|
||||
} else {
|
||||
is(found.details.transitionType, "auto_subframe",
|
||||
"Got the expected 'manual_subframe' transitionType in the OnCommitted event");
|
||||
}
|
||||
}
|
||||
|
||||
// Test transitions properties on onHistoryStateUpdated events.
|
||||
|
||||
@@ -13,6 +13,10 @@
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
if (AppConstants.platform === "android") {
|
||||
SimpleTest.requestLongerTimeout(6);
|
||||
}
|
||||
|
||||
add_task(function* test_webnav_unresolved_uri_on_expected_URI_scheme() {
|
||||
function background() {
|
||||
let lastTest;
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
if (AppConstants.platform === "android") {
|
||||
SimpleTest.requestLongerTimeout(3);
|
||||
}
|
||||
|
||||
let extension;
|
||||
add_task(function* setup() {
|
||||
// SelfSupport has a tendency to fire when running this test alone, without
|
||||
|
||||
@@ -12,9 +12,20 @@
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
if (AppConstants.platform === "android") {
|
||||
SimpleTest.requestLongerTimeout(6);
|
||||
}
|
||||
|
||||
let windowData, testWindow;
|
||||
|
||||
add_task(function* setup() {
|
||||
let chromeScript = SpecialPowers.loadChromeScript(function() {
|
||||
let cache = Components.classes["@mozilla.org/netwerk/cache-storage-service;1"]
|
||||
.getService(Components.interfaces.nsICacheStorageService);
|
||||
cache.clear();
|
||||
});
|
||||
chromeScript.destroy();
|
||||
|
||||
testWindow = window.open("about:blank", "_blank", "width=100,height=100");
|
||||
yield waitForLoad(testWindow);
|
||||
|
||||
@@ -26,9 +37,12 @@ add_task(function* setup() {
|
||||
],
|
||||
},
|
||||
background() {
|
||||
browser.windows.getCurrent({populate: true}).then(window => {
|
||||
browser.test.log(`current window ${window.id} tabs: ${JSON.stringify(window.tabs.map(tab => [tab.id, tab.url]))}`);
|
||||
browser.test.sendMessage("windowData", {windowId: window.id, tabId: window.tabs[0].id});
|
||||
browser.tabs.query({currentWindow: true}).then(tabs => {
|
||||
let tab = tabs.find(tab => tab.active);
|
||||
let {windowId} = tab;
|
||||
|
||||
browser.test.log(`current window ${windowId} tabs: ${JSON.stringify(tabs.map(tab => [tab.id, tab.url]))}`);
|
||||
browser.test.sendMessage("windowData", {windowId, tabId: tab.id});
|
||||
});
|
||||
},
|
||||
});
|
||||
@@ -39,6 +53,11 @@ add_task(function* setup() {
|
||||
});
|
||||
|
||||
add_task(function* test_webRequest_filter_window() {
|
||||
if (AppConstants.MOZ_BUILD_APP !== "browser") {
|
||||
// Android does not support multiple windows.
|
||||
return;
|
||||
}
|
||||
|
||||
yield SpecialPowers.pushPrefEnv({
|
||||
set: [["dom.serviceWorkers.testing.enabled", true]],
|
||||
});
|
||||
@@ -100,7 +119,7 @@ add_task(function* test_webRequest_filter_tab() {
|
||||
"file_image_good.png": {
|
||||
optional_events: ["onBeforeRedirect", "onBeforeRequest", "onBeforeSendHeaders", "onSendHeaders"],
|
||||
type: "main_frame",
|
||||
cached: true,
|
||||
cached: AppConstants.MOZ_BUILD_APP === "browser",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -109,10 +128,12 @@ add_task(function* test_webRequest_filter_tab() {
|
||||
extension.sendMessage("set-expected", {expect, origin: location.href});
|
||||
yield extension.awaitMessage("continue");
|
||||
|
||||
// We should not get events for a new window load.
|
||||
let newWindow = window.open("file_image_good.png", "_blank", "width=100,height=100");
|
||||
yield waitForLoad(newWindow);
|
||||
newWindow.close();
|
||||
if (AppConstants.MOZ_BUILD_APP === "browser") {
|
||||
// We should not get events for a new window load.
|
||||
let newWindow = window.open("file_image_good.png", "_blank", "width=100,height=100");
|
||||
yield waitForLoad(newWindow);
|
||||
newWindow.close();
|
||||
}
|
||||
|
||||
// We should not get background events.
|
||||
let registration = yield navigator.serviceWorker.register("webrequest_worker.js?test1", {scope: "."});
|
||||
|
||||
Reference in New Issue
Block a user