Bug 806168 - Test for bugs 802366 and 806127. r=bent

These new tests are disabled on Android because the test they're replacing, test_webapp_clearBrowserData.html, was also disabled on Android, and the new tests fail in the same way as the original test.

--HG--
rename : dom/indexedDB/test/test_webapp_clearBrowserData.html => dom/indexedDB/test/webapp_clearBrowserData.js
This commit is contained in:
Justin Lebar 2012-11-10 10:32:38 -08:00
Родитель fdbfd15c3f
Коммит ad91776365
8 изменённых файлов: 144 добавлений и 30 удалений

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

@ -104,11 +104,14 @@ MOCHITEST_FILES = \
test_setVersion_events.html \
test_setVersion_exclusion.html \
test_unique_index_update.html \
test_webapp_clearBrowserData.html \
test_webapp_clearBrowserData_inproc_oop.html \
test_webapp_clearBrowserData_oop_inproc.html \
test_webapp_clearBrowserData_inproc_inproc.html \
third_party_iframe1.html \
third_party_iframe2.html \
test_app_isolation_inproc.html \
test_app_isolation_oop.html \
webapp_clearBrowserData.js \
webapp_clearBrowserData_appFrame.html \
webapp_clearBrowserData_browserFrame.html \
$(NULL)

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

@ -0,0 +1,33 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
We have three similar tests here which each check that indexedDB data for a
browser inside an app is cleared upon request:
1) test_webapp_clearBrowserData_inproc_oop.html,
2) test_webapp_clearBrowserData_oop_inproc.html, and
3) test_webapp_clearBrowserData_inproc_inproc.html.
The only difference between these is that the first constructs an in-process
app frame which contains an out-of-process browser frame, the second
constructs an out-of-process app frame which contains an in-process browser
frame, and the third has both frames in process.
The tests share all their JS code. webapp_clearBrowserData.js determines
which frames are in- and out-of-process by looking at the test's filename.
-->
<html>
<head>
<title>Indexed Database Clear Browser Data Test inproc/inproc</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="text/javascript;version=1.7" src="webapp_clearBrowserData.js"></script>
<script type="text/javascript;version=1.7" src="helpers.js"></script>
</head>
<body onload="start();">
</body>
</html>

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

@ -0,0 +1,21 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
See comment in test_webapp_clearBrowserData_inproc_inproc.html for an
explanation of what's going on here.
-->
<html>
<head>
<title>Indexed Database Clear Browser Data Test inproc/oop</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript;version=1.7" src="webapp_clearBrowserData.js"></script>
<script type="text/javascript;version=1.7" src="helpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="start();">
</body>
</html>

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

@ -0,0 +1,21 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
See comment in test_webapp_clearBrowserData_inproc_inproc.html for an
explanation of what's going on here.
-->
<html>
<head>
<title>Indexed Database Clear Browser Data Test oop/inproc</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript;version=1.7" src="webapp_clearBrowserData.js"></script>
<script type="text/javascript;version=1.7" src="helpers.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="start();">
</body>
</html>

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

@ -1,15 +1,10 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<html>
<head>
<title>Indexed Database Clear Browser Data Test</title>
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
// This file has 4 leading spaces so that hg/git can tell that it's copied
// from test_webapp_clearBrowserData.html. We'll fix the indentation in
// the next commit.
<script type="text/javascript;version=1.7">
"use strict";
const appDomain = "example.org";
@ -22,6 +17,26 @@
const testKey = 1;
const testValue = objectStoreName;
// Determine whether the app and browser frames should be in or
// out-of-process.
let remote_app, remote_browser;
if (window.location.href.indexOf("inproc_oop") != -1) {
remote_app = false;
remote_browser = true;
}
else if (window.location.href.indexOf("oop_inproc") != -1) {
remote_app = true;
remote_browser = false;
}
else if (window.location.href.indexOf("inproc_inproc") != -1) {
remote_app = false;
remote_browser = false;
}
else {
ok(false, "Bad test filename!");
return;
}
let request = indexedDB.open(window.location.pathname, 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
@ -40,16 +55,23 @@
request.onsuccess = grabEventAndContinueHandler;
event = yield;
let srcURL =
location.protocol + "//" + appDomain +
location.pathname.replace("test_webapp_clearBrowserData.html",
"webapp_clearBrowserData_appFrame.html");
// We need to send both remote_browser and remote_app in the querystring
// because webapp_clearBrowserData_appFrame uses the path + querystring to
// create and open a database which it checks no other test has touched. If
// we sent only remote_browser, then we wouldn't be able to test both
// (remote_app==false, remote_browser==false) and (remote_app==true,
// remote_browser==false).
let srcURL = location.protocol + "//" + appDomain +
location.pathname.substring(0, location.pathname.lastIndexOf('/')) +
"/webapp_clearBrowserData_appFrame.html?" +
"remote_browser=" + remote_browser + "&" +
"remote_app=" + remote_app;
let iframe = document.createElement("iframe");
iframe.setAttribute("mozbrowser", "");
iframe.setAttribute("mozapp", manifestURL);
iframe.setAttribute("src", srcURL);
iframe.setAttribute("remote", "true");
iframe.setAttribute("remote", remote_app);
iframe.addEventListener("mozbrowsershowmodalprompt", function(event) {
let message = JSON.parse(event.detail.message);
switch (message.type) {
@ -127,11 +149,3 @@
"set": [["dom.mozBrowserFramesEnabled", true]]
}, runTest);
}
</script>
<script type="text/javascript;version=1.7" src="helpers.js"></script>
</head>
<body onload="start();"></body>
</html>

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

@ -33,8 +33,23 @@
const objectStoreName = "foo";
const testKey = 1;
const testValue = objectStoreName;
const dbName = location.pathname + location.search;
let request = indexedDB.open(window.location.pathname, 1);
// Determine whether our parent iframe asked us to create a remote
// browser frame here.
let remote_browser;
if (location.search.indexOf("remote_browser=true") != -1) {
remote_browser = true;
}
else if (location.search.indexOf("remote_browser=false") != -1) {
remote_browser = false;
}
else {
ok(false, "Expected remote_browser={true,false} in query string.");
return;
}
let request = indexedDB.open(dbName, 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
@ -63,7 +78,11 @@
let iframe = document.createElement("iframe");
iframe.setAttribute("mozbrowser", "");
iframe.setAttribute("src", "webapp_clearBrowserData_browserFrame.html");
// Send our querystring to the subframe because
// webapp_clearBrowserData_browserFrame uses its pathname + querystring to
// open a database which it assumes hasn't been touched by another test.
iframe.setAttribute("src", "webapp_clearBrowserData_browserFrame.html" + location.search);
iframe.setAttribute("remote", remote_browser);
iframe.addEventListener("mozbrowsershowmodalprompt", function(event) {
let message = JSON.parse(event.detail.message);
switch (message.type) {
@ -96,7 +115,7 @@
document.body.appendChild(iframe);
yield;
request = indexedDB.open(window.location.pathname, 1);
request = indexedDB.open(dbName, 1);
request.onerror = errorHandler;
request.onupgradeneeded = unexpectedSuccessHandler;
request.onsuccess = grabEventAndContinueHandler;

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

@ -43,8 +43,9 @@
const objectStoreName = "foo";
const testKey = 1;
const testValue = objectStoreName;
const dbName = window.location.pathname + window.location.search;
let request = indexedDB.open(window.location.pathname, 1);
let request = indexedDB.open(dbName, 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;
@ -73,7 +74,7 @@
block();
request = indexedDB.open(window.location.pathname, 1);
request = indexedDB.open(dbName, 1);
request.onerror = errorHandler;
request.onupgradeneeded = grabEventAndContinueHandler;
request.onsuccess = unexpectedSuccessHandler;

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

@ -152,7 +152,9 @@
"dom/indexedDB/test/test_event_propagation.html": "TIMED_OUT, bug 780855",
"dom/indexedDB/test/test_app_isolation_inproc.html": "TIMED_OUT",
"dom/indexedDB/test/test_app_isolation_oop.html": "TIMED_OUT",
"dom/indexedDB/test/test_webapp_clearBrowserData.html": "No test app installed",
"dom/indexedDB/test/test_webapp_clearBrowserData_inproc_inproc.html": "No test app installed",
"dom/indexedDB/test/test_webapp_clearBrowserData_inproc_oop.html": "No test app installed",
"dom/indexedDB/test/test_webapp_clearBrowserData_oop_inproc.html": "No test app installed",
"dom/network/tests/test_network_basics.html": "",
"dom/permission/tests/test_permission_basics.html": "",
"dom/sms/tests/test_sms_basics.html": "",