Bug 610764: Get Add-ons tab is not default selection in new profile. r=Unfocused, a=blocks-final

This commit is contained in:
Dave Townsend 2010-11-30 14:19:10 -08:00
Родитель 89ae6c1a3a
Коммит e7d2a6945f
9 изменённых файлов: 85 добавлений и 27 удалений

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

@ -72,7 +72,7 @@ const UPDATES_RELEASENOTES_TRANSFORMFILE = "chrome://mozapps/content/extensions/
const XMLURI_PARSE_ERROR = "http://www.mozilla.org/newlayout/xml/parsererror.xml"
const VIEW_DEFAULT = "addons://list/extension";
const VIEW_DEFAULT = "addons://discover/";
var gStrings = {};
XPCOMUtils.defineLazyServiceGetter(gStrings, "bundleSvc",

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

@ -61,6 +61,7 @@ _MAIN_TEST_FILES = \
browser_bug591465.js \
browser_bug596336.js \
browser_bug608316.js \
browser_bug610764.js \
browser_details.js \
browser_discovery.js \
browser_dragdrop.js \

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

@ -41,16 +41,18 @@ function end_test() {
function perform_search(aQuery, aCallback) {
var searchBox = gManagerWindow.document.getElementById("header-search");
searchBox.value = aQuery;
waitForFocus(function() {
var searchBox = gManagerWindow.document.getElementById("header-search");
searchBox.value = aQuery;
EventUtils.synthesizeMouse(searchBox, 2, 2, { }, gManagerWindow);
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
wait_for_view_load(gManagerWindow, function() {
var list = gManagerWindow.document.getElementById("search-list");
var rows = list.getElementsByTagName("richlistitem");
aCallback(rows);
});
EventUtils.synthesizeMouse(searchBox, 2, 2, { }, gManagerWindow);
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
wait_for_view_load(gManagerWindow, function() {
var list = gManagerWindow.document.getElementById("search-list");
var rows = list.getElementsByTagName("richlistitem");
aCallback(rows);
});
}, gManagerWindow);
}

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

@ -387,7 +387,7 @@ add_test(function() {
return;
}
open_manager(null, function(aManager) {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
@ -453,7 +453,7 @@ add_test(function() {
return;
}
open_manager(null, function(aManager) {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
@ -530,7 +530,7 @@ add_test(function() {
// Tests that removing an extension from the detail view goes back and doesn't
// allow you to go forward again.
add_test(function() {
open_manager(null, function(aManager) {
open_manager("addons://list/extension", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/extension", false, false);
@ -574,3 +574,20 @@ add_test(function() {
close_manager(aManager, run_next_test);
});
});
// Tests that opening the manager opens the last view
add_test(function() {
open_manager("addons://list/plugin", function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/plugin", false, false);
close_manager(aManager, function() {
open_manager(null, function(aManager) {
info("Part 1");
is_in_list(aManager, "addons://list/plugin", false, false);
close_manager(aManager, run_next_test);
});
});
});
});

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

@ -40,21 +40,23 @@ function end_test() {
}
function search(aRemoteSearch, aCallback) {
var searchBox = gManagerWindow.document.getElementById("header-search");
searchBox.value = SEARCH_QUERY;
waitForFocus(function() {
var searchBox = gManagerWindow.document.getElementById("header-search");
searchBox.value = SEARCH_QUERY;
EventUtils.synthesizeMouseAtCenter(searchBox, { }, gManagerWindow);
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
EventUtils.synthesizeMouseAtCenter(searchBox, { }, gManagerWindow);
EventUtils.synthesizeKey("VK_RETURN", { }, gManagerWindow);
wait_for_view_load(gManagerWindow, function() {
if (aRemoteSearch)
var filter = gManagerWindow.document.getElementById("search-filter-remote");
else
var filter = gManagerWindow.document.getElementById("search-filter-local");
EventUtils.synthesizeMouseAtCenter(filter, { }, gManagerWindow);
wait_for_view_load(gManagerWindow, function() {
if (aRemoteSearch)
var filter = gManagerWindow.document.getElementById("search-filter-remote");
else
var filter = gManagerWindow.document.getElementById("search-filter-local");
EventUtils.synthesizeMouseAtCenter(filter, { }, gManagerWindow);
executeSoon(aCallback);
});
executeSoon(aCallback);
});
}, gManagerWindow);
}
function check_allresultslink(aShouldShow) {

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

@ -0,0 +1,34 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Tests that the discovery view is the default
var gCategoryUtilities;
function test() {
waitForExplicitFinish();
open_manager(null, function(aWindow) {
waitForFocus(function() {
// The last view is cached except when it is the search view so switch to
// that and reopen to ensure we see the default view
var searchBox = aWindow.document.getElementById("header-search");
searchBox.value = "bar";
EventUtils.synthesizeMouseAtCenter(searchBox, { }, aWindow);
EventUtils.synthesizeKey("VK_RETURN", { }, aWindow);
wait_for_view_load(aWindow, function() {
close_manager(aWindow, function() {
open_manager(null, function(aWindow) {
gCategoryUtilities = new CategoryUtilities(aWindow);
is(gCategoryUtilities.selectedCategory, "discover", "Should show the discovery pane by default");
close_manager(aWindow, finish);
});
});
});
}, aWindow);
});
}

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

@ -4,7 +4,6 @@
// Tests that the discovery view loads properly
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_BACKGROUND_UPDATE = "extensions.update.enabled";
var gManagerWindow;

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

@ -204,7 +204,7 @@ add_test(function() {
add_test(function() {
installSearchResult(function() {
close_manager(gManagerWindow, function() {
open_manager(null, function(aWindow) {
open_manager("addons://list/extension", function(aWindow) {
gManagerWindow = aWindow;
gCategoryUtilities = new CategoryUtilities(gManagerWindow);
check_undo_install();

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

@ -26,6 +26,7 @@ const MANAGER_URI = "about:addons";
const INSTALL_URI = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
const PREF_LOGGING_ENABLED = "extensions.logging.enabled";
const PREF_SEARCH_MAXRESULTS = "extensions.getAddons.maxResults";
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
var gPendingTests = [];
var gTestsRun = 0;
@ -37,6 +38,8 @@ var gUseInContentUI = !gTestInWindow && ("switchToTabHavingURI" in window);
Services.prefs.setBoolPref(PREF_LOGGING_ENABLED, true);
// Turn off remote results in searches
Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 0);
// Default to a local discovery pane
Services.prefs.setCharPref(PREF_DISCOVERURL, "http://127.0.0.1/extensions-dummy/discoveryURL");
registerCleanupFunction(function() {
Services.prefs.clearUserPref(PREF_LOGGING_ENABLED);
try {