mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 593187: Request for authentication for an extension install doesn't focus the correct tab (test). r=dtownsend, a=blocks-betaN
This commit is contained in:
parent
aaaa489696
commit
b1db993132
@ -78,6 +78,7 @@ _BROWSER_FILES = head.js \
|
||||
browser_auth.js \
|
||||
browser_auth2.js \
|
||||
browser_auth3.js \
|
||||
browser_auth4.js \
|
||||
browser_offline.js \
|
||||
browser_navigateaway.js \
|
||||
browser_navigateaway2.js \
|
||||
|
43
toolkit/mozapps/extensions/test/xpinstall/browser_auth4.js
Normal file
43
toolkit/mozapps/extensions/test/xpinstall/browser_auth4.js
Normal file
@ -0,0 +1,43 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
// Test whether a request for auth for an XPI switches to the appropriate tab
|
||||
function test() {
|
||||
Harness.authenticationCallback = get_auth_info;
|
||||
Harness.downloadFailedCallback = download_failed;
|
||||
Harness.installEndedCallback = install_ended;
|
||||
Harness.installsCompletedCallback = finish_test;
|
||||
Harness.setup();
|
||||
|
||||
var pm = Services.perms;
|
||||
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
|
||||
|
||||
var triggers = encodeURIComponent(JSON.stringify({
|
||||
"Unsigned XPI": TESTROOT + "authRedirect.sjs?" + TESTROOT + "unsigned.xpi"
|
||||
}));
|
||||
gNewTab = gBrowser.addTab();
|
||||
gBrowser.getBrowserForTab(gNewTab).loadURI(TESTROOT + "installtrigger.html?" + triggers);
|
||||
}
|
||||
|
||||
function get_auth_info() {
|
||||
is(gBrowser.selectedTab, gNewTab, "Should have focused the tab loading the XPI");
|
||||
return [ "testuser", "testpass" ];
|
||||
}
|
||||
|
||||
function download_failed(install) {
|
||||
ok(false, "Install should not have failed");
|
||||
}
|
||||
|
||||
function install_ended(install, addon) {
|
||||
install.cancel();
|
||||
}
|
||||
|
||||
function finish_test(count) {
|
||||
is(count, 1, "1 Add-on should have been successfully installed");
|
||||
var authMgr = Components.classes['@mozilla.org/network/http-auth-manager;1']
|
||||
.getService(Components.interfaces.nsIHttpAuthManager);
|
||||
authMgr.clearAll();
|
||||
|
||||
Services.perms.remove("example.com", "install");
|
||||
|
||||
gBrowser.removeTab(gNewTab);
|
||||
Harness.finish();
|
||||
}
|
Loading…
Reference in New Issue
Block a user