1 const gTestRoot =
"chrome://mochikit/content/browser/browser/base/content/test/";
7 var ph = Components.classes[
"@mozilla.org/plugin/host;1"]
8 .getService(Components.interfaces.nsIPluginHost);
9 var tags = ph.getPluginTags({});
12 for (var
i = 0;
i < tags.length;
i++) {
13 if (tags[
i].
name ==
"Test Plug-in")
23 this.opencallback = opencallback;
24 this.closecallback = closecallback;
26 var
wm = Components.classes[
"@mozilla.org/appshell/window-mediator;1"]
27 .getService(Components.interfaces.nsIWindowMediator);
38 handleEvent:
function(
event) {
39 is(this.domwindow.document.location.href,
this.url,
"Should have opened the correct window");
41 this.domwindow.removeEventListener(
"load",
this,
false);
44 executeSoon(
function() {
self.opencallback(
self.domwindow); } );
47 onWindowTitleChange:
function(
window, title) {
50 onOpenWindow:
function(
window) {
55 this.domwindow =
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
56 .getInterface(Components.interfaces.nsIDOMWindowInternal);
57 this.domwindow.addEventListener(
"load",
this,
false);
60 onCloseWindow:
function(
window) {
64 var
wm = Components.classes[
"@mozilla.org/appshell/window-mediator;1"]
65 .getService(Components.interfaces.nsIWindowMediator);
66 wm.removeListener(
this);
67 this.opencallback =
null;
69 this.domwindow =
null;
72 executeSoon(this.closecallback);
73 this.closecallback =
null;
80 var newTab = gBrowser.addTab();
81 gBrowser.selectedTab = newTab;
89 gBrowser.removeCurrentTab();
107 var notificationBox = gBrowser.getNotificationBox(
gTestBrowser);
108 ok(notificationBox.getNotificationWithValue(
"missing-plugins"),
"Test 1, Should have displayed the missing plugin notification");
109 ok(!notificationBox.getNotificationWithValue(
"blocked-plugins"),
"Test 1, Should not have displayed the blocked plugin notification");
110 ok(
gTestBrowser.missingPlugins,
"Test 1, Should be a missing plugin list");
111 ok(
"application/x-unknown" in
gTestBrowser.missingPlugins,
"Test 1, Should know about application/x-unknown");
112 ok(!(
"application/x-test" in
gTestBrowser.missingPlugins),
"Test 1, Should not know about application/x-test");
115 ok(plugin,
"Should have a test plugin");
116 plugin.disabled =
false;
117 plugin.blocklisted =
false;
123 var notificationBox = gBrowser.getNotificationBox(
gTestBrowser);
124 ok(!notificationBox.getNotificationWithValue(
"missing-plugins"),
"Test 2, Should not have displayed the missing plugin notification");
125 ok(!notificationBox.getNotificationWithValue(
"blocked-plugins"),
"Test 2, Should not have displayed the blocked plugin notification");
126 ok(!
gTestBrowser.missingPlugins,
"Test 2, Should not be a missing plugin list");
129 ok(plugin,
"Should have a test plugin");
130 plugin.disabled =
true;
136 var notificationBox = gBrowser.getNotificationBox(
gTestBrowser);
137 ok(!notificationBox.getNotificationWithValue(
"missing-plugins"),
"Test 3, Should not have displayed the missing plugin notification");
138 ok(!notificationBox.getNotificationWithValue(
"blocked-plugins"),
"Test 3, Should not have displayed the blocked plugin notification");
139 ok(!
gTestBrowser.missingPlugins,
"Test 3, Should not be a missing plugin list");
143 EventUtils.synthesizeMouse(
gTestBrowser.contentDocument.getElementById(
"test"),
148 is(
win.gView,
"plugins",
"Should have displayed the plugins pane");
154 plugin.disabled =
false;
155 plugin.blocklisted =
true;
161 var notificationBox = gBrowser.getNotificationBox(
gTestBrowser);
162 ok(!notificationBox.getNotificationWithValue(
"missing-plugins"),
"Test 5, Should not have displayed the missing plugin notification");
163 ok(notificationBox.getNotificationWithValue(
"blocked-plugins"),
"Test 5, Should have displayed the blocked plugin notification");
164 ok(
gTestBrowser.missingPlugins,
"Test 5, Should be a missing plugin list");
165 ok(
"application/x-test" in
gTestBrowser.missingPlugins,
"Test 5, Should know about application/x-test");
166 ok(!(
"application/x-unknown" in
gTestBrowser.missingPlugins),
"Test 5, Should not know about application/x-unknown");
173 var notificationBox = gBrowser.getNotificationBox(
gTestBrowser);
174 ok(notificationBox.getNotificationWithValue(
"missing-plugins"),
"Test 6, Should have displayed the missing plugin notification");
175 ok(!notificationBox.getNotificationWithValue(
"blocked-plugins"),
"Test 6, Should not have displayed the blocked plugin notification");
176 ok(
gTestBrowser.missingPlugins,
"Test 6, Should be a missing plugin list");
177 ok(
"application/x-unknown" in
gTestBrowser.missingPlugins,
"Test 6, Should know about application/x-unknown");
178 ok(
"application/x-test" in
gTestBrowser.missingPlugins,
"Test 6, Should know about application/x-test");
185 var notificationBox = gBrowser.getNotificationBox(
gTestBrowser);
186 ok(notificationBox.getNotificationWithValue(
"missing-plugins"),
"Test 7, Should have displayed the missing plugin notification");
187 ok(!notificationBox.getNotificationWithValue(
"blocked-plugins"),
"Test 7, Should not have displayed the blocked plugin notification");
188 ok(
gTestBrowser.missingPlugins,
"Test 7, Should be a missing plugin list");
189 ok(
"application/x-unknown" in
gTestBrowser.missingPlugins,
"Test 7, Should know about application/x-unknown");
190 ok(
"application/x-test" in
gTestBrowser.missingPlugins,
"Test 7, Should know about application/x-test");
193 plugin.disabled =
false;
194 plugin.blocklisted =
false;
function get_test_plugin()
function prepareTest(nextTest, url)
function WindowOpenListener(url, opencallback, closecallback)
_getSelectedPageStyle s i