Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 /**
2 * Any copyright is dedicated to the Public Domain.
3 * http://creativecommons.org/publicdomain/zero/1.0/
4 */
6 // Make sure this is a unique origin or the tests will randomly fail!
7 const testPageURL = "http://bug704464-3.example.com/browser/" +
8 "dom/indexedDB/test/browser_quotaPromptDatabases.html";
9 const notificationID = "indexedDB-quota-prompt";
11 function test()
12 {
13 waitForExplicitFinish();
14 requestLongerTimeout(10);
15 PopupNotifications.transitionsEnabled = false;
16 removePermission(testPageURL, "indexedDB-unlimited");
17 Services.prefs.setIntPref("dom.indexedDB.warningQuota", 2);
18 executeSoon(test1);
19 }
21 let addMoreTest1Count = 0;
23 function test1()
24 {
25 gBrowser.selectedTab = gBrowser.addTab();
27 gBrowser.selectedBrowser.addEventListener("load", function () {
28 gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
30 let seenPopupCount;
32 setFinishedCallback(function(result) {
33 is(result, "ready", "Got 'ready' result");
35 setFinishedCallback(function(result) {
36 is(result, "complete", "Got 'complete' result");
38 if (addMoreTest1Count >= seenPopupCount + 5) {
39 setFinishedCallback(function(result) {
40 is(result, "finished", "Got 'finished' result");
41 is(getPermission(testPageURL, "indexedDB-unlimited"),
42 Components.interfaces.nsIPermissionManager.ALLOW_ACTION,
43 "Correct permission set");
44 gBrowser.removeCurrentTab();
45 unregisterAllPopupEventHandlers();
46 addMoreTest1Count = seenPopupCount;
47 PopupNotifications.transitionsEnabled = true;
48 executeSoon(finish);
49 });
50 executeSoon(function() { dispatchEvent("indexedDB-done"); });
51 }
52 else {
53 ++addMoreTest1Count;
54 executeSoon(function() { dispatchEvent("indexedDB-addMore"); });
55 }
56 });
57 ++addMoreTest1Count;
58 executeSoon(function() { dispatchEvent("indexedDB-addMore"); });
59 });
61 registerPopupEventHandler("popupshowing", function () {
62 ok(true, "prompt showing");
63 seenPopupCount = addMoreTest1Count - 1;
64 });
65 registerPopupEventHandler("popupshown", function () {
66 ok(true, "prompt shown");
67 triggerMainCommand(this);
68 });
69 registerPopupEventHandler("popuphidden", function () {
70 ok(true, "prompt hidden");
71 });
73 }, true);
75 info("loading test page: " + testPageURL);
76 content.location = testPageURL;
77 }