Bug 1632922 - Remove unused mobile/android/tests. r=snorp

This folder is entirely made up of chrome tests that we don't run anymore.

Differential Revision: https://phabricator.services.mozilla.com/D72428
This commit is contained in:
Agi Sferro 2020-04-24 21:53:10 +00:00
Родитель b6eb2ea22e
Коммит cef279c2d6
57 изменённых файлов: 0 добавлений и 4208 удалений

Просмотреть файл

@ -28,10 +28,6 @@ DIRS += [
'fonts',
]
TEST_DIRS += [
'tests',
]
TEST_HARNESS_FILES.testing.mochitest.tests.junit += [
'geckoview/src/androidTest/assets/www/hello.html',
'geckoview/src/androidTest/assets/www/simple_redirect.sjs',

Двоичные данные
mobile/android/tests/browser/chrome/audio.ogg

Двоичный файл не отображается.

Просмотреть файл

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title</title>
<meta name="description" content="This is the article description." />
</head>
<body>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

Просмотреть файл

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title - mobile</title>
<meta name="description" content="This is the article description." />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

Просмотреть файл

@ -1,22 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title</title>
<meta name="description" content="This is the article description." />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<style>
body { font-size: 200% !important; }
</style>
<body>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

Просмотреть файл

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>browser_scrollPositions_sample.html</title>
</head>
<body style='width: 100000px; height: 100000px;'>top</body>
</html>

Просмотреть файл

@ -1,8 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>browser_scrollPositions_sample.html</title>
</head>
<body style='width: 100000px; height: 100000px;'>top</body>
</html>

Просмотреть файл

@ -1,11 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
<html lang="en">
<head>
<meta charset="utf-8">
<title>browser_scrollPositions_sample_frameset.html</title>
</head>
<frameset id="frames" rows="50%, 50%">
<frame src="browser_scrollPositions_sample.html">
<frame src="browser_scrollPositions_sample.html">
</frameset>
</html>

Просмотреть файл

@ -1,13 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>browser_scrollPositions_sample_small.html</title>
</head>
<!-- Make the page short enough that it doesn't have a layout scroll range.
In the absence of an explicit minimum-scale, the minimum scale defaults
to 0.25, which means the layout viewport will be expanded to up to 4x
the screen size. So, this assumes the screen size is at least
250x250. -->
<body style='width: 1000px; height: 1000px;'>top</body>
</html>

Просмотреть файл

@ -1,60 +0,0 @@
[DEFAULT]
skip-if = os != 'android'
support-files =
audio.ogg
basic_article.html
basic_article_mobile.html
basic_article_mobile_2x.html
browser_scrollPositions_sample.html
browser_scrollPositions_sample2.html
browser_scrollPositions_sample_frameset.html
browser_scrollPositions_sample_small.html
desktopmode_user_agent.sjs
devicesearch.xml
head.js
head_scroll.js
head_search.js
media_playback.html
session_formdata_sample.html
simpleservice.xml
video_controls.html
video_discovery.html
video_discovery.sjs
web_channel.html
[test_about_logins.html]
[test_accounts.html]
[test_android_log.html]
[test_app_constants.html]
[test_awsy_lite.html]
# historically, we only run awsy on opt; gc times out on debug
skip-if = debug
[test_debugger_server.html]
[test_desktop_useragent.html]
[test_device_search_engine.html]
[test_get_last_visited.html]
[test_identity_mode.html]
[test_migrate_ui.html]
[test_mozAutoplayMediaBlocked.html]
[test_network_manager.html]
[test_offline_page.html]
skip-if = true # Bug 1241478
[test_reader_view.html]
[test_referrer.html]
[test_resource_substitutions.html]
[test_restricted_profiles.html]
[test_selectoraddtab.html]
[test_session_clear_history.html]
[test_session_form_data.html]
[test_session_parentid.html]
[test_session_scroll_position.html]
[test_session_scroll_visual_viewport.html]
support-files =
../../../../../gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
../../../../../gfx/layers/apz/test/mochitest/apz_test_utils.js
skip-if = !debug # bug 1519580
[test_session_undo_close_tab.html]
[test_session_zombification.html]
[test_simple_discovery.html]
[test_video_discovery.html]
[test_web_channel.html]

Просмотреть файл

@ -1,11 +0,0 @@
function handleRequest(request, response)
{
// avoid confusing cache behaviors
response.setHeader("Cache-Control", "no-cache", false);
response.setHeader("Content-Type", "text/plain", false);
response.setHeader("Access-Control-Allow-Origin", "*", false);
// used by mobile/desktop user agent tests
response.write(request.getHeader("User-Agent"));
}

Просмотреть файл

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Test search engine</ShortName>
<Description>A test search engine (based on Google search)</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/png;base64,AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADs9Pt8xetPtu9FsfFNtu%2BTzvb2%2B%2Fne4dFJeBw0egA%2FfAJAfAA8ewBBegAAAAD%2B%2FPtft98Mp%2BwWsfAVsvEbs%2FQeqvF8xO7%2F%2F%2F63yqkxdgM7gwE%2FggM%2BfQA%2BegBDeQDe7PIbotgQufcMufEPtfIPsvAbs%2FQvq%2Bfz%2Bf%2F%2B%2B%2FZKhR05hgBBhQI8hgBAgAI9ewD0%2B%2Fg3pswAtO8Cxf4Kw%2FsJvvYAqupKsNv%2B%2Fv7%2F%2FP5VkSU0iQA7jQA9hgBDgQU%2BfQH%2F%2Ff%2FQ6fM4sM4KsN8AteMCruIqqdbZ7PH8%2Fv%2Fg6Nc%2Fhg05kAA8jAM9iQI%2BhQA%2BgQDQu6b97uv%2F%2F%2F7V8Pqw3eiWz97q8%2Ff%2F%2F%2F%2F7%2FPptpkkqjQE4kwA7kAA5iwI8iAA8hQCOSSKdXjiyflbAkG7u2s%2F%2B%2F%2F39%2F%2F7r8utrqEYtjQE8lgA7kwA7kwA9jwA9igA9hACiWSekVRyeSgiYSBHx6N%2F%2B%2Fv7k7OFRmiYtlAA5lwI7lwI4lAA7kgI9jwE9iwI4iQCoVhWcTxCmb0K%2BooT8%2Fv%2F7%2F%2F%2FJ2r8fdwI1mwA3mQA3mgA8lAE8lAE4jwA9iwE%2BhwGfXifWvqz%2B%2Ff%2F58u%2Fev6Dt4tr%2B%2F%2F2ZuIUsggA7mgM6mAM3lgA5lgA6kQE%2FkwBChwHt4dv%2F%2F%2F728ei1bCi7VAC5XQ7kz7n%2F%2F%2F6bsZkgcB03lQA9lgM7kwA2iQktZToPK4r9%2F%2F%2F9%2F%2F%2FSqYK5UwDKZAS9WALIkFn%2B%2F%2F3%2F%2BP8oKccGGcIRJrERILYFEMwAAuEAAdX%2F%2Ff7%2F%2FP%2B%2BfDvGXQLIZgLEWgLOjlf7%2F%2F%2F%2F%2F%2F9QU90EAPQAAf8DAP0AAfMAAOUDAtr%2F%2F%2F%2F7%2B%2Fu2bCTIYwDPZgDBWQDSr4P%2F%2Fv%2F%2F%2FP5GRuABAPkAA%2FwBAfkDAPAAAesAAN%2F%2F%2B%2Fz%2F%2F%2F64g1C5VwDMYwK8Yg7y5tz8%2Fv%2FV1PYKDOcAAP0DAf4AAf0AAfYEAOwAAuAAAAD%2F%2FPvi28ymXyChTATRrIb8%2F%2F3v8fk6P8MAAdUCAvoAAP0CAP0AAfYAAO4AAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAAQAA</Image>
<Url type="text/html" method="GET" template="http://example.com/search">
<Param name="q" value="{searchTerms}"/>
</Url>
<Url type="application/x-moz-tabletsearch" method="GET" template="http://example.com/search/tablet">
<Param name="q" value="{searchTerms}"/>
</Url>
<Url type="application/x-moz-phonesearch" method="GET" template="http://example.com/search/phone">
<Param name="q" value="{searchTerms}"/>
</Url>
<SearchForm>http://example.com/</SearchForm>
</SearchPlugin>

Просмотреть файл

@ -1,119 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function promiseBrowserEvent(browserOrFrame, eventType, options = {}) {
let listenerOptions = { capture: true };
if (options.mozSystemGroup) {
listenerOptions.mozSystemGroup = true;
}
return new Promise(resolve => {
function handle(event) {
// Since we'll be redirecting, don't make assumptions about the given URL and the loaded URL
let document = browserOrFrame.contentDocument || browserOrFrame.document;
if (
(event.target != document &&
event.target != document.ownerGlobal.visualViewport) ||
document.location.href == "about:blank"
) {
info(
"Skipping spurious '" +
eventType +
"' event" +
" for " +
document.location.href
);
return;
}
info("Received event " + eventType + " from browser");
browserOrFrame.removeEventListener(eventType, handle, listenerOptions);
if (options.resolveAtNextTick) {
Services.tm.dispatchToMainThread(() => resolve(event));
} else {
resolve(event);
}
}
browserOrFrame.addEventListener(eventType, handle, listenerOptions);
info("Now waiting for " + eventType + " event from browser");
});
}
function promiseTabEvent(container, eventType) {
return new Promise(resolve => {
function handle(event) {
info("Received event " + eventType + " from container");
container.removeEventListener(eventType, handle, true);
resolve(event);
}
container.addEventListener(eventType, handle, true);
info("Now waiting for " + eventType + " event from container");
});
}
function promiseNotification(aTopic) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
return new Promise((resolve, reject) => {
function observe(subject, topic, data) {
info("Received " + topic + " notification from Gecko");
Services.obs.removeObserver(observe, topic);
resolve();
}
Services.obs.addObserver(observe, aTopic);
info("Now waiting for " + aTopic + " notification from Gecko");
});
}
function promiseLinkVisit(url) {
const { Services } = ChromeUtils.import(
"resource://gre/modules/Services.jsm"
);
var linkVisitedTopic = "link-visited";
return new Promise((resolve, reject) => {
function observe(subject, topic, data) {
info("Received " + topic + " notification from Gecko");
var uri = subject.QueryInterface(Ci.nsIURI);
if (uri.spec != url) {
info(
"Visited URL " +
uri.spec +
" is not desired URL " +
url +
"; ignoring."
);
return;
}
info("Visited URL " + uri.spec + " is desired URL " + url);
Services.obs.removeObserver(observe, topic);
resolve();
}
Services.obs.addObserver(observe, linkVisitedTopic);
info(
"Now waiting for " +
linkVisitedTopic +
" notification from Gecko with URL " +
url
);
});
}
function makeObserver(observerId) {
let deferred = Promise.defer();
let ret = {
id: observerId,
count: 0,
promise: deferred.promise,
observe(subject, topic, data) {
ret.count += 1;
let msg = { subject, topic, data };
deferred.resolve(msg);
},
};
return ret;
}

Просмотреть файл

@ -1,86 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function fuzzyEquals(a, b) {
return Math.abs(a - b) < 1e-6;
}
function getFrame(browser, { frame = null }) {
let window;
if (frame !== null) {
window = browser.contentWindow.frames[frame];
} else {
window = browser.contentWindow;
}
return window;
}
function setScrollPosition(browser, { x = 0, y = 0, zoom = 0, frame = null }) {
let window = getFrame(browser, { frame });
let topLevelUtils = browser.contentWindow.windowUtils;
if (zoom) {
topLevelUtils.setResolutionAndScaleTo(zoom);
}
// The root content document has a distinction between visual and layout
// scroll positions. We want to set the visual one.
// For frames, there is no such distinction and scrollToVisual() does
// not support them, so use window.scrollTo().
if (frame !== null) {
window.scrollTo(x, y);
} else {
topLevelUtils.scrollToVisual(
x,
y,
topLevelUtils.UPDATE_TYPE_MAIN_THREAD,
topLevelUtils.SCROLL_MODE_INSTANT
);
}
}
function checkScroll(browser, data) {
let { x, y, zoom } = data;
let scrollPos = getScrollPosition(browser, data);
if (data.hasOwnProperty("x")) {
is(scrollPos.x, x, "scrollX set correctly");
}
if (data.hasOwnProperty("y")) {
is(scrollPos.y, y, "scrollY set correctly");
}
if (zoom) {
ok(fuzzyEquals(scrollPos.zoom, zoom), "zoom set correctly");
}
}
function getScrollPosition(browser, data = {}) {
let utils = getFrame(browser, data).windowUtils;
let x = {},
y = {};
let zoom = utils.getResolution();
utils.getVisualViewportOffset(x, y);
return { x: x.value, y: y.value, zoom };
}
function getScrollString({ x = 0, y = 0 }) {
return x + "," + y;
}
function presStateToCSSPx(presState) {
// App units aren't commonly exposed to JS, so we can't just call a helper function
// and have to convert them ourselves instead.
// Conversion factor taken from gfx/src/AppUnits.h.
const APP_UNITS_PER_CSS_PX = 60;
let state = { ...presState };
if (state.scroll) {
let scroll = state.scroll.split(",").map(pos => parseInt(pos, 10) || 0);
scroll = scroll.map(appUnits =>
Math.round(appUnits / APP_UNITS_PER_CSS_PX)
);
state.scroll = getScrollString({ x: scroll[0], y: scroll[1] });
}
return state;
}

Просмотреть файл

@ -1,44 +0,0 @@
// Bits and pieces copied from toolkit/components/search/tests/xpcshell/head_search.js
var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
var { Task } = ChromeUtils.import("resource://testing-common/Task.jsm");
/**
* Adds test engines and returns a promise resolved when they are installed.
*
* The engines are added in the given order.
*
* @param aItems
* Array of objects with the following properties:
* {
* name: Engine name, used to wait for it to be loaded.
* details: Object containing the parameters of addEngineWithDetails,
* except for the engine name. Alternative to xmlFileName.
* }
*/
var addTestEngines = Task.async(function*(aItems) {
let engines = [];
for (let item of aItems) {
yield new Promise((resolve, reject) => {
Services.obs.addObserver(function obs(subject, topic, data) {
try {
let engine = subject.QueryInterface(Ci.nsISearchEngine);
if (data != "engine-added" || engine.name != item.name) {
return;
}
Services.obs.removeObserver(obs, "browser-search-engine-modified");
engines.push(engine);
resolve();
} catch (ex) {
reject(ex);
}
}, "browser-search-engine-modified");
Services.search.addEngineWithDetails(item.name, item.details);
});
}
return engines;
});

Просмотреть файл

@ -1,10 +0,0 @@
<!DOCTYPE html>
<!-- autoplay blocked UI only shows up in <video>, not <audio> -->
<video id="testAudio" src="audio.ogg" loop></video>
<script type="text/javascript">
var audio = document.getElementById("testAudio");
audio.oncanplay = function() {
audio.oncanplay = null;
audio.play();
};
</script>

Просмотреть файл

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title</title>
<meta name="description" content="This is the article description." />
</head>
<body>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

Просмотреть файл

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title</title>
<meta name="description" content="This is the article description." />
</head>
<body>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

Просмотреть файл

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title</title>
<meta name="description" content="This is the article description." />
</head>
<body>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

Просмотреть файл

@ -1,16 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>Article title</title>
<meta name="description" content="This is the article description." />
</head>
<body>
<header>Site header</header>
<div>
<h1>Article title</h1>
<h2 class="author">by Jane Doe</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
</div>
</body>
</html>

Просмотреть файл

@ -1,20 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>session_formdata_sample.html</title>
</head>
<body>
<input id="txt" />
<iframe id="iframe"></iframe>
<script type="text/javascript">
let isOuter = window == window.top;
if (isOuter) {
let iframe = document.getElementById("iframe");
iframe.setAttribute("src", "https://example.com" + location.pathname);
}
</script>
</body>
</html>

Просмотреть файл

@ -1,15 +0,0 @@
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<URLBase>http://example.com</URLBase>
<device>
<deviceType>urn:dial-multiscreen-org:device:dial:1</deviceType>
<friendlyName>Pretend Device</friendlyName>
<manufacturer>Copy Cat Inc.</manufacturer>
<modelName>Eureka Dongle</modelName>
<UDN>uuid:5ec9ff92-e8b2-4a94-a72c-76b34e6dabb1</UDN>
</device>
</root>

Просмотреть файл

@ -1,103 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1136477
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1136477</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const LOGIN_FIELDS = {
origin: "http://example.org/tests/robocop/robocop_blank_01.html",
formActionOrigin: "",
realmAny: null,
username: "username1",
password: "password1",
usernameField: "",
passwordField: "",
};
const LoginInfo = Components.Constructor("@mozilla.org/login-manager/loginInfo;1", "nsILoginInfo", "init");
function add_login(login) {
let newLogin = new LoginInfo(login.origin,
login.formActionOrigin,
login.realmAny,
login.username,
login.password,
login.usernameField,
login.passwordField);
Services.logins.addLogin(newLogin);
}
add_task(async function test_passwords_list() {
add_login(LOGIN_FIELDS);
// Load about:logins.
let BrowserApp = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
let browser = BrowserApp.addTab("about:logins", { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
await promiseBrowserEvent(browser, "load");
let logins_list_parent = browser.contentDocument.getElementById("logins-list").parentNode;
let waitForLoginToBeAdded = new Promise((resolve) => {
let observer = new MutationObserver((mutations) => {
for (let mutation of mutations) {
for (let node of mutation.addedNodes) {
if (node.id == "logins-list") {
info("Received mutation replacing 'logins-list'");
resolve();
return;
}
}
}
info("Skipping spurious mutation not replacing 'logins-list'");
});
observer.observe(logins_list_parent, {
childList: true,
});
info("Now waiting for mutation to replace 'logins-list'");
});
await waitForLoginToBeAdded;
let logins_list = browser.contentDocument.getElementById("logins-list");
// Test that the (single) entry added in setup is correct.
let origin = logins_list.querySelector(".origin");
is(origin.textContent, LOGIN_FIELDS.origin, "origin is correct");
let username = logins_list.querySelector(".username");
is(username.textContent, LOGIN_FIELDS.username, "username is correct");
// Cleanup: close about:logins, opened in password_setup()
BrowserApp.closeTab(BrowserApp.selectedTab);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1136477">Mozilla Bug 1136477</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testAboutLogins</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,43 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=917942
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 917942</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const {Accounts} = ChromeUtils.import("resource://gre/modules/Accounts.jsm");
add_task(async function() {
let firefoxExists = await Accounts.firefoxAccountsExist();
info("Firefox account exists? " + firefoxExists + "\n");
let anyExists = await Accounts.anySyncAccountsExist();
info("Any accounts exist? " + anyExists + "\n");
is(anyExists, firefoxExists, "sync/firefox account existence consistent with any existence");
// TODO: How can this be cleaned up?
// info("Launching setup.\n");
// Accounts.launchSetup();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=917942">Mozilla Bug 917942</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testAccounts</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,93 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1004825
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1004825</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const TAG = "AndroidLogTest";
const VERBOSE_MESSAGE = "This is a verbose message.";
const DEBUG_MESSAGE = "This is a debug message.";
const INFO_MESSAGE = "This is an info message.";
const WARNING_MESSAGE = "This is a warning message.";
const ERROR_MESSAGE = "This is an error message.";
// Number of bytes we expect to log. This isn't equivalent to the number
// of characters, although the difference is consistent, so we can calculate it
// from the lengths of the messages and tag. We include the length of "Gecko"
// because the module prepends it to the tag.
const VERBOSE_BYTES = "Gecko".length + TAG.length + VERBOSE_MESSAGE.length + 3;
const DEBUG_BYTES = "Gecko".length + TAG.length + DEBUG_MESSAGE.length + 3;
const INFO_BYTES = "Gecko".length + TAG.length + INFO_MESSAGE.length + 3;
const WARNING_BYTES = "Gecko".length + TAG.length + WARNING_MESSAGE.length + 3;
const ERROR_BYTES = "Gecko".length + TAG.length + ERROR_MESSAGE.length + 3;
const {AndroidLog} = ChromeUtils.import("resource://gre/modules/AndroidLog.jsm");
ok(!!AndroidLog, "AndroidLog is defined");
ok("v" in AndroidLog && typeof AndroidLog.v == "function", "v function found");
ok("d" in AndroidLog && typeof AndroidLog.d == "function", "d function found");
ok("i" in AndroidLog && typeof AndroidLog.i == "function", "i function found");
ok("w" in AndroidLog && typeof AndroidLog.w == "function", "w function found");
ok("e" in AndroidLog && typeof AndroidLog.e == "function", "e function found");
// Ensure that the functions don't cause the test process to crash
// (because of some change to the native object being accessed via ctypes)
// and return the right values (the number of bytes logged).
// XXX Ensure that these messages actually make it to the log (bug 1046096).
is(VERBOSE_BYTES, AndroidLog.v(TAG, VERBOSE_MESSAGE), "verbose bytes correct");
is(DEBUG_BYTES, AndroidLog.d(TAG, DEBUG_MESSAGE), "debug bytes correct");
is(INFO_BYTES, AndroidLog.i(TAG, INFO_MESSAGE), "info bytes correct");
is(WARNING_BYTES, AndroidLog.w(TAG, WARNING_MESSAGE), "warning bytes correct");
is(ERROR_BYTES, AndroidLog.e(TAG, ERROR_MESSAGE), "error bytes correct");
// Ensure the functions work when bound with null value for thisArg parameter.
is(VERBOSE_BYTES, AndroidLog.v.bind(null, TAG)(VERBOSE_MESSAGE), "verbose bytes correct with bind");
is(DEBUG_BYTES, AndroidLog.d.bind(null, TAG)(DEBUG_MESSAGE), "debug bytes correct with bind");
is(INFO_BYTES, AndroidLog.i.bind(null, TAG)(INFO_MESSAGE), "info bytes correct with bind");
is(WARNING_BYTES, AndroidLog.w.bind(null, TAG)(WARNING_MESSAGE), "warning bytes correct with bind");
is(ERROR_BYTES, AndroidLog.e.bind(null, TAG)(ERROR_MESSAGE), "error bytes correct with bind");
// Ensure the functions work when the module object is "bound" to a tag.
let Log = AndroidLog.bind(TAG);
is(VERBOSE_BYTES, Log.v(VERBOSE_MESSAGE), "verbose bytes correct after bind");
is(DEBUG_BYTES, Log.d(DEBUG_MESSAGE), "debug bytes correct after bind");
is(INFO_BYTES, Log.i(INFO_MESSAGE), "info bytes correct after bind");
is(WARNING_BYTES, Log.w(WARNING_MESSAGE), "warning bytes correct after bind");
is(ERROR_BYTES, Log.e(ERROR_MESSAGE), "error bytes correct after bind");
// Ensure the functions work when the tag length is greater than the maximum
// tag length.
let tag = "X".repeat(AndroidLog.MAX_TAG_LENGTH + 1);
is(AndroidLog.MAX_TAG_LENGTH + 55, AndroidLog.v(tag, "This is a verbose message with a too-long tag."), "verbose message with too-long tag");
is(AndroidLog.MAX_TAG_LENGTH + 53, AndroidLog.d(tag, "This is a debug message with a too-long tag."), "debug message with too-long tag");
is(AndroidLog.MAX_TAG_LENGTH + 53, AndroidLog.i(tag, "This is an info message with a too-long tag."), "info message with too-long tag");
is(AndroidLog.MAX_TAG_LENGTH + 55, AndroidLog.w(tag, "This is a warning message with a too-long tag."), "warning message with too-long tag");
is(AndroidLog.MAX_TAG_LENGTH + 54, AndroidLog.e(tag, "This is an error message with a too-long tag."), "error message with too-long tag");
// We should also ensure that the module is accessible from a ChromeWorker,
// but there doesn't seem to be a way to load a ChromeWorker from this test.
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1004825">Mozilla Bug 1004825</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testAndroidLog</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,35 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1130872
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1130872</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
var packageName = AppConstants.ANDROID_PACKAGE_NAME;
ok(packageName != "@ANDROID_PACKAGE_NAME@", "package name is not placeholder");
ok(packageName.length > 0, "package name is not empty");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1130872">Mozilla Bug 1130872</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testAppConstants</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,262 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
This test reports Firefox memory use to Perfherder.
Inspired by https://areweslimyet.com/mobile
https://bugzilla.mozilla.org/show_bug.cgi?id=1233220
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1233220</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/MemoryStats.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
var kUrls = [
"http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/tp5/baidu.com/www.baidu.com/s@wd=mozilla.html",
"http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/tp5/twitter.com/twitter.com/ICHCheezburger.html",
"http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/tp5/msn.com/www.msn.com/index.html",
"http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/tp5/163.com/www.163.com/index.html",
"http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/tp5/bbc.co.uk/www.bbc.co.uk/news/index.html",
];
var gTabsOpened = 0;
var gWindow = null;
var gLastTab = null;
var gResults = [];
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
var BrowserApp = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
SimpleTest.waitForExplicitFinish();
SimpleTest.requestLongerTimeout(3); // several long waits and GCs make for a long-running test
SimpleTest.requestCompleteLog(); // so that "PERFHERDER_DATA" can be scraped from the log
function checkpoint(aName) {
var mrm = Cc["@mozilla.org/memory-reporter-manager;1"].getService(Ci.nsIMemoryReporterManager);
gResults.push( { name: aName, resident: mrm.resident } );
info(`${aName} | Resident Memory: ${mrm.resident}`);
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
var upload = env.get("MOZ_UPLOAD_DIR");
if (upload) {
var path = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile);
path.initWithPath(upload);
if (!path.exists()) {
path.create(Ci.nsIFile.DIRECTORY_TYPE, 0o755);
}
var fileName = aName.replace(/ /g, "_").replace(/\W/g, "") + ".json.gz";
path.appendRelativePath(fileName);
var dumper = Cc["@mozilla.org/memory-info-dumper;1"].getService(Ci.nsIMemoryInfoDumper);
dumper.dumpMemoryReportsToNamedFile(path.path, function() {
info("finished dump to " + path.path);
}, null, /* anonymize = */ false);
}
}
var browserListener = {
onOpenWindow(aXulWin) {
var win = aXulWin.docShell.domWindow;
win.addEventListener("UIReady", function(aEvent) {
attachTo(win);
}, {once: true});
},
onCloseWindow(aWindow) {
detachFrom(aWindow);
},
};
function doFullGc(aCallback, aIterations) {
var domWindowUtils = gWindow.windowUtils;
function runSoon(f) {
Services.tm.dispatchToMainThread({ run: f });
}
function cc() {
if (domWindowUtils.cycleCollect) {
domWindowUtils.cycleCollect();
}
Services.obs.notifyObservers(null, "child-cc-request");
}
function minimizeInner() {
// In order of preference: schedulePreciseShrinkingGC, schedulePreciseGC
// garbageCollect
if (++j <= aIterations) {
var schedGC = Cu.schedulePreciseShrinkingGC;
if (!schedGC) {
schedGC = Cu.schedulePreciseGC;
}
Services.obs.notifyObservers(null, "child-gc-request");
if (schedGC) {
schedGC.call(Cu, { callback() {
runSoon(function() { cc(); runSoon(minimizeInner); });
} });
} else {
if (domWindowUtils.garbageCollect) {
domWindowUtils.garbageCollect();
}
runSoon(function() { cc(); runSoon(minimizeInner); });
}
} else {
runSoon(aCallback);
}
}
var j = 0;
minimizeInner();
}
function attachTo(aWindow) {
if (gWindow != null) {
info("attempting to attach to a second window [" + aWindow + "] while already attached to one window [" + gWindow + "]");
return;
}
gWindow = aWindow;
setTimeout(startTest, 0);
}
function detachFrom(aWindow) {
if (gWindow == aWindow) {
gWindow = null;
}
}
function startup() {
var enumerator = Services.wm.getEnumerator("navigator:browser");
while (enumerator.hasMoreElements()) {
// potential race condition here - the window may not be ready yet at
// this point, so ideally we would test for that. but i can't find a
// property that reflects whether or not UIReady has been fired, so
// for now just assume the window is ready
attachTo(enumerator.getNext());
}
Services.wm.addListener(browserListener);
}
function startTest() {
checkpoint("Fresh start");
setTimeout(settle, 30000);
}
function settle() {
checkpoint("Fresh start [+30s]");
openTab();
}
function openTab() {
var urlIndex = gTabsOpened++;
if (urlIndex >= kUrls.length) {
checkpoint("After tabs");
setTimeout(postOpening, 30000);
return;
}
info("opening tab with url [" + kUrls[urlIndex] + "]");
gLastTab = BrowserApp.addTab(kUrls[urlIndex], { selected: true });
setTimeout(waitForTab, 10000);
}
function waitForTab() {
if (gLastTab.browser.contentDocument.readyState === "complete") {
gLastTab = null;
openTab();
} else {
setTimeout(waitForTab, 10000);
}
}
function postOpening() {
checkpoint("After tabs [+30s]");
doFullGc(() => closeTabs());
}
function closeTabs() {
checkpoint("After tabs [+30s, forced GC]");
var tabCount = BrowserApp.tabs.length;
for (var i = 1; i < tabCount; i++) {
BrowserApp.tabs[i].browser.addEventListener("TabClose", () => {
tabCount--;
dump("tab count dropped to [" + tabCount + "]");
if (tabCount == 1) {
setTimeout(tabsClosed, 0);
}
}, { once: true });
BrowserApp.closeTab(BrowserApp.tabs[i]);
}
}
function tabsClosed() {
checkpoint("Tabs closed");
setTimeout(postClosing, 30000);
}
function postClosing() {
checkpoint("Tabs closed [+30s]");
doFullGc(() => {
checkpoint("Tabs closed [+30s, forced GC]");
finalReport();
ok(true, "memory logging complete -- view results in Perfherder");
SimpleTest.finish();
});
}
function geomean(aProperty) {
// https://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms
var logsum = 0;
var i;
for (i = 0; i < gResults.length; i++) {
var result = gResults[i];
logsum += Math.log(result[aProperty]);
}
return Math.round(Math.exp(logsum / gResults.length));
}
function finalReport() {
var i;
var perfherder = "PERFHERDER_DATA: ";
perfherder += "{\"framework\": {\"name\": \"awsy\"}, ";
perfherder += "\"suites\": [";
perfherder += "{\"name\": \"Resident Memory\", ";
perfherder += "\"subtests\": [";
for (i = 0; i < gResults.length; i++) {
var result = gResults[i];
if (i > 0) {
perfherder += ", ";
}
perfherder += `{\"name\": \"${result.name}\", \"value\": ${result.resident}}`;
}
perfherder += "], "; // end subtests
perfherder += "\"value\": " + geomean("resident");
perfherder += "}"; // end Resident Memory suite
perfherder += "]"; // end suites
perfherder += "}"; // end PERFHERDER_DATA
info(perfherder);
}
startup();
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1233220">Mozilla Bug 1233220</a>
<br>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,51 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1010750
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1010750</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
"use strict";
const DEBUGGER_USB_ENABLED = "devtools.remote.usb.enabled";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { require } =
ChromeUtils.import("resource://devtools/shared/Loader.jsm");
const { DevToolsServer } = require("devtools/server/devtools-server");
let win = Services.wm.getMostRecentWindow("navigator:browser");
win.RemoteDebugger.init(win);
SimpleTest.registerCleanupFunction(function() {
Services.prefs.clearUserPref(DEBUGGER_USB_ENABLED);
});
// Enable the debugger via the pref it listens for
Services.prefs.setBoolPref(DEBUGGER_USB_ENABLED, true);
ok(DevToolsServer.initialized, "initialized");
is(DevToolsServer.listeningSockets, 1, "1 listening socket");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1010750">Mozilla Bug 1010750</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testDevToolsServer</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,108 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1157319
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1157319</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
// Load a custom sjs script that echos our "User-Agent" header back at us
const TestURI = Services.io.newURI("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/desktopmode_user_agent.sjs");
add_task(async function test_desktopmode() {
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
// Add a new 'mobile mode' tab with our test page
let mobileTab = BrowserApp.addTab(TestURI.spec, { selected: true, parentId: BrowserApp.selectedTab.id });
let mobileBrowser = mobileTab.browser;
await promiseBrowserEvent(mobileBrowser, "load");
// Some debugging
info("mobile: " + mobileBrowser.contentWindow.navigator.userAgent);
info("mobile: " + mobileBrowser.contentDocument.body.innerHTML);
// Check the server UA and the navigator UA for 'mobile'
// We only check for 'Android' because we don't know the version or if it's phone or tablet
ok(mobileBrowser.contentWindow.navigator.userAgent.includes("Android"), "window.navigator.userAgent has 'Android' in it");
ok(mobileBrowser.contentDocument.body.innerHTML.includes("Android"), "HTTP header 'User-Agent' has 'Android' in it");
mobileTab.reloadWithMode(true);
await promiseBrowserEvent(mobileBrowser, "load");
// Some debugging
info("desktop: " + mobileBrowser.contentWindow.navigator.userAgent);
info("desktop: " + mobileBrowser.contentDocument.body.innerHTML);
// Check the server UA and the navigator UA for 'desktop'
ok(mobileBrowser.contentWindow.navigator.userAgent.includes("Linux x86_64"), "window.navigator.userAgent has 'Linux' in it");
ok(mobileBrowser.contentDocument.body.innerHTML.includes("Linux x86_64"), "HTTP header 'User-Agent' has 'Linux' in it");
BrowserApp.closeTab(mobileTab);
// Add a new 'desktop mode' tab with our test page
let desktopTab = BrowserApp.addTab(TestURI.spec, { selected: true, parentId: BrowserApp.selectedTab.id, desktopMode: true });
let desktopBrowser = desktopTab.browser;
await promiseBrowserEvent(desktopBrowser, "load");
// Some debugging
info("desktop: " + desktopBrowser.contentWindow.navigator.userAgent);
info("desktop: " + desktopBrowser.contentDocument.body.innerHTML);
// Check the server UA and the navigator UA for 'desktop'
ok(desktopBrowser.contentWindow.navigator.userAgent.includes("Linux x86_64"), "window.navigator.userAgent has 'Linux' in it");
ok(desktopBrowser.contentDocument.body.innerHTML.includes("Linux x86_64"), "HTTP header 'User-Agent' has 'Linux' in it");
// should reload, and keep desktop mode
desktopTab.reloadWithMode(true);
await promiseBrowserEvent(desktopBrowser, "load");
// Some debugging
info("desktop: " + desktopBrowser.contentWindow.navigator.userAgent);
info("desktop: " + desktopBrowser.contentDocument.body.innerHTML);
// Check the server UA and the navigator UA for 'desktop'
ok(desktopBrowser.contentWindow.navigator.userAgent.includes("Linux x86_64"), "window.navigator.userAgent has 'Linux' in it");
ok(desktopBrowser.contentDocument.body.innerHTML.includes("Linux x86_64"), "HTTP header 'User-Agent' has 'Linux' in it");
// Now reload in mobile mode
desktopTab.reloadWithMode(false);
await promiseBrowserEvent(desktopBrowser, "load");
// Some debugging
info("mobile: " + desktopBrowser.contentWindow.navigator.userAgent);
info("mobile: " + desktopBrowser.contentDocument.body.innerHTML);
// Check the server UA and the navigator UA for 'mobile'
// We only check for 'Android' because we don't know the version or if it's phone or tablet
ok(desktopBrowser.contentWindow.navigator.userAgent.includes("Android"), "window.navigator.userAgent has 'Android' in it");
ok(desktopBrowser.contentDocument.body.innerHTML.includes("Android"), "HTTP header 'User-Agent' has 'Android' in it");
BrowserApp.closeTab(desktopTab);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1157319">Mozilla Bug 1157319</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testDesktopUseragent</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,73 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=861164
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 861164</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
SimpleTest.waitForExplicitFinish();
function search_observer(aSubject, aTopic, aData) {
let engine = aSubject.QueryInterface(Ci.nsISearchEngine);
info("Observer: " + aData + " for " + engine.name);
if (aData != "engine-added")
return;
if (engine.name != "Test search engine")
return;
function check_submission(aExpected, aSearchTerm, aType) {
is(engine.getSubmission(aSearchTerm, aType).uri.spec, "http://example.com/search" + aExpected, "submission matches");
}
// Force the type and check for the expected URL
check_submission("?q=foo", "foo", "text/html");
check_submission("/tablet?q=foo", "foo", "application/x-moz-tabletsearch");
check_submission("/phone?q=foo", "foo", "application/x-moz-phonesearch");
// Let the service pick the appropriate type based on the device
// and check for expected URL
let sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
if (sysInfo.get("tablet")) {
info("Device: tablet");
check_submission("/tablet?q=foo", "foo", null);
} else {
info("Device: phone");
check_submission("/phone?q=foo", "foo", null);
}
SimpleTest.finish();
}
SimpleTest.registerCleanupFunction(function() {
Services.obs.removeObserver(search_observer, "browser-search-engine-modified");
});
Services.obs.addObserver(search_observer, "browser-search-engine-modified");
info("Loading search engine");
Services.search.addEngine("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/devicesearch.xml",
null, false);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=861164">Mozilla Bug 861164</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testDeviceSearchEngine</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,102 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1214366
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1214366</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {EventDispatcher} = ChromeUtils.import("resource://gre/modules/Messaging.jsm");
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
function get_last_visited(prePath) {
return EventDispatcher.instance.sendRequestForResult({
type: "History:GetPrePathLastVisitedTimeMilliseconds",
prePath,
});
}
var browser = BrowserApp.addTab("about:blank").browser;
// It's useful to see *all* "link-visited" events in the face of intermittent failures.
let observe = function(subject, topic, data) {
var uri = subject.QueryInterface(Ci.nsIURI);
info("Witnessed " + topic + " notification from Gecko with URI " + uri.spec);
};
Services.obs.addObserver(observe, "link-visited");
SimpleTest.registerCleanupFunction(function cleanup() {
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
Services.obs.removeObserver(observe, "link-visited");
});
// N.b.: the write to the Fennec DB happens before the Gecko notification
// is fired. This is delicate.
function add_history_visit(url) {
browser.loadURI(url);
return promiseLinkVisit(url);
}
// Be aware that some paths under mochi.test and example.org redirect. The
// blank robocop pages appear to not. Redirects can impact this test, since
// they can write to the history database.
// The apparent mis-ordering here just uses simpler pages (01 and 03) for the
// real test, and a more complex page (02) for a final delay. See comment below.
const url1 = "http://example.org/tests/robocop/robocop_blank_01.html";
const url2 = "http://example.org/tests/robocop/robocop_blank_03.html";
const url3 = "http://example.org/tests/robocop/robocop_blank_02.html";
add_task(async function test_get_last_visited() {
var v = await get_last_visited("https://random.com/");
is(v, 0, `Last visited timestamp is 0 for unknown prePath: ${v}`);
let prePath = Services.io.newURI(url1).prePath + "/";
is(prePath, Services.io.newURI(url2).prePath + "/", "url1 and url2 have the same prePath");
let t0 = Date.now();
await add_history_visit(url1);
v = await get_last_visited(prePath);
let t1 = Date.now();
ok(t0 <= v, `Last visited timestamp is after visit: ${t0} <= ${v}.`);
ok(v <= t1, `Last visited timestamp is before present ${v} <= ${t1}.`);
let t2 = Date.now();
await add_history_visit(url1);
v = await get_last_visited(prePath);
ok(t2 <= v, `Last visited timestamp is updated after visit: ${t2} <= ${v}`);
let t3 = Date.now();
await add_history_visit(url2);
v = await get_last_visited(prePath);
ok(t3 <= v, `Last visited timestamp is updated after visit to URL with same prePath: ${t3} <= ${v}`);
// This whole system is flaky, so we wait for an unrelated visit, so that we
// can witness "link-visited" events a little after the test completes
// while debugging.
await add_history_visit(url3);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1214366">Mozilla Bug 1214366</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,55 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1099088
-->
<head>
<meta charset="utf-8">
<title>Test for getIdentityMode</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let IdentityHandler = chromeWin.IdentityHandler;
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("about:firefox")) == IdentityHandler.IDENTITY_MODE_CHROMEUI,
"'about:firefox' is a verified internal page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("about:config")) == IdentityHandler.IDENTITY_MODE_CHROMEUI,
"'about:config' is a verified internal page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("about:accounts")) == IdentityHandler.IDENTITY_MODE_CHROMEUI,
"'about:accounts is a verified internal page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("about:addonss")) == IdentityHandler.IDENTITY_MODE_UNKNOWN,
"'about:addonss is not a verified internal page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("about:accountss")) == IdentityHandler.IDENTITY_MODE_UNKNOWN,
"'about:accountss is not a verified internal page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("about:accounts?action=signup")) == IdentityHandler.IDENTITY_MODE_CHROMEUI,
"'about:accounts?action=signup is a verified internal page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("about:evil_extension_page")) == IdentityHandler.IDENTITY_MODE_UNKNOWN,
"'about:evil_extension_page' is not a verified internal page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("http://mozilla.com")) == IdentityHandler.IDENTITY_MODE_UNKNOWN,
"http://mozilla.com is an unknown page");
ok(IdentityHandler.getIdentityMode(0, Services.io.newURI("https://mozilla.com")) == IdentityHandler.IDENTITY_MODE_UNKNOWN,
"https://mozilla.com over an insecure connection is an unknown page");
ok(IdentityHandler.getIdentityMode(Ci.nsIWebProgressListener.STATE_IS_SECURE, Services.io.newURI("https://mozilla.com")) == IdentityHandler.IDENTITY_MODE_IDENTIFIED,
"https://mozilla.com over a secure connection is a verified page");
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1099088">Mozilla Bug 1099088</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,63 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1154504
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1154504</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head_search.js"></script>
<script type="application/javascript">
Services.prefs.clearUserPref("browser.migration.version");
Services.prefs.setBoolPref("nglayout.debug.paint_flashing", true);
addTestEngines([
{ name: "bacon",
details: {
alias: "bacon",
description: "Search Bacon",
method: "GET",
template: "http://www.bacon.moz/?search={searchTerms}",
},
},
]).then(engines => {
Services.prefs.setCharPref("browser.search.defaultenginename", engines[0].name);
let BrowserApp = Services.wm.getMostRecentWindow("navigator:browser").BrowserApp;
// This performs the serach migration asynchronously, but the search service is already initialized
// by `addTestEngines`, so we don't need to worry about waiting before checking the new engine.
BrowserApp._migrateUI();
// Check that migration version increased.
is(Services.prefs.getIntPref("browser.migration.version"), 4, "found expected version");
// Check that user pref value was reset.
is(Services.prefs.prefHasUserValue("nglayout.debug.paint_flashing"), false, "found expected user value");
function searchObserver(s, t, d) {
Services.obs.removeObserver(searchObserver, "default-search-engine-migrated");
is(Services.search.defaultEngine.name, engines[0].name, "found expected default search engine");
}
Services.obs.addObserver(searchObserver, "default-search-engine-migrated");
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1154504">Mozilla Bug 1154504</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testMigrateUI</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,71 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>MozAutoplayMediaBlocked test</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
/**
* This test is used to check whether 'MozAutoplayMediaBlocked' would be fired
* correctly when the media was blocked.
*/
"use strict";
/* globals InspectorUtils */
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
let gChromeWin;
let gBrowserApp;
const URL = "http://example.org/chrome/mobile/android/tests/browser/chrome/media_playback.html";
// Waiting for a tab to load or restore can be slow on the emulator.
SimpleTest.requestLongerTimeout(2);
(function setup_testing_env() {
gChromeWin = Services.wm.getMostRecentWindow("navigator:browser");
gBrowserApp = gChromeWin.BrowserApp;
Services.prefs.setIntPref("media.autoplay.default", 1 /* BLOCKED */);
Services.prefs.setBoolPref("media.autoplay.enabled.user-gestures-needed", true);
})();
add_task(async function test_UAWidgetMozAutoplayMediaBlocked() {
info("- open a new tab -");
let tab = gBrowserApp.addTab(URL);
let browser = tab.browser;
const mediaBlockedPromise = promiseTabEvent(browser, "MozAutoplayMediaBlocked");
info("- wait for loading tab's content -");
await promiseBrowserEvent(browser, "load");
info("- wait for 'MozAutoplayMediaBlocked' event -");
await mediaBlockedPromise;
ok(true, "got `MozAutoplayMediaBlocked` event");
let doc = browser.contentWindow.document;
let video = doc.getElementById("testAudio");
let button = video.openOrClosedShadowRoot.getElementById("clickToPlay");
ok(!button.hidden, "Click to play button is not hidden");
info("- remove tab -");
gBrowserApp.closeTab(tab);
});
</script>
</head>
<body>
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,40 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=895775
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 895775</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
"use strict";
ChromeUtils.import("resource://gre/modules/Services.jsm");
// Let's exercise the interface. Even if the network is not up, we can make sure nothing blows up.
let network = Cc["@mozilla.org/network/network-link-service;1"].getService(Ci.nsINetworkLinkService);
if (network.isLinkUp) {
ok(network.linkType != Ci.nsINetworkLinkService.LINK_TYPE_UNKNOWN, "LinkType is not UNKNOWN");
} else {
ok(network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_UNKNOWN, "LinkType is UNKNOWN");
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=895775">Mozilla Bug 895775</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testNetworkManager</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,107 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1089190
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1089190</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
// Provide a helper to yield until we are sure the offline state has changed
function promiseOffline(isOffline) {
return new Promise((resolve, reject) => {
function observe(subject, topic, data) {
info("Received topic: " + topic);
Services.obs.removeObserver(observe, "network:offline-status-changed");
resolve();
}
Services.obs.addObserver(observe, "network:offline-status-changed");
Services.io.offline = isOffline;
});
}
// The chrome window
let chromeWin;
// Track the <browser> where the tests are happening
let browser;
// The proxy setting
let proxyPrefValue;
const kUniqueURI = Services.io.newURI("http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_controls.html");
add_task(async function test_offline() {
// Tests always connect to localhost, and per bug 87717, localhost is now
// reachable in offline mode. To avoid this, disable any proxy.
proxyPrefValue = Services.prefs.getIntPref("network.proxy.type");
Services.prefs.setIntPref("network.proxy.type", 0);
// Clear network cache.
Services.cache2.clear();
chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
// Add a new tab with a blank page so we can better control the real page load and the offline state
browser = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
SimpleTest.registerCleanupFunction(function() {
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
Services.prefs.setIntPref("network.proxy.type", proxyPrefValue);
Services.io.offline = false;
});
// Go offline, expecting the error page.
await promiseOffline(true);
// Load our test web page
browser.loadURI(kUniqueURI.spec, null, null);
await promiseBrowserEvent(browser, "DOMContentLoaded");
// This is an error page.
is(browser.contentDocument.documentURI.substring(0, 27), "about:neterror?e=netOffline", "Document URI is the error page.");
// But location bar should show the original request.
is(browser.contentWindow.location.href, kUniqueURI.spec, "Docshell URI is the original URI.");
Services.prefs.setIntPref("network.proxy.type", proxyPrefValue);
// Go online and try to load the page again
await promiseOffline(false);
ok(browser.contentDocument.getElementById("errorTryAgain"), "The error page has got a #errorTryAgain element");
// Click "Try Again" button to start the page load
browser.contentDocument.getElementById("errorTryAgain").click();
await promiseBrowserEvent(browser, "DOMContentLoaded");
// This is not an error page.
is(browser.contentDocument.documentURI, kUniqueURI.spec, "Document URI is not the offline-error page, but the original URI.");
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1089190">Mozilla Bug 1089190</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testOfflinePage</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,53 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1158885
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1158885</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
add_task(async function test_reader_view_visibility() {
let gWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = gWin.BrowserApp;
let url = "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/basic_article.html";
let browser = BrowserApp.addTab("about:reader?url=" + url).browser;
SimpleTest.registerCleanupFunction(function() {
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
});
await promiseBrowserEvent(browser, "load");
let doc = browser.contentDocument;
let title = doc.querySelector(".reader-title");
// We need to wait for reader content to appear because AboutReader.jsm
// asynchronously fetches the content after about:reader loads.
await promiseNotification("AboutReader:Ready");
is(title.textContent, "Article title", "found expected content");
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1158885">Mozilla Bug 1158885</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testReaderView</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,65 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1549732
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1549732</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
// The chrome window
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
// Track the tabs where the tests are happening
let tabTest;
function cleanupTabs() {
if (tabTest) {
BrowserApp.closeTab(tabTest);
tabTest = null;
}
}
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
const kTestPage = "https://example.com";
const kReferrer = "https://foo.org/";
add_task(async function test_referrer() {
tabTest = BrowserApp.addTab(kTestPage, { referrerURI: kReferrer,
parentId: BrowserApp.selectedTab.id,
selected: true});
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
// Check that basic_article is now selected
is(BrowserApp.selectedBrowser, tabTest.browser, "Target tab is selected after being added.");
is(tabTest.browser.contentDocument.referrer, kReferrer, "Target tab has correct referrer");
cleanupTabs();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1549732">Mozilla Bug 1549732</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,76 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=948465
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 948465</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const {Promise} = ChromeUtils.import("resource://gre/modules/Promise.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {NetUtil} = ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
function readChannel(url) {
let deferred = Promise.defer();
let channel = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
channel.contentType = "text/plain";
NetUtil.asyncFetch(channel, function(inputStream, status) {
if (!Components.isSuccessCode(status)) {
deferred.reject();
return;
}
let content = NetUtil.readInputStreamToString(inputStream, inputStream.available());
deferred.resolve(content);
});
return deferred.promise;
}
add_task(async function() {
let protocolHandler = Services.io
.getProtocolHandler("resource")
.QueryInterface(Ci.nsIResProtocolHandler);
ok(protocolHandler.hasSubstitution("app"), "Should have app substitution");
ok(protocolHandler.hasSubstitution("gre"), "Should have gre substitution");
ok(protocolHandler.hasSubstitution("android"), "Should have android substitution");
let uri = Services.io.newURI("resource://android/package-name.txt");
ok(uri instanceof Ci.nsIJARURI);
ok(uri.JARFile instanceof Ci.nsIFileURL);
is(uri.JAREntry, "package-name.txt");
// This can be any file that we know exists in the root of every APK.
let packageName = await readChannel("resource://android/package-name.txt");
info(packageName);
// It's difficult to fish ANDROID_PACKAGE_NAME from JavaScript, so we test the
// following weaker condition.
let expectedPrefix = "org.mozilla.";
is(packageName.substring(0, expectedPrefix.length), expectedPrefix);
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=948465">Mozilla Bug 948465</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testResourceSubstitutions</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,51 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1042715
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1042715</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
function test_isUserRestricted() {
// Make sure the parental controls service is available
ok("@mozilla.org/parental-controls-service;1" in Cc);
let pc = Cc["@mozilla.org/parental-controls-service;1"].createInstance(Ci.nsIParentalControlsService);
// In an admin profile, like the tests: enabled = false
// In a restricted profile: enabled = true
ok(!pc.parentalControlsEnabled);
ok(!pc.blockFileDownloadsEnabled);
ok(pc.isAllowed(Ci.nsIParentalControlsService.DOWNLOAD));
ok(pc.isAllowed(Ci.nsIParentalControlsService.INSTALL_EXTENSION));
ok(pc.isAllowed(Ci.nsIParentalControlsService.INSTALL_APP));
ok(pc.isAllowed(Ci.nsIParentalControlsService.BROWSE));
ok(pc.isAllowed(Ci.nsIParentalControlsService.SHARE));
ok(pc.isAllowed(Ci.nsIParentalControlsService.BOOKMARK));
ok(pc.isAllowed(Ci.nsIParentalControlsService.INSTALL_EXTENSION));
ok(pc.isAllowed(Ci.nsIParentalControlsService.MODIFY_ACCOUNTS));
}
test_isUserRestricted();
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1042715">Mozilla Bug 1042715</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testRestrictedProfiles</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,120 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1216047
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1216047</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
// The chrome window
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
// Track the tabs where the tests are happening
let tabBlank;
let tabTest;
function cleanupTabs() {
if (tabBlank) {
BrowserApp.closeTab(tabBlank);
tabBlank = null;
}
if (tabTest) {
BrowserApp.closeTab(tabTest);
tabTest = null;
}
}
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
const kTestPage = "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/basic_article.html";
add_task(async function test_selectOrAdd() {
// Add a new tab with a blank page
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
// Now, let's force the target tab to be added
tabTest = BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
// Check that basic_article is now selected
is(BrowserApp.selectedBrowser, tabTest.browser, "Target tab is selected after being added.");
// Switch back to about:blank
BrowserApp.selectTab(tabBlank);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
// Check that about:blank is selected
is(BrowserApp.selectedTab, tabBlank, "about:blank is selected.");
// Use selectOrAddTab to select the existing tab
BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseTabEvent(BrowserApp.deck, "TabSelect");
// Check that basic_article is now selected
is(BrowserApp.selectedTab, tabTest, "Target tab is selected.");
// Switch back to about:blank
BrowserApp.selectTab(tabBlank);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
// Check that about:blank is selected
is(BrowserApp.selectedTab, tabBlank, "about:blank is selected.");
// Use selectOrAddTab to select the existing tab using the startsWith flag
BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id }, { startsWith: kTestPage });
await promiseTabEvent(BrowserApp.deck, "TabSelect");
// Check that basic_article is now selected
is(BrowserApp.selectedTab, tabTest, "Target tab is selected.");
// Switch back to about:blank
BrowserApp.selectTab(tabBlank);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
// Check that about:blank is selected
is(BrowserApp.selectedTab, tabBlank, "about:blank is selected.");
// Zombify basic_article
tabTest.zombify();
// Check that basic_article is actually zombified
ok(tabTest.browser.__SS_restore, "Target tab is set for delay loading.");
is(tabTest.browser.currentURI.spec, "about:blank", "Target tab is zombified.");
// Use selectOrAddTab to select the existing tab
BrowserApp.selectOrAddTab(kTestPage, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseTabEvent(BrowserApp.deck, "TabSelect");
// Check that basic_article is now selected
is(BrowserApp.selectedTab, tabTest, "Target tab is selected.");
cleanupTabs();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1216047">Mozilla Bug 1216047</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,209 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1343603
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1343603</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
/** Test for Bug 1343603 **/
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
// The chrome window
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
// Track the tabs where the tests are happening
let tabBlank;
let tabTest;
function cleanupTabs() {
if (tabBlank) {
BrowserApp.closeTab(tabBlank);
tabBlank = null;
}
if (tabTest) {
BrowserApp.closeTab(tabTest);
tabTest = null;
}
}
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
// Session store load state constants
const STATE_STOPPED = 0;
const STATE_RUNNING = 1;
const STATE_QUITTING = -1;
const STATE_QUITTING_FLUSHED = -2;
function createFileIfNotExists(file) {
if (!file.exists()) {
file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o666);
}
}
// URLs for testing
const url1 = "http://example.org/chrome/mobile/android/tests/browser/chrome/basic_article_mobile.html";
const url2 = "http://example.org/chrome/mobile/android/tests/browser/chrome/basic_article.html";
const url3 = "data:text/html;charset=utf-8,It%20was%20a%20dark%20and%20stormy%20night.";
// Outside of shutting down, clearing history will trigger an async delete
// of the session files. To avoid any interference from that here, this test
// therefore has to run first.
add_task(async function test_sessionStoreClearFiles() {
// Temporarily set the session store to shutdown mode to test the
// synchronous deletion code path.
// This also means that nothing gets written to disk until explicitly
// flushed, so we can test that all files have been deleted and don't
// have to worry about them already having been recreated before we get
// around checking on them.
ss.setLoadState(STATE_QUITTING);
let sessionFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
let sessionFileBackup = sessionFile.clone();
let sessionFilePrevious = sessionFile.clone();
let sessionFileTemp = sessionFile.clone();
sessionFile.append("sessionstore.js"); // The main session store save file.
sessionFileBackup.append("sessionstore.bak"); // A backup copy to guard against interrupted writes.
sessionFilePrevious.append("sessionstore.old"); // The previous session's file, used for what used to be the "Tabs from last time".
sessionFileTemp.append(sessionFile.leafName + ".tmp"); // Temporary file for writing changes to disk.
createFileIfNotExists(sessionFile);
createFileIfNotExists(sessionFileBackup);
createFileIfNotExists(sessionFilePrevious);
createFileIfNotExists(sessionFileTemp);
ok(sessionFile.exists(), "session file exists");
ok(sessionFileBackup.exists(), "backup file exists");
ok(sessionFilePrevious.exists(), "last session file exists");
ok(sessionFileTemp.exists(), "temp file exists");
// Clear browsing history
let sanitize = { history: true };
let notification = promiseNotification("sessionstore-state-purge-complete");
BrowserApp.sanitize(sanitize);
await notification;
ok(!sessionFile.exists(), "session file was deleted");
ok(!sessionFileBackup.exists(), "backup file was deleted");
ok(!sessionFilePrevious.exists(), "last session file was deleted");
ok(!sessionFileTemp.exists(), "temp file was deleted");
// Revert back to normal
ss.setLoadState(STATE_RUNNING);
});
add_task(async function test_sessionStoreClearTabHistory() {
// Add a new tab with some content
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
// Navigate to create some history
tabTest.browser.loadURI(url2);
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
tabTest.browser.loadURI(url3);
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
is(tabTest.browser.canGoBack, true, "can go back");
tabTest.browser.goBack();
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
// Check that the session store has recorded this history
let data = tabTest.browser.__SS_data;
is(data.entries.length, 3, "the session store has captured 3 history entries");
is(data.index, 2, "history index is correct");
is(data.entries[0].url, url1, "URL of first history entry is correct");
// Clear browsing history
let sanitize = { history: true };
let notification = promiseNotification("sessionstore-state-purge-complete");
BrowserApp.sanitize(sanitize);
await notification;
// Only the current session history entry should remain
data = tabTest.browser.__SS_data;
is(data.entries.length, 1, "the session store has cleared all previous entries");
is(data.index, 1, "history index is correct");
is(data.entries[0].url, url2, "URL of first history entry is correct after data clearing");
cleanupTabs();
});
add_task(async function test_sessionStoreClearZombieTabHistory() {
// Add a new tab with some content
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
// Navigate to create some history
tabTest.browser.loadURI(url2);
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
tabTest.browser.loadURI(url3);
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
is(tabTest.browser.canGoBack, true, "can go back");
tabTest.browser.goBack();
await promiseBrowserEvent(tabTest.browser, "DOMTitleChanged");
// Check that the session store has recorded this history
let data = tabTest.browser.__SS_data;
is(data.entries.length, 3, "the session store has captured 3 history entries");
is(data.index, 2, "history index is correct");
is(data.entries[0].url, url1, "URL of first history entry is correct");
// Open a new tab and zombify the original one
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
// Zombify the backgrounded test tab
tabTest.zombify();
// Check that the test tab is actually zombified
ok(tabTest.browser.__SS_restore, "Test tab is set for delay loading.");
is(tabTest.browser.currentURI.spec, "about:blank", "Test tab is zombified.");
// Clear browsing history
let sanitize = { history: true };
let notification = promiseNotification("sessionstore-state-purge-complete");
BrowserApp.sanitize(sanitize);
await notification;
// Only the current session history entry should remain
data = tabTest.browser.__SS_data;
is(data.entries.length, 1, "the session store has cleared all previous entries");
is(data.index, 1, "history index is correct");
is(data.entries[0].url, url2, "URL of first history entry is correct after data clearing");
cleanupTabs();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1343603">Mozilla Bug 1343603</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,279 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=671993
https://bugzilla.mozilla.org/show_bug.cgi?id=1261225
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bugs 671993, 1261225</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {Task} = ChromeUtils.import("resource://testing-common/Task.jsm");
let gChromeWin;
let gBrowserApp;
// Waiting for a tab to load or restore can be slow on the emulator.
SimpleTest.requestLongerTimeout(2);
setup_browser();
function queryElement(contentWindow, data) {
let frame = contentWindow;
if (data.hasOwnProperty("frame")) {
frame = contentWindow.frames[data.frame];
}
let doc = frame.document;
if (data.hasOwnProperty("id")) {
return doc.getElementById(data.id);
}
if (data.hasOwnProperty("selector")) {
return doc.querySelector(data.selector);
}
if (data.hasOwnProperty("xpath")) {
let xptype = XPathResult.FIRST_ORDERED_NODE_TYPE;
return doc.evaluate(data.xpath, doc, null, xptype, null).singleNodeValue;
}
throw new Error("couldn't query element");
}
function dispatchUIEvent(input, type) {
let event = input.ownerDocument.createEvent("UIEvents");
event.initUIEvent(type, true, true, input.ownerGlobal, 0);
input.dispatchEvent(event);
}
function setInputValue(browser, data) {
let input = queryElement(browser.contentWindow, data);
input.value = data.value;
dispatchUIEvent(input, "input");
}
function getInputValue(browser, data) {
let input = queryElement(browser.contentWindow, data);
return input.value;
}
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
function setup_browser() {
gChromeWin = Services.wm.getMostRecentWindow("navigator:browser");
gBrowserApp = gChromeWin.BrowserApp;
}
/**
* This test ensures that form data collection respects the privacy level as
* set by the user.
*/
add_task(async function test_formdata() {
const URL = "http://example.org/chrome/mobile/android/tests/browser/chrome/session_formdata_sample.html";
const OUTER_VALUE = "browser_formdata_" + Math.random();
const INNER_VALUE = "browser_formdata_" + Math.random();
// Creates a tab, loads a page with some form fields,
// modifies their values and closes the tab.
function createAndRemoveTab() {
return Task.spawn(function* () {
// Create a new tab.
let tab = gBrowserApp.addTab(URL);
let browser = tab.browser;
yield promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
// Modify form data.
setInputValue(browser, {id: "txt", value: OUTER_VALUE});
setInputValue(browser, {id: "txt", value: INNER_VALUE, frame: 0});
// Note: event must occur even if no info is captured due to privacy
yield promiseTabEvent(browser, "SSTabInputCaptured");
// Remove the tab.
gBrowserApp.closeTab(tab);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createAndRemoveTab();
let state = ss.getClosedTabs(gChromeWin);
let [{formdata}] = state;
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
is(formdata.children[0].id.txt, INNER_VALUE, "inner value is correct");
// Disable saving data for encrypted sites.
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 1);
await createAndRemoveTab();
state = ss.getClosedTabs(gChromeWin);
[{formdata}] = state;
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
ok(!formdata.children, "inner value was *not* stored");
// Disable saving data for any site.
Services.prefs.setIntPref("browser.sessionstore.privacy_level", 2);
await createAndRemoveTab();
state = ss.getClosedTabs(gChromeWin);
[{formdata}] = state;
ok(!formdata, "form data has *not* been stored");
// Restore the default privacy level.
Services.prefs.clearUserPref("browser.sessionstore.privacy_level");
});
/**
* This test ensures that form data collection restores correctly.
*/
add_task(async function test_formdata2() {
const URL = "http://example.org/chrome/mobile/android/tests/browser/chrome/session_formdata_sample.html";
const OUTER_VALUE = "browser_formdata_" + Math.random();
const INNER_VALUE = "browser_formdata_" + Math.random();
// Creates a tab, loads a page with some form fields,
// modifies their values and closes the tab.
function createAndRemoveTab() {
return Task.spawn(function* () {
// Create a new tab.
let tab = gBrowserApp.addTab(URL);
let browser = tab.browser;
yield promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
// Modify form data.
setInputValue(browser, {id: "txt", value: OUTER_VALUE});
setInputValue(browser, {id: "txt", value: INNER_VALUE, frame: 0});
yield promiseTabEvent(browser, "SSTabInputCaptured");
// Remove the tab.
gBrowserApp.closeTab(tab);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createAndRemoveTab();
let state = ss.getClosedTabs(gChromeWin);
let [{formdata}] = state;
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
is(formdata.children[0].id.txt, INNER_VALUE, "inner value is correct");
// Restore the closed tab.
let closedTabData = ss.getClosedTabs(gChromeWin)[0];
let browser = ss.undoCloseTab(gChromeWin, closedTabData);
await promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
// Check the form data.
is(getInputValue(browser, {id: "txt"}), OUTER_VALUE, "outer value restored correctly");
is(getInputValue(browser, {id: "txt", frame: 0}), INNER_VALUE, "inner value restored correctly");
// Remove the tab.
gBrowserApp.closeTab(gBrowserApp.getTabForBrowser(browser));
});
/**
* This test ensures that form data collection restores correctly even after
* navigating to a different page and then returning via hitting back.
*/
add_task(async function test_formdata_navigation() {
const URL = "http://example.org/chrome/mobile/android/tests/browser/chrome/session_formdata_sample.html";
const otherURL = "http://example.org/chrome/mobile/android/tests/browser/chrome/basic_article.html";
const OUTER_VALUE = "browser_formdata_" + Math.random();
const INNER_VALUE = "browser_formdata_" + Math.random();
// Make sure the bfcache remains enabled during this test,
// otherwise the inner value will not be restored correctly.
Services.prefs.setBoolPref("browser.sessionhistory.bfcacheIgnoreMemoryPressure", true);
Services.prefs.setIntPref("browser.sessionhistory.max_total_viewers", 1);
SimpleTest.registerCleanupFunction(function() {
// Turn the bfcache memory pressure protection back off once we're finished.
Services.prefs.clearUserPref("browser.sessionhistory.bfcacheIgnoreMemoryPressure");
Services.prefs.clearUserPref("browser.sessionhistory.max_total_viewers");
});
// Creates a tab, loads a page with some form fields, modifies their values,
// navigates to a different page and back again and closes the tab.
function createNavigateAndRemoveTab() {
return Task.spawn(function* () {
// Create a new tab.
let tab = gBrowserApp.addTab(URL);
let browser = tab.browser;
yield promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
// Modify form data.
setInputValue(browser, {id: "txt", value: OUTER_VALUE});
setInputValue(browser, {id: "txt", value: INNER_VALUE, frame: 0});
yield promiseTabEvent(browser, "SSTabInputCaptured");
// Visit a different page.
gBrowserApp.loadURI(otherURL, browser);
yield promiseBrowserEvent(browser, "DOMContentLoaded");
is(browser.currentURI.spec, otherURL, "navigated to a different page");
// Go back.
is(browser.canGoBack, true, "can go back");
browser.goBack();
let titleChange = promiseTabEvent(browser, "DOMTitleChanged");
let tabDataUpdate = promiseTabEvent(browser, "SSTabDataUpdated");
yield titleChange;
yield tabDataUpdate;
is(browser.currentURI.spec, URL, "navigated back to form data page");
// Make sure form data is still present.
is(getInputValue(browser, {id: "txt"}), OUTER_VALUE, "outer value present after navigation");
is(getInputValue(browser, {id: "txt", frame: 0}), INNER_VALUE, "inner value present after navigation");
// Remove the tab.
gBrowserApp.closeTab(tab);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createNavigateAndRemoveTab();
let state = ss.getClosedTabs(gChromeWin);
let [{formdata}] = state;
is(formdata.id.txt, OUTER_VALUE, "outer value is correct");
is(formdata.children[0].id.txt, INNER_VALUE, "inner value is correct");
// Restore the closed tab.
let closedTabData = ss.getClosedTabs(gChromeWin)[0];
let browser = ss.undoCloseTab(gChromeWin, closedTabData);
await promiseBrowserEvent(browser, "load", { resolveAtNextTick: true });
// Check the form data.
is(getInputValue(browser, {id: "txt"}), OUTER_VALUE, "outer value restored correctly");
is(getInputValue(browser, {id: "txt", frame: 0}), INNER_VALUE, "inner value restored correctly");
// Remove the tab.
gBrowserApp.closeTab(gBrowserApp.getTabForBrowser(browser));
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=671993">Mozilla Bug 671993</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1261225">Mozilla Bug 1261225</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testSessionFormData</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,144 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1301160
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1301160</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
/** Test for Bug 1301160 **/
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
// The chrome window and related services
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
// Track the tabs where the tests are happening
let tabParent;
let tabChild1;
let tabChild2;
function cleanupTabs() {
if (tabParent) {
BrowserApp.closeTab(tabParent);
tabParent = null;
}
if (tabChild1) {
BrowserApp.closeTab(tabChild1);
tabChild1 = null;
}
if (tabChild2) {
BrowserApp.closeTab(tabChild2);
tabChild2 = null;
}
}
const url = "data:text/html;charset=utf-8,It%20was%20a%20dark%20and%20stormy%20night.";
add_task(async function test_sessionStoreParentId() {
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
// Initialize parent tab
tabParent = BrowserApp.addTab(url, { selected: true });
await promiseTabEvent(tabParent.browser, "DOMContentLoaded");
is(BrowserApp.selectedTab, tabParent, "tabParent is selected");
// test case #1
// Open tabs without passing a parent tab ID
tabChild1 = BrowserApp.addTab(url, { selected: false });
await promiseTabEvent(tabChild1.browser, "DOMContentLoaded");
is(BrowserApp.selectedTab, tabParent, "tabParent is selected");
tabChild2 = BrowserApp.addTab(url, { selected: true });
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabChild2, "2nd child tab is selected");
// After closing that tab, its neighbour should be selected
BrowserApp.closeTab(tabChild2);
tabChild2 = null;
await promiseTabEvent(BrowserApp.deck, "TabClose");
is(BrowserApp.selectedTab, tabChild1, "1st child tab is selected");
// test case #2
// Let's open a new tab, this time with a parent id and let's check if after closing it,
// the selected tab will be the neighbour since the parent was not selected
tabChild2 = BrowserApp.addTab(url, { selected: false, parentId: tabParent.id });
await promiseTabEvent(tabChild2.browser, "DOMContentLoaded");
is(BrowserApp.selectedTab, tabChild1, "1st child tab is still selected");
BrowserApp.selectTab(tabChild2);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabChild2, "2nd child tab is selected");
BrowserApp.closeTab(tabChild2);
tabChild2 = null;
await promiseTabEvent(BrowserApp.deck, "TabClose");
is(BrowserApp.selectedTab, tabChild1, "1st child tab is selected");
// test case #3
// This time we open a new tab with a parent id but this time the parent should be selected
// after closing since the parent was the previously selected tab
BrowserApp.selectTab(tabParent);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabParent, "tabParent is selected");
tabChild2 = BrowserApp.addTab(url, { selected: true, parentId: tabParent.id });
await promiseTabEvent(tabChild2.browser, "DOMContentLoaded");
is(BrowserApp.selectedTab, tabChild2, "2d child tab is selected");
BrowserApp.closeTab(tabChild2);
tabChild2 = null;
await promiseTabEvent(BrowserApp.deck, "TabClose");
is(BrowserApp.selectedTab, tabParent, "tabParent is selected");
// test case #4
// Now check that this works even if the child tab is closed and subsequently restored
tabChild2 = BrowserApp.addTab(url, { selected: false, parentId: tabParent.id });
await promiseTabEvent(tabChild2.browser, "SSTabDataUpdated");
BrowserApp.closeTab(tabChild2);
await promiseTabEvent(tabChild2.browser, "SSTabCloseProcessed");
// Restore the tab
let closedTabData = ss.getClosedTabs(chromeWin)[0];
let browser = ss.undoCloseTab(chromeWin, closedTabData);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
tabChild2 = BrowserApp.getTabForBrowser(browser);
is(BrowserApp.selectedTab, tabChild2, "restored 2nd child tab is selected");
// After closing that tab, its parent should be selected
BrowserApp.closeTab(tabChild2);
tabChild2 = null;
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabParent, "tabParent is selected after restoring");
cleanupTabs();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1301160">Mozilla Bug 1301160</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,391 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=810981
https://bugzilla.mozilla.org/show_bug.cgi?id=1282902
https://bugzilla.mozilla.org/show_bug.cgi?id=1301016
https://bugzilla.mozilla.org/show_bug.cgi?id=1265818
https://bugzilla.mozilla.org/show_bug.cgi?id=1498892
-->
<head>
<meta charset="utf-8">
<title>Various scroll position/zoom level tests for the mobile session store</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="head_scroll.js"></script>
<script type="application/javascript">
/** Tests for Bug 810981, 1282902, 1301016, 1265818, 1498892 **/
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
const {Task} = ChromeUtils.import("resource://testing-common/Task.jsm");
// The chrome window and friends.
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
const BASE = "http://example.org/chrome/mobile/android/tests/browser/chrome/";
const BASE2 = "http://test1.example.org/chrome/mobile/android/tests/browser/chrome/";
// Use something with ample space for scrolling and zooming.
const URL = BASE + "browser_scrollPositions_sample.html";
// Same content but under a different URL, so we have something to navigate to and from.
const URL2 = BASE + "browser_scrollPositions_sample2.html";
// Test nested scrolling with frames.
const URL_FRAMESET = BASE + "browser_scrollPositions_sample_frameset.html";
// Smaller page, which has no layout scroll range.
const URL_SMALL = BASE + "browser_scrollPositions_sample_small.html";
const URL_SMALL2 = BASE2 + "browser_scrollPositions_sample_small.html";
// Reader mode URL
const URL_reader = "about:reader?url=http%3A%2F%2Fexample.org%2Fchrome%2Fmobile%2Fandroid%2Ftests%2Fbrowser%2Fchrome%2Fbasic_article_mobile.html";
// Randomized set of scroll positions and zoom factors we will use in this test.
const SCROLL_X = Math.round(100 * (1 + Math.random()));
const SCROLL_Y = Math.round(200 * (1 + Math.random()));
const ZOOM = 1 + 0.5 * Math.random();
const SCROLL2_X = Math.round(300 * (1 + Math.random()));
const SCROLL2_Y = Math.round(400 * (1 + Math.random()));
const ZOOM2 = 1.5 + 0.5 * Math.random();
// Track the tabs where the tests are happening.
let tabScroll;
function cleanupTabs() {
if (tabScroll) {
BrowserApp.closeTab(tabScroll);
tabScroll = null;
}
}
function promiseVisualScrollEvent(browser) {
return promiseBrowserEvent(browser, "mozvisualscroll",
{ mozSystemGroup: true });
}
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
add_task(async function test_sessionStoreScrollPositionReaderMode() {
let testData = {x: 0, y: SCROLL_Y};
// Creates a tab, sets a scroll position and closes the tab.
function createAndRemoveReaderTab() {
return Task.spawn(function* () {
// Create a new tab.
tabScroll = BrowserApp.addTab(URL_reader);
let browser = tabScroll.browser;
yield promiseBrowserEvent(browser, "AboutReaderContentReady");
// Modify scroll position.
setScrollPosition(browser, testData);
yield promiseVisualScrollEvent(browser);
// Check that we've actually scrolled.
checkScroll(browser, testData);
// Remove the tab.
BrowserApp.closeTab(tabScroll);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createAndRemoveReaderTab();
let state = ss.getClosedTabs(chromeWin);
let [{scrolldata}] = state;
is(scrolldata.scroll, getScrollString(testData), "stored scroll position is correct");
// Restore the closed tab.
let closedTabData = ss.getClosedTabs(chromeWin)[0];
let browser = ss.undoCloseTab(chromeWin, closedTabData);
await promiseBrowserEvent(browser, "AboutReaderContentReady");
// Check the scroll position.
checkScroll(browser, testData);
// Remove the tab.
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
});
add_task(async function test_sessionStoreScrollPositionAndZoomLevel() {
let testData1 = {x: SCROLL_X, y: SCROLL_Y, zoom: ZOOM};
let testData2 = {x: SCROLL2_X, y: SCROLL2_Y, zoom: ZOOM2};
// Creates a tab, sets a scroll position and zoom level and closes the tab.
function createAndRemoveTab() {
return Task.spawn(function* () {
// Create a new tab.
tabScroll = BrowserApp.addTab(URL);
let browser = tabScroll.browser;
yield promiseBrowserEvent(browser, "pageshow");
// Modify scroll position and zoom level.
setScrollPosition(browser, testData1);
yield promiseVisualScrollEvent(browser);
// Check that we've actually scrolled and zoomed.
checkScroll(browser, testData1);
// Navigate to a different page and scroll/zoom there as well.
browser.loadURI(URL2);
yield promiseBrowserEvent(browser, "pageshow");
setScrollPosition(browser, testData2);
yield promiseVisualScrollEvent(browser);
checkScroll(browser, testData2);
// Remove the tab.
BrowserApp.closeTab(tabScroll);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createAndRemoveTab();
let state = ss.getClosedTabs(chromeWin);
let [{scrolldata}] = state;
is(scrolldata.scroll, getScrollString(testData2), "stored scroll position is correct");
ok(fuzzyEquals(scrolldata.zoom.resolution, ZOOM2), "stored zoom level is correct");
// Restore the closed tab.
let closedTabData = ss.getClosedTabs(chromeWin)[0];
let browser = ss.undoCloseTab(chromeWin, closedTabData);
let pageshow = promiseBrowserEvent(browser, "pageshow");
let scroll = promiseVisualScrollEvent(browser);
await pageshow;
await scroll;
// Check the scroll position and zoom level.
checkScroll(browser, testData2);
// Now go back in history and check that the scroll position
// is restored there as well.
is(browser.canGoBack, true, "can go back");
pageshow = promiseBrowserEvent(browser, "pageshow");
scroll = promiseVisualScrollEvent(browser);
browser.goBack();
await pageshow;
await scroll;
checkScroll(browser, testData1);
// Remove the tab.
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
});
add_task(async function test_sessionStoreZoomLevelRecalc() {
let testData = {x: SCROLL_X, y: SCROLL_Y, zoom: ZOOM};
// Creates a tab, sets a scroll position and zoom level and closes the tab.
function createAndRemoveTab() {
return Task.spawn(function* () {
// Create a new tab.
tabScroll = BrowserApp.addTab(URL);
let browser = tabScroll.browser;
yield promiseBrowserEvent(browser, "pageshow");
// Modify scroll position and zoom level.
setScrollPosition(browser, testData);
yield promiseVisualScrollEvent(browser);
// Check that we've actually scrolled and zoomed.
checkScroll(browser, testData);
// Remove the tab.
BrowserApp.closeTab(tabScroll);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createAndRemoveTab();
let state = ss.getClosedTabs(chromeWin);
let [{scrolldata}] = state;
is(scrolldata.scroll, getScrollString(testData), "stored scroll position is correct");
ok(fuzzyEquals(scrolldata.zoom.resolution, ZOOM), "stored zoom level is correct");
// Pretend the zoom level was originally saved on a rotated device.
let closedTabData = ss.getClosedTabs(chromeWin)[0];
let displayWidth = scrolldata.zoom.displaySize.width;
let displayHeight = scrolldata.zoom.displaySize.height;
closedTabData.scrolldata.zoom.displaySize.width = displayHeight;
closedTabData.scrolldata.zoom.displaySize.height = displayWidth;
// Restore the closed tab.
let browser = ss.undoCloseTab(chromeWin, closedTabData);
await promiseBrowserEvent(browser, "pageshow");
// Check the scroll position and zoom level.
testData.zoom = ZOOM * displayWidth / displayHeight;
checkScroll(browser, testData);
// Remove the tab.
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
});
add_task(async function test_sessionStoreScrollPositionForFrames() {
let testDataParent = {x: 0, y: Math.round(SCROLL_Y / 2), zoom: 2.0};
let testData1 = {x: SCROLL_X, y: SCROLL_Y, frame: 0};
let testData2 = {x: SCROLL2_X, y: SCROLL2_Y, frame: 1};
// Creates a tab, sets a scroll position and zoom level and closes the tab.
function createAndRemoveTab() {
return Task.spawn(function* () {
// Create a new tab.
tabScroll = BrowserApp.addTab(URL_FRAMESET);
let browser = tabScroll.browser;
yield promiseBrowserEvent(browser, "pageshow");
// Move the frameset itself.
setScrollPosition(browser, testDataParent);
yield promiseVisualScrollEvent(browser);
checkScroll(browser, testDataParent);
// Modify scroll position and zoom level for one frame...
setScrollPosition(browser, testData1);
yield promiseVisualScrollEvent(getFrame(browser, testData1));
checkScroll(browser, testData1);
// ... and the other.
setScrollPosition(browser, testData2);
yield promiseVisualScrollEvent(getFrame(browser, testData2));
checkScroll(browser, testData2);
// Remove the tab.
BrowserApp.closeTab(tabScroll);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createAndRemoveTab();
let state = ss.getClosedTabs(chromeWin);
let [{scrolldata}] = state;
is(scrolldata.scroll, getScrollString(testDataParent), "stored scroll position for frameset is correct");
is(scrolldata.children[0].scroll, getScrollString(testData1), "stored scroll position for frame 1 is correct");
is(scrolldata.children[1].scroll, getScrollString(testData2), "stored scroll position for frame 2 is correct");
// Restore the closed tab.
let closedTabData = ss.getClosedTabs(chromeWin)[0];
let browser = ss.undoCloseTab(chromeWin, closedTabData);
let pageshow = promiseBrowserEvent(browser, "pageshow");
// We can't add event listeners for the frames until we're sure that they've actually loaded.
let load = promiseBrowserEvent(browser, "load");
await load;
let scrollParent = promiseVisualScrollEvent(getFrame(browser, testDataParent));
let scroll1 = promiseVisualScrollEvent(getFrame(browser, testData1));
let scroll2 = promiseVisualScrollEvent(getFrame(browser, testData2));
await pageshow;
await scrollParent;
await scroll1;
await scroll2;
// Check the scroll position and zoom level.
checkScroll(browser, testDataParent);
checkScroll(browser, testData1);
checkScroll(browser, testData2);
// Remove the tab.
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
});
add_task(async function test_sessionHistoryRespectsLayoutScrollRange() {
let zoom = 2.0;
let testData = {x: 100, y: 100, zoom};
// Creates a tab, sets a scroll position and zoom level and closes the tab.
function createAndRemoveTab() {
return Task.spawn(function* () {
// Create a new tab.
tabScroll = BrowserApp.addTab(URL_SMALL);
let browser = tabScroll.browser;
yield promiseBrowserEvent(browser, "pageshow");
// Modify scroll position and zoom level.
setScrollPosition(browser, testData);
yield promiseVisualScrollEvent(browser);
// Check that we've actually scrolled and zoomed.
checkScroll(browser, testData);
// Check that the layout scroll position hasn't changed,
// as the page has no layout scroll range.
is(browser.contentWindow.scrollX, 0, "Layout scrolling should not have occurred");
is(browser.contentWindow.scrollY, 0, "Layout scrolling should not have occurred");
// Navigate to a different page and scroll/zoom there as well.
browser.loadURI(URL_SMALL2);
yield promiseBrowserEvent(browser, "pageshow");
setScrollPosition(browser, testData);
yield promiseVisualScrollEvent(browser);
checkScroll(browser, testData);
// Check that the layout scroll range is respected.
is(browser.contentWindow.scrollX, 0, "Layout scroll range should be respected");
is(browser.contentWindow.scrollY, 0, "Layout scroll range should be respected");
// Remove the tab.
BrowserApp.closeTab(tabScroll);
yield promiseTabEvent(browser, "SSTabCloseProcessed");
});
}
await createAndRemoveTab();
let state = ss.getClosedTabs(chromeWin);
let [{scrolldata}] = state;
is(scrolldata.scroll, getScrollString(testData), "stored scroll position is correct");
ok(fuzzyEquals(scrolldata.zoom.resolution, zoom), "stored zoom level is correct");
// Restore the closed tab.
let closedTabData = ss.getClosedTabs(chromeWin)[0];
let browser = ss.undoCloseTab(chromeWin, closedTabData);
let pageshow = promiseBrowserEvent(browser, "pageshow");
let scroll = promiseVisualScrollEvent(browser);
await pageshow;
await scroll;
// Check the scroll position and zoom level.
checkScroll(browser, testData);
// Check that the layout scroll range is still respected.
is(browser.contentWindow.scrollX, 0, "Layout scroll range should be respected");
is(browser.contentWindow.scrollY, 0, "Layout scroll range should be respected");
// Now go back in history and check that the scroll position
// is restored there as well.
is(browser.canGoBack, true, "can go back");
pageshow = promiseBrowserEvent(browser, "pageshow");
scroll = promiseVisualScrollEvent(browser);
browser.goBack();
await pageshow;
await scroll;
checkScroll(browser, testData);
// Check that the layout scroll range is still respected.
is(browser.contentWindow.scrollX, 0, "Layout scroll range should be respected");
is(browser.contentWindow.scrollY, 0, "Layout scroll range should be respected");
// Remove the tab.
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=810981">Mozilla Bug 810981</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1282902">Mozilla Bug 1282902</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1301016">Mozilla Bug 1301016</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1265818">Mozilla Bug 1265818</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1498892">Mozilla Bug 1498892</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,189 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1498812
-->
<head>
<meta charset="utf-8">
<title>Various scroll position tests for the mobile session store, dealing specifically with the Visual Viewport</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript" src="head_scroll.js"></script>
<script type="application/javascript" src="apz_test_utils.js"></script>
<script type="application/javascript" src="apz_test_native_event_utils.js"></script>
<script type="application/javascript">
/* import-globals-from ../../../../../gfx/layers/apz/test/mochitest/apz_test_utils.js */
/* import-globals-from ../../../../../gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js */
/** Tests for Bug 1498812 **/
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
// The chrome window and friends.
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
const BASE = "http://example.org/chrome/mobile/android/tests/browser/chrome/";
// This is a plain desktop page without any meta viewport tags,
// so the layout viewport will always fill the full page width.
const URL = BASE + "basic_article.html";
// A mobile page using width=device-width, which leads to the same result.
const URL2 = BASE + "basic_article_mobile.html";
async function scrollRight(window) {
// This listener will trigger the test to continue once APZ is done with
// processing the scroll.
let transformEnd = promiseNotification("APZ:TransformEnd");
let scroll = [
[ { x: 125, y: 100 } ],
[ { x: 120, y: 100 } ],
[ { x: 115, y: 100 } ],
[ { x: 110, y: 100 } ],
[ { x: 105, y: 100 } ],
[ { x: 100, y: 100 } ],
];
let touchIds = [0];
let doScroll = synthesizeNativeTouchSequences(document.body, scroll, null, touchIds);
while (!doScroll.next().done);
await transformEnd;
await promiseApzRepaintsFlushed(window);
}
// Track the tabs where the tests are happening.
let tabScroll;
function cleanupTabs() {
if (tabScroll) {
BrowserApp.closeTab(tabScroll);
tabScroll = null;
}
}
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
add_task(async function test_sessionStoreScrollPositionVisualViewport() {
let zoomIn = {x: 0, y: 0, zoom: 4 };
let scrollPos1, scrollPos2;
// Creates a tab, sets a scroll position and zoom level and closes the tab.
async function createAndRemoveTab() {
// Create a new tab.
tabScroll = BrowserApp.addTab(URL);
let browser = tabScroll.browser;
await promiseBrowserEvent(browser, "pageshow");
// Zoom in, so we can scroll to the right.
let scrolled = promiseTabEvent(browser, "SSTabScrollCaptured");
setScrollPosition(browser, zoomIn);
await scrolled;
// Check that we've actually zoomed.
checkScroll(browser, zoomIn);
scrolled = promiseTabEvent(browser, "SSTabScrollCaptured");
await scrollRight(browser.contentWindow);
await scrolled;
scrollPos1 = getScrollPosition(browser);
isnot(scrollPos1.x, 0, "we should be scrolled to the right");
is(scrollPos1.y, 0, "we scrolled horizontally");
// Navigate to a different page and scroll/zoom there as well.
browser.loadURI(URL2);
await promiseBrowserEvent(browser, "pageshow");
scrolled = promiseTabEvent(browser, "SSTabScrollCaptured");
setScrollPosition(browser, zoomIn);
await scrolled;
checkScroll(browser, zoomIn);
scrolled = promiseTabEvent(browser, "SSTabScrollCaptured");
await scrollRight(browser.contentWindow);
await scrolled;
scrollPos2 = getScrollPosition(browser);
isnot(scrollPos2.x, 0, "we should be scrolled to the right");
is(scrollPos2.y, 0, "we scrolled horizontally");
// Remove the tab.
let closed = promiseTabEvent(browser, "SSTabCloseProcessed");
BrowserApp.closeTab(tabScroll);
await closed;
}
await createAndRemoveTab();
// Check the live scroll data for the current history entry...
let tabData = ss.getClosedTabs(chromeWin)[0];
let {scrolldata} = tabData;
is(scrolldata.scroll, getScrollString(scrollPos2), "stored scroll position is correct");
ok(fuzzyEquals(scrolldata.zoom.resolution, scrollPos2.zoom), "stored zoom level is correct");
// ... and the presState from the previous history entry.
let {index} = tabData;
index -= 1; // session history uses 1-based index
let {entries} = tabData;
let prevPage = entries[index - 1];
ok(prevPage.presState, "presState exists");
if (prevPage.presState) {
let presState = prevPage.presState[0];
// The presState operates in app units, while all other scroll positions
// in JS-land use CSS pixels.
presState = presStateToCSSPx(presState);
is(presState.scroll, getScrollString(scrollPos1), "stored scroll position for previous page is correct");
ok(fuzzyEquals(presState.res, scrollPos1.zoom), "stored zoom level for previous page is correct");
}
// Restore the closed tab.
let browser = ss.undoCloseTab(chromeWin, tabData);
tabScroll = BrowserApp.getTabForBrowser(browser);
let pageshow = promiseBrowserEvent(browser, "pageshow");
let scroll = promiseBrowserEvent(browser, "mozvisualscroll",
{ mozSystemGroup: true });
await pageshow;
await scroll;
// Check the scroll position and zoom level.
checkScroll(browser, scrollPos2);
// Now go back in history and check that the scroll position
// is restored there as well.
is(browser.canGoBack, true, "can go back");
pageshow = promiseBrowserEvent(browser, "pageshow");
scroll = promiseBrowserEvent(browser, "mozvisualscroll",
{ mozSystemGroup: true });
browser.goBack();
await pageshow;
await scroll;
checkScroll(browser, scrollPos1);
// Remove the tab.
cleanupTabs();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1498812">Mozilla Bug 1498812</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,121 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1499874
-->
<head>
<meta charset="utf-8">
<title>Test mobile session store undo close tab functionality</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
/** Tests for Bug 1499874 **/
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/Messaging.jsm");
const PREFS_MAX_TABS_UNDO = "browser.sessionstore.max_tabs_undo";
// The chrome window and friends.
const chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
const BrowserApp = chromeWin.BrowserApp;
const URL = "data:text/html;charset=utf-8,It%20was%20a%20dark%20and%20stormy%20night.";
const TAB_COUNT = 4;
// Track the tabs where the tests are happening.
let tabs = [];
function cleanupTabs() {
tabs.forEach(tab => BrowserApp.closeTab(tab));
tabs = [];
}
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
add_task(async function test_removeClosedTabWhenUndoCloseTab() {
// Clear closed tabs that might be present from previous tests.
Services.prefs.setIntPref(PREFS_MAX_TABS_UNDO, 0);
Services.prefs.clearUserPref(PREFS_MAX_TABS_UNDO);
let state = ss.getClosedTabs(chromeWin);
is(state.length, 0, "no closed tabs at the start");
// Open a few tabs.
const tabEvents = [];
for (let i = 0; i < TAB_COUNT; i++) {
const tab = BrowserApp.addTab(URL);
tabEvents.push(promiseBrowserEvent(tab.browser, "DOMContentLoaded"));
tabs.push(tab);
}
await Promise.all(tabEvents);
// Close them all again.
for (const tab of tabs) {
const tabClosed = promiseTabEvent(tab.browser, "SSTabCloseProcessed");
BrowserApp.closeTab(tab);
await tabClosed;
}
tabs = [];
state = ss.getClosedTabs(chromeWin);
is(state.length, TAB_COUNT, "expected count of closed tabs in the session store");
// Without a tab ID in the closed tab data, the session store shouldn't be
// able to delete the tab from its collection of closed tabs.
const tabDataNoTabId = {...state[0]};
delete tabDataNoTabId.tabId;
let restoredTab =
BrowserApp.getTabForBrowser(ss.undoCloseTab(chromeWin, tabDataNoTabId));
tabs.push(restoredTab);
await promiseBrowserEvent(restoredTab.browser, "DOMContentLoaded");
state = ss.getClosedTabs(chromeWin);
is(state.length, TAB_COUNT, "expected count of closed tabs in the session store");
// Now restore each tab in turn and check that it gets removed from the
// session store's closed tab collection.
for (let closedTab of state) {
// Mimic a little more closely what happens when closing a tab from the
// home panels, where the tab data argument for undoCloseTab has been de-
// serialised and therefore checking tab data objects for (reference)
// equality isn't sufficient to determine which closed tab needs to be
// removed from the session store.
closedTab = {...closedTab};
const id = closedTab.tabId;
let closedTabs = ss.getClosedTabs(chromeWin);
ok(closedTabs.find(tab => tab.tabId == id), "closed tabs collection contains tab");
restoredTab = BrowserApp.getTabForBrowser(ss.undoCloseTab(chromeWin, closedTab));
tabs.push(restoredTab);
await promiseBrowserEvent(restoredTab.browser, "DOMContentLoaded");
closedTabs = ss.getClosedTabs(chromeWin);
ok(!closedTabs.find(tab => tab.tabId == id), "closed tabs collection no longer contains tab");
}
state = ss.getClosedTabs(chromeWin);
is(state.length, 0, "no more closed tabs should be left");
cleanupTabs();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1499874">Mozilla Bug 1499874</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,183 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1044556
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1044556</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="head.js"></script>
<script type="application/javascript">
/** Test for Bug 1044556 **/
"use strict";
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {EventDispatcher} = ChromeUtils.import("resource://gre/modules/Messaging.jsm");
// The chrome window
let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
// Track the tabs where the tests are happening
let tabBlank;
let tabTest;
function cleanupTabs() {
if (tabBlank) {
BrowserApp.closeTab(tabBlank);
tabBlank = null;
}
if (tabTest) {
BrowserApp.closeTab(tabTest);
tabTest = null;
}
}
const url1 = "data:text/html;charset=utf-8,It%20was%20a%20dark%20and%20stormy%20night.";
const url2 = "data:text/html;charset=utf-8,Suddenly%2C%20a%20tab%20was%20zombified.";
add_task(async function test_sessionStoreZombify() {
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
// Add a new tab with some content
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
// Add a new tab with a blank page
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
// Zombify the backgrounded test tab
tabTest.zombify();
// Check that the test tab is actually zombified
ok(tabTest.browser.__SS_restore, "Test tab is set for delay loading.");
// Switch back to the test tab and wait for it to reload
BrowserApp.selectTab(tabTest);
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
// Check that the test tab has loaded the correct url
is(tabTest.browser.currentURI.spec, url1, "Test tab is showing the first URL.");
// Navigate to some other content
BrowserApp.loadURI(url2, tabTest.browser);
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
is(tabTest.browser.currentURI.spec, url2, "Test tab is showing the second URL.");
// Switch to the other tab
BrowserApp.selectTab(tabBlank);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
// Zombify the backgrounded test tab again
tabTest.zombify();
// Check that the test tab is actually zombified
ok(tabTest.browser.__SS_restore, "Test tab is set for delay loading.");
// Test that the tab's own function for unzombifying works as well
tabTest.unzombify();
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
// Check that the test tab has loaded the correct url
is(tabTest.browser.currentURI.spec, url2, "Test tab is showing the second URL.");
cleanupTabs();
});
add_task(async function test_sessionStoreKeepAsZombie() {
let observerService = Services.obs;
SimpleTest.registerCleanupFunction(function() {
cleanupTabs();
});
// Add a new tab with some content
tabTest = BrowserApp.addTab(url1, { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
// Add a new tab with a blank page
tabBlank = BrowserApp.addTab("about:blank", { selected: true, parentId: BrowserApp.selectedTab.id });
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
// Zombify the backgrounded test tab
tabTest.zombify();
// Check that the test tab is actually zombified
ok(tabTest.browser.__SS_restore, "Test tab is set for delay loading.");
is(tabTest.browser.currentURI.spec, "about:blank", "Test tab is zombified.");
// Tell the session store that it shouldn't restore that tab on selecting
EventDispatcher.instance.dispatch("Tab:KeepZombified", {nextSelectedTabId: tabTest.id});
// Switch back to the test tab and check that it remains zombified
BrowserApp.selectTab(tabTest);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabTest, "Test tab is selected.");
ok(tabTest.browser.__SS_restore, "Test tab is still set for delay loading.");
// Switch to the other tab and back again
BrowserApp.selectTab(tabBlank);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
BrowserApp.selectTab(tabTest);
// "Tab:KeepZombified should be good for one TabSelect only
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
is(BrowserApp.selectedTab, tabTest, "Test tab is selected.");
// Check that the test tab is no longer a zombie and has loaded the correct url
ok(!tabTest.browser.__SS_restore, "Test tab is no longer set for delay loading.");
is(tabTest.browser.currentURI.spec, url1, "Test tab is showing the test URL.");
// Zombify the test tab again
BrowserApp.selectTab(tabBlank);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabBlank, "Test tab is in background.");
tabTest.zombify();
ok(tabTest.browser.__SS_restore, "Test tab is set for delay loading.");
is(tabTest.browser.currentURI.spec, "about:blank", "Test tab is zombified.");
// Tell the session store that it shouldn't restore that tab on selecting
EventDispatcher.instance.dispatch("Tab:KeepZombified", {nextSelectedTabId: tabTest.id});
// Switch back to the test tab and check that it remains zombified
BrowserApp.selectTab(tabTest);
await promiseTabEvent(BrowserApp.deck, "TabSelect");
is(BrowserApp.selectedTab, tabTest, "Test tab is selected.");
ok(tabTest.browser.__SS_restore, "Test tab is still set for delay loading.");
// Fake an "application-foreground" notification
observerService.notifyObservers(null, "application-foreground");
// The test tab should now start reloading
await promiseBrowserEvent(tabTest.browser, "DOMContentLoaded");
ok(!tabTest.browser.__SS_restore, "Test tab is no longer set for delay loading.");
is(tabTest.browser.currentURI.spec, url1, "Test tab is showing the test URL.");
cleanupTabs();
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1044556">Mozilla Bug 1044556</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,82 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=938571
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 938571</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {SimpleServiceDiscovery} = ChromeUtils.import("resource://gre/modules/SimpleServiceDiscovery.jsm");
function discovery_observer(subject, topic, data) {
dump("Observer: " + data);
let service = SimpleServiceDiscovery.findServiceForID(data);
if (!service)
return;
is(service.friendlyName, "Pretend Device");
is(service.uuid, "uuid:5ec9ff92-e8b2-4a94-a72c-76b34e6dabb1");
is(service.manufacturer, "Copy Cat Inc.");
is(service.modelName, "Eureka Dongle");
SimpleTest.finish();
}
var testDevice = {
id: "test:dummy",
target: "test:service",
factory(service) { },
types: ["video/mp4"],
extensions: ["mp4"],
};
function test_default() {
SimpleTest.registerCleanupFunction(function cleanup() {
SimpleServiceDiscovery.unregisterDevice(testDevice);
Services.obs.removeObserver(discovery_observer, "ssdp-service-found");
});
Services.obs.addObserver(discovery_observer, "ssdp-service-found");
// We need to register a device or processService will ignore us
SimpleServiceDiscovery.registerDevice(testDevice);
// Create a pretend service
let service = {
location: "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/simpleservice.xml",
target: "test:service",
};
dump("Force a detailed ping from a pretend service");
// Poke the service directly to get the discovery to happen
SimpleServiceDiscovery._processService(service);
}
SimpleTest.waitForExplicitFinish();
test_default();
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=938571">Mozilla Bug 938571</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testSimpleDiscovery</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,149 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=953381
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 953381</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
"use strict";
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
const {SimpleServiceDiscovery} = ChromeUtils.import("resource://gre/modules/SimpleServiceDiscovery.jsm");
// The chrome window
let chromeWin;
// Track the <browser> where the tests are happening
let browser;
function middle(element) {
let rect = element.getBoundingClientRect();
let x = (rect.right - rect.left) / 2 + rect.left;
let y = (rect.bottom - rect.top) / 2 + rect.top;
return [x, y];
}
// We must register a device and make a "mock" service for the device
var testDevice = {
id: "test:dummy",
target: "test:service",
factory(service) { },
types: ["video/mp4", "video/webm"],
extensions: ["mp4", "webm"],
};
function setup_browser() {
chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = chromeWin.BrowserApp;
SimpleTest.registerCleanupFunction(function cleanup() {
BrowserApp.closeTab(BrowserApp.getTabForBrowser(browser));
SimpleServiceDiscovery.unregisterDevice(testDevice);
});
// We need to register a device or processService will ignore us
SimpleServiceDiscovery.registerDevice(testDevice);
// Create a pretend service
let service = {
location: "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/simpleservice.xml",
target: "test:service",
};
dump("Force a detailed ping from a pretend service");
// Poke the service directly to get the discovery to happen
SimpleServiceDiscovery._processService(service);
// Load our test web page with <video> elements
let url = "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_discovery.html";
browser = BrowserApp.addTab(url, { selected: true, parentId: BrowserApp.selectedTab.id }).browser;
browser.addEventListener("load", function(event) {
Services.tm.dispatchToMainThread(test_video);
}, {capture: true, once: true});
}
let videoDiscoveryTests = [
{ id: "simple-mp4", source: "http://mochi.test:8888/simple.mp4", poster: "http://mochi.test:8888/simple.png", text: "simple video with mp4 src" },
{ id: "simple-fail", pass: false, text: "simple video with no mp4 src" },
{ id: "with-sources-mp4", source: "http://mochi.test:8888/simple.mp4", text: "video with mp4 extension source child" },
{ id: "with-sources-webm", source: "http://mochi.test:8888/simple.webm", text: "video with webm extension source child" },
{ id: "with-sources-fail", pass: false, text: "video with no mp4 extension source child" },
{ id: "with-sources-mimetype-mp4", source: "http://mochi.test:8888/simple-video-mp4", text: "video with mp4 mimetype source child" },
{ id: "with-sources-mimetype-webm", source: "http://mochi.test:8888/simple-video-webm", text: "video with webm mimetype source child" },
{ id: "simple-fetch-pass", source: "http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_discovery.sjs?type=video/mp4", text: "simple video with mp4 mimetype fetched from server" },
{ id: "simple-fetch-fail", pass: false, text: "simple video with non-video mimetype fetched from server" },
{ id: "video-overlay", source: "http://mochi.test:8888/simple.mp4", text: "div overlay covering a simple video with mp4 src" },
];
let expectedTests = videoDiscoveryTests.length;
function execute_video_test(test) {
let element = browser.contentDocument.getElementById(test.id);
if (element) {
let [x, y] = middle(element);
dump("Starting to getVideo");
chromeWin.CastingApps.getVideo(element, x, y, (video) => {
dump("Completed getVideo");
if (video) {
dump("video source: " + video.source);
let matchPoster = (test.poster == video.poster);
let matchSource = (test.source == video.source);
ok(matchPoster && matchSource && test.pass, test.text);
} else {
ok(!test.pass, test.text);
}
expectedTests--;
if (expectedTests == 0) {
SimpleTest.finish();
}
});
} else {
ok(false, "test element not found: [" + test.id + "]");
SimpleTest.finish();
}
}
function test_video() {
let videoTest;
while ((videoTest = videoDiscoveryTests.shift())) {
if (!("poster" in videoTest)) {
videoTest.poster = "";
}
if (!("pass" in videoTest)) {
videoTest.pass = true;
}
execute_video_test(videoTest);
}
}
SimpleTest.waitForExplicitFinish();
// On debug runs, 10 assertions typically observed; 5 each of:
// - ASSERTION: cancel with non-failure status code: 'NS_FAILED(status)'
// - ASSERTION: OnDataAvailable implementation consumed no data: 'Error'
SimpleTest.expectAssertions(0, 10);
setup_browser();
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=953381">Mozilla Bug 953381</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testVideoDiscovery</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,117 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1174458
Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1174458</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const {Promise} = ChromeUtils.import("resource://gre/modules/Promise.jsm");
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
ChromeUtils.defineModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm");
const HTTP_PATH = "http://mochi.test:8888";
const HTTP_ENDPOINT = "/chrome/mobile/android/tests/browser/chrome/web_channel.html";
const gChromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = gChromeWin.BrowserApp;
// TODO: consider if we want to run the original test in browser-chrome instead
// Keep this synced with /browser/base/content/test/general/browser_web_channel.js
// as much as possible. (We only have this since we can't run browser chrome
// tests on Android. Yet?)
let gTests = [
{
desc: "WebChannel generic message",
run() {
return new Promise(function(resolve, reject) {
let tab;
let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH));
channel.listen(function(id, message, target) {
is(id, "generic");
is(message.something.nested, "hello");
channel.stopListening();
BrowserApp.closeTab(tab);
resolve();
});
tab = BrowserApp.addTab(HTTP_PATH + HTTP_ENDPOINT + "?generic");
});
},
},
{
desc: "WebChannel two way communication",
run() {
return new Promise(function(resolve, reject) {
let tab;
let channel = new WebChannel("twoway", Services.io.newURI(HTTP_PATH));
channel.listen(function(id, message, sender) {
is(id, "twoway");
ok(message.command);
if (message.command === "one") {
channel.send({ data: { nested: true } }, sender);
}
if (message.command === "two") {
is(message.detail.data.nested, true);
channel.stopListening();
BrowserApp.closeTab(tab);
resolve();
}
});
tab = BrowserApp.addTab(HTTP_PATH + HTTP_ENDPOINT + "?twoway");
});
},
},
{
desc: "WebChannel multichannel",
run() {
return new Promise(function(resolve, reject) {
let tab;
let channel = new WebChannel("multichannel", Services.io.newURI(HTTP_PATH));
channel.listen(function(id, message, sender) {
is(id, "multichannel");
BrowserApp.closeTab(tab);
resolve();
});
tab = BrowserApp.addTab(HTTP_PATH + HTTP_ENDPOINT + "?multichannel");
});
},
},
]; // gTests
add_task(async function run_all() {
for (let test of gTests) {
info("Running: " + test.desc);
await test.run();
}
});
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1174458">Mozilla Bug 1174458</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testWebChannel</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
</html>

Просмотреть файл

@ -1,10 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video Controls Test</title>
</head>
<body>
<video id="video" style="height: 480px; width: 640px" controls mozNoDynamicControls></video>
<canvas id="canvas" style="height: 480px; width: 640px"></canvas>
</body>
</html>

Просмотреть файл

@ -1,77 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Video Discovery Test</title>
<style type="text/css">
#video-box {
float: left;
}
#video-overlay, #video-player {
width: 640px;
min-height: 370px;
}
#video-overlay {
position: absolute;
float: left;
background-color:#f00;
z-index:10;
}
</style>
</head>
<body>
<!-- PASS: src uses a mp4 extension -->
<video id="simple-mp4" poster="/simple.png" src="/simple.mp4"></video>
<!-- FAIL: src uses a ogg extension -->
<video id="simple-fail" src="/simple.ogg"></video>
<!-- PASS: source list uses a mp4 extension -->
<video id="with-sources-mp4">
<source src="/simple.ogg">
<source src="/simple.mp4">
</video>
<!-- PASS: source list uses a webm extension -->
<video id="with-sources-webm">
<source src="/simple.ogg">
<source src="/simple.webm">
</video>
<!-- FAIL: source list has no mp4 or webm extension -->
<video id="with-sources-fail">
<source src="/simple.ogg">
</video>
<!-- PASS: source list uses a mp4 mimetype -->
<video id="with-sources-mimetype-mp4">
<source src="/simple-video-ogg" type="video/ogg">
<source src="/simple-video-mp4" type="video/mp4">
</video>
<!-- PASS: source list uses a webm mimetype -->
<video id="with-sources-mimetype-webm">
<source src="/simple-video-ogg" type="video/ogg">
<source src="/simple-video-webm" type="video/webm">
</video>
<!-- PASS: source list uses a mp4 mimetype and extra data -->
<video id="with-sources-mimetype-plus">
<source src="/simple-video-ogg" type="video/ogg">
<source src="/simple-video-mp4" type="video/mp4; codecs='avc1.42E01E, mp4a.40.2'">
</video>
<!-- PASS: src uses a mp4 mimetype from the server -->
<video id="simple-fetch-pass" src="http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_discovery.sjs?type=video/mp4"></video>
<!-- FAIL: src uses a non-video mimetype from the server -->
<video id="simple-fetch-fail" src="http://mochi.test:8888/chrome/mobile/android/tests/browser/chrome/video_discovery.sjs?type=image/png"></video>
<!-- PASS: div overlay covers a video with mp4 src -->
<div id="video-box">
<div id="video-overlay"></div>
<div>
<video id="video-player" src="/simple.mp4"></video>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -1,27 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function parseQuery(request, key) {
var params = request.queryString.split('&');
for (var j = 0; j < params.length; ++j) {
var p = params[j];
if (p == key)
return true;
if (p.indexOf(key + "=") == 0)
return p.substring(key.length + 1);
if (p.indexOf("=") < 0 && key == "")
return p;
}
return false;
}
function handleRequest(request, response) {
// Pretend to be the type requested from the test
var type = parseQuery(request, "type");
response.setHeader("Content-Type", type, false);
response.setHeader("Cache-Control", "no-cache", false);
response.setHeader("Access-Control-Allow-Origin", "*", false);
response.write("fake video");
}

Просмотреть файл

@ -1,89 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>web_channel_test</title>
</head>
<body>
<script>
window.onload = function() {
var testName = window.location.search.replace(/^\?/, "");
switch (testName) {
case "generic":
test_generic();
break;
case "twoway":
test_twoWay();
break;
case "multichannel":
test_multichannel();
break;
}
};
function test_generic() {
var event = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({
id: "generic",
message: {
something: {
nested: "hello",
},
},
}),
});
window.dispatchEvent(event);
}
function test_twoWay() {
var firstMessage = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({
id: "twoway",
message: {
command: "one",
},
}),
});
window.addEventListener("WebChannelMessageToContent", function(e) {
var secondMessage = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({
id: "twoway",
message: {
command: "two",
detail: e.detail.message,
},
}),
});
if (!e.detail.message.error) {
window.dispatchEvent(secondMessage);
}
}, true);
window.dispatchEvent(firstMessage);
}
function test_multichannel() {
var event1 = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({
id: "wrongchannel",
message: {},
}),
});
var event2 = new window.CustomEvent("WebChannelMessageToChrome", {
detail: JSON.stringify({
id: "multichannel",
message: {},
}),
});
window.dispatchEvent(event1);
window.dispatchEvent(event2);
}
</script>
</body>
</html>

Просмотреть файл

@ -1,10 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
with Files('**'):
BUG_COMPONENT = ('GeckoView', 'General')
MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini']

Просмотреть файл

@ -1,13 +0,0 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
# catch all for new files
with Files('**'):
BUG_COMPONENT = ('GeckoView', 'General')
TEST_DIRS += [
'browser',
]