mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 14:45:29 +00:00
Bug 436069 - Unify history, bookmarks, awesomebar search and remote tabs into a single UI - (part 2) [r=mfinkle]
This commit is contained in:
parent
919d71df96
commit
d2ca274602
@ -218,7 +218,7 @@ var BrowserUI = {
|
||||
},
|
||||
|
||||
updateAwesomeHeader: function updateAwesomeHeader(aVisible) {
|
||||
document.getElementById('awesome-header').hidden = aVisible;
|
||||
document.getElementById("awesome-header").hidden = aVisible;
|
||||
},
|
||||
|
||||
_closeOrQuit: function _closeOrQuit() {
|
||||
@ -249,7 +249,7 @@ var BrowserUI = {
|
||||
BrowserUI.showToolbar(false);
|
||||
}
|
||||
|
||||
if (this._activePanel)
|
||||
if (this._activePanel && this._activePanel != aPanel)
|
||||
this._activePanel.close();
|
||||
this._activePanel = aPanel;
|
||||
},
|
||||
@ -671,6 +671,11 @@ var BrowserUI = {
|
||||
handleEscape: function (aEvent) {
|
||||
aEvent.stopPropagation();
|
||||
|
||||
if (BrowserUI.activePanel) {
|
||||
BrowserUI.activePanel = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check open dialogs
|
||||
let dialog = this.activeDialog;
|
||||
if (dialog) {
|
||||
@ -893,6 +898,7 @@ var BrowserUI = {
|
||||
break;
|
||||
case "cmd_go":
|
||||
this.goToURI();
|
||||
this.activePanel = null;
|
||||
break;
|
||||
case "cmd_openLocation":
|
||||
this.showToolbar(true);
|
||||
@ -900,15 +906,14 @@ var BrowserUI = {
|
||||
case "cmd_star":
|
||||
{
|
||||
let bookmarkURI = browser.currentURI;
|
||||
let bookmarkTitle = browser.contentTitle || bookmarkURI.spec;
|
||||
|
||||
let autoClose = false;
|
||||
|
||||
if (PlacesUtils.getMostRecentBookmarkForURI(bookmarkURI) == -1) {
|
||||
let bmsvc = PlacesUtils.bookmarks;
|
||||
let bookmarkId = bmsvc.insertBookmark(BookmarkList.mobileRoot, bookmarkURI,
|
||||
bmsvc.DEFAULT_INDEX,
|
||||
bookmarkTitle);
|
||||
let bookmarkTitle = browser.contentTitle || bookmarkURI.spec;
|
||||
let bookmarkService = PlacesUtils.bookmarks;
|
||||
let bookmarkId = bookmarkService.insertBookmark(BookmarkList.panel.mobileRoot, bookmarkURI,
|
||||
bookmarkService.DEFAULT_INDEX,
|
||||
bookmarkTitle);
|
||||
this.updateStar();
|
||||
|
||||
// autoclose the bookmark popup
|
||||
@ -1284,34 +1289,35 @@ var NewTabPopup = {
|
||||
};
|
||||
|
||||
var AwesomePanel = function(aElementId, aCommandId) {
|
||||
let items = document.getElementById(aElementId);
|
||||
let command = document.getElementById(aCommandId);
|
||||
|
||||
this.panel = document.getElementById(aElementId),
|
||||
|
||||
this.open = function aw_open() {
|
||||
BrowserUI.pushDialog(this);
|
||||
command.setAttribute("checked", "true");
|
||||
items.hidden = false;
|
||||
this.panel.hidden = false;
|
||||
|
||||
if (items.hasAttribute("onshow")) {
|
||||
let func = new Function("panel", items.getAttribute("onshow"));
|
||||
func.call(items);
|
||||
if (this.panel.hasAttribute("onshow")) {
|
||||
let func = new Function("panel", this.panel.getAttribute("onshow"));
|
||||
func.call(this.panel);
|
||||
}
|
||||
|
||||
if (items.open)
|
||||
items.open();
|
||||
if (this.panel.open)
|
||||
this.panel.open();
|
||||
},
|
||||
|
||||
this.close = function aw_close() {
|
||||
if (items.hasAttribute("onhide")) {
|
||||
let func = new Function("panel", items.getAttribute("onhide"));
|
||||
func.call(items);
|
||||
if (this.panel.hasAttribute("onhide")) {
|
||||
let func = new Function("panel", this.panel.getAttribute("onhide"));
|
||||
func.call(this.panel);
|
||||
}
|
||||
|
||||
if (items.close)
|
||||
items.close();
|
||||
if (this.panel.close)
|
||||
this.panel.close();
|
||||
|
||||
items.blur();
|
||||
items.hidden = true;
|
||||
this.panel.blur();
|
||||
this.panel.hidden = true;
|
||||
command.removeAttribute("checked", "true");
|
||||
BrowserUI.popDialog();
|
||||
},
|
||||
@ -2258,16 +2264,6 @@ XPCOMUtils.defineLazyGetter(this, "AllPagesList", function() {
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "BookmarkList", function() {
|
||||
let list = new AwesomePanel("bookmarks-items", "cmd_bookmarks");
|
||||
list.__defineGetter__("mobileRoot", function() {
|
||||
let items = PlacesUtils.annotations.getItemsWithAnnotation("mobile/bookmarksRoot", {});
|
||||
if (!items.length)
|
||||
throw "Couldn't find mobile bookmarks root!";
|
||||
|
||||
delete this.mobileRoot;
|
||||
return this.mobileRoot = items[0];
|
||||
});
|
||||
|
||||
return list;
|
||||
return new AwesomePanel("bookmarks-items", "cmd_bookmarks");
|
||||
});
|
||||
|
||||
|
@ -34,7 +34,7 @@ function runNextTest() {
|
||||
else {
|
||||
// Cleanup. All tests are completed at this point
|
||||
try {
|
||||
PlacesUtils.bookmarks.removeFolderChildren(BookmarkList.mobileRoot);
|
||||
PlacesUtils.bookmarks.removeFolderChildren(BookmarkList.panel.mobileRoot);
|
||||
}
|
||||
finally {
|
||||
// We must finialize the tests
|
||||
@ -95,9 +95,9 @@ gTests.push({
|
||||
|
||||
onPageReady: function() {
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return document.getElementById("bookmarklist-container").hidden == false; });
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return BrowserUI.activePanel == BookmarkList });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
@ -111,8 +111,7 @@ gTests.push({
|
||||
runNextTest();
|
||||
});
|
||||
|
||||
var bookmarkitems = document.getElementById("bookmark-items");
|
||||
var bookmarkitem = document.getAnonymousElementByAttribute(bookmarkitems, "uri", testURL_01);
|
||||
let bookmarkitem = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_01);
|
||||
isnot(bookmarkitem, null, "Found the bookmark");
|
||||
is(bookmarkitem.getAttribute("uri"), testURL_01, "Bookmark has the right URL via attribute");
|
||||
is(bookmarkitem.spec, testURL_01, "Bookmark has the right URL via property");
|
||||
@ -128,32 +127,31 @@ gTests.push({
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = document.getElementById("bookmark-items").items[0];
|
||||
let bookmark = BookmarkList.panel.items[0];
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
var bookmarkitems = document.getElementById("bookmark-items");
|
||||
var bookmarkitem = document.getAnonymousElementByAttribute(bookmarkitems, "uri", testURL_01);
|
||||
let bookmarkitem = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_01);
|
||||
EventUtils.synthesizeMouse(bookmarkitem, bookmarkitem.clientWidth / 2, bookmarkitem.clientHeight / 2, {});
|
||||
|
||||
var uritextbox = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "uri");
|
||||
let uritextbox = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "uri");
|
||||
uritextbox.value = testURL_02;
|
||||
|
||||
var donebutton = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "done-button");
|
||||
let donebutton = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "done-button");
|
||||
donebutton.click();
|
||||
|
||||
var bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_01));
|
||||
let bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_01));
|
||||
is(bookmark, -1, testURL_01 + " should no longer in bookmark");
|
||||
bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02));
|
||||
isnot(bookmark, -1, testURL_02 + " is in bookmark");
|
||||
|
||||
BookmarkList.close();
|
||||
BrowserUI.activePanel = null;
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
@ -166,34 +164,33 @@ gTests.push({
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = document.getElementById("bookmark-items").items[0];
|
||||
let bookmark = BookmarkList.panel.items[0];
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
var bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02));
|
||||
let bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02));
|
||||
is(PlacesUtils.bookmarks.getItemTitle(bookmark), "Browser Blank Page 01", "Title remains the same.");
|
||||
|
||||
var bookmarkitems = document.getElementById("bookmark-items");
|
||||
var bookmarkitem = document.getAnonymousElementByAttribute(bookmarkitems, "uri", testURL_02);
|
||||
let bookmarkitem = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
EventUtils.synthesizeMouse(bookmarkitem, bookmarkitem.clientWidth / 2, bookmarkitem.clientHeight / 2, {});
|
||||
|
||||
var titletextbox = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "name");
|
||||
var newtitle = "Changed Title";
|
||||
let titletextbox = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "name");
|
||||
let newtitle = "Changed Title";
|
||||
titletextbox.value = newtitle;
|
||||
|
||||
var donebutton = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "done-button");
|
||||
let donebutton = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "done-button");
|
||||
donebutton.click();
|
||||
|
||||
isnot(PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02)), -1, testURL_02 + " is still in bookmark.");
|
||||
is(PlacesUtils.bookmarks.getItemTitle(bookmark), newtitle, "Title is changed.");
|
||||
|
||||
BookmarkList.close();
|
||||
BrowserUI.activePanel = null;
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
@ -207,26 +204,25 @@ gTests.push({
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = document.getElementById("bookmark-items").items[0];
|
||||
let bookmark = BookmarkList.panel.items[0];
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onBookmarksReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onBookmarksReady: function() {
|
||||
var bookmarkitems = document.getElementById("bookmark-items");
|
||||
let bookmark = document.getAnonymousElementByAttribute(bookmarkitems, "uri", testURL_02);
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
bookmark.remove();
|
||||
|
||||
var bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02));
|
||||
let bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_02));
|
||||
ok(bookmark == -1, testURL_02 + " should no longer in bookmark");
|
||||
bookmark = PlacesUtils.getMostRecentBookmarkForURI(makeURI(testURL_01));
|
||||
ok(bookmark == -1, testURL_01 + " should no longer in bookmark");
|
||||
|
||||
BookmarkList.close();
|
||||
BrowserUI.activePanel = null;
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
@ -247,15 +243,16 @@ gTests.push({
|
||||
testURL_02);
|
||||
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
// Go into edit mode
|
||||
let bookmark = document.getElementById("bookmark-items").items[0];
|
||||
let bookmarksPanel = BookmarkList.panel;
|
||||
let bookmark = bookmarksPanel.items[0];
|
||||
bookmark.startEditing();
|
||||
|
||||
// Is the "desktop" folder showing?
|
||||
var first = BookmarkList._bookmarks._children.firstChild;
|
||||
is(first.itemId, BookmarkList._bookmarks._desktopFolderId, "Desktop folder is showing");
|
||||
let first = bookmarksPanel._children.firstChild;
|
||||
is(first.itemId, bookmarksPanel._desktopFolderId, "Desktop folder is showing");
|
||||
|
||||
// Is the "desktop" folder in edit mode?
|
||||
is(first.isEditing, false, "Desktop folder is not in edit mode");
|
||||
@ -265,16 +262,15 @@ gTests.push({
|
||||
|
||||
// A tap on the "desktop" folder _should_ open the folder, not put it into edit mode.
|
||||
// So we need to get the first item again.
|
||||
first = BookmarkList._bookmarks._children.firstChild;
|
||||
first = bookmarksPanel._children.firstChild;
|
||||
|
||||
// It should not be the "desktop" folder
|
||||
isnot(first.itemId, BookmarkList._bookmarks._desktopFolderId, "Desktop folder is not showing after mouse click");
|
||||
isnot(first.itemId, bookmarksPanel._desktopFolderId, "Desktop folder is not showing after mouse click");
|
||||
|
||||
// But it should be one of the other readonly bookmark roots
|
||||
isnot(BookmarkList._bookmarks._readOnlyFolders.indexOf(parseInt(first.itemId)), -1, "Desktop subfolder is showing after mouse click");
|
||||
|
||||
BookmarkList.close();
|
||||
isnot(bookmarksPanel._readOnlyFolders.indexOf(parseInt(first.itemId)), -1, "Desktop subfolder is showing after mouse click");
|
||||
|
||||
BrowserUI.activePanel = null;
|
||||
PlacesUtils.bookmarks.removeItem(gCurrentTest.bmId);
|
||||
|
||||
runNextTest();
|
||||
|
@ -34,7 +34,7 @@ function runNextTest() {
|
||||
else {
|
||||
// Cleanup. All tests are completed at this point
|
||||
try {
|
||||
PlacesUtils.bookmarks.removeFolderChildren(BookmarkList.mobileRoot);
|
||||
PlacesUtils.bookmarks.removeFolderChildren(BookmarkList.panel.mobileRoot);
|
||||
}
|
||||
finally {
|
||||
// We must finialize the tests
|
||||
@ -192,27 +192,27 @@ gTests.push({
|
||||
},
|
||||
|
||||
onPageLoad: function() {
|
||||
var starbutton = document.getElementById("tool-star");
|
||||
let starbutton = document.getElementById("tool-star");
|
||||
starbutton.click();
|
||||
|
||||
waitFor(gCurrentTest.onPopupReady, function() { return document.getElementById("bookmark-popup").hidden == false; });
|
||||
},
|
||||
|
||||
onPopupReady: function() {
|
||||
var editbutton = document.getElementById("bookmark-popup-edit");
|
||||
let editbutton = document.getElementById("bookmark-popup-edit");
|
||||
editbutton.click();
|
||||
|
||||
waitFor(gCurrentTest.onEditorReady, function() { return document.getElementById("bookmark-item").isEditing == true; });
|
||||
},
|
||||
|
||||
onEditorReady: function() {
|
||||
var bookmarkitem = document.getElementById("bookmark-item");
|
||||
let bookmarkitem = document.getElementById("bookmark-item");
|
||||
EventUtils.synthesizeMouse(bookmarkitem, bookmarkitem.clientWidth / 2, bookmarkitem.clientHeight / 2, {});
|
||||
|
||||
var uritextbox = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "uri");
|
||||
let uritextbox = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "uri");
|
||||
uritextbox.value = testURL_01;
|
||||
|
||||
var donebutton = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "done-button");
|
||||
let donebutton = document.getAnonymousElementByAttribute(bookmarkitem, "anonid", "done-button");
|
||||
donebutton.click();
|
||||
|
||||
waitFor(gCurrentTest.onEditorDone, function() { return document.getElementById("bookmark-container").hidden == true; });
|
||||
|
@ -1,9 +1,9 @@
|
||||
/*
|
||||
* Bug 486490 - Fennec browser-chrome tests to verify correct implementation of chrome
|
||||
* Bug 486490 - Fennec browser-chrome tests to verify correct implementation of chrome
|
||||
* code in mobile/chrome/content in terms of integration with Places
|
||||
* component, specifically for bookmark management.
|
||||
*/
|
||||
|
||||
|
||||
var testURL_01 = "chrome://mochikit/content/browser/mobile/chrome/browser_blank_01.html";
|
||||
var testURL_02 = "chrome://mochikit/content/browser/mobile/chrome/browser_blank_02.html";
|
||||
|
||||
@ -34,7 +34,7 @@ function runNextTest() {
|
||||
else {
|
||||
// Cleanup. All tests are completed at this point
|
||||
try {
|
||||
PlacesUtils.bookmarks.removeFolderChildren(BookmarkList.mobileRoot);
|
||||
PlacesUtils.bookmarks.removeFolderChildren(BookmarkList.panel.mobileRoot);
|
||||
}
|
||||
finally {
|
||||
// We must finialize the tests
|
||||
@ -66,19 +66,17 @@ gTests.push({
|
||||
ok(bookmarkItem != -1, testURL_02 + " should be added.");
|
||||
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
// Go into edit mode
|
||||
let bookmarkItems = document.getElementById("bookmark-items");
|
||||
let bookmark = document.getAnonymousElementByAttribute(bookmarkItems, "uri", testURL_02);
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onEditorReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onEditorReady: function() {
|
||||
let bookmarkItems = document.getElementById("bookmark-items");
|
||||
let bookmark = document.getAnonymousElementByAttribute(bookmarkItems, "uri", testURL_02);
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
let tagstextbox = document.getAnonymousElementByAttribute(bookmark, "anonid", "tags");
|
||||
tagstextbox.value = "tagone, tag two, tag-three, tag4";
|
||||
|
||||
@ -88,7 +86,8 @@ gTests.push({
|
||||
let tagsarray = PlacesUtils.tagging.getTagsForURI(makeURI(testURL_02), {});
|
||||
is(tagsarray.length, 4, "All tags are associated with specified bookmark");
|
||||
|
||||
BookmarkList.close();
|
||||
BrowserUI.activePanel = null;
|
||||
|
||||
Browser.closeTab(this._currentTab);
|
||||
|
||||
runNextTest();
|
||||
@ -102,19 +101,17 @@ gTests.push({
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
// Go into edit mode
|
||||
let bookmarkItems = document.getElementById("bookmark-items");
|
||||
let bookmark = document.getAnonymousElementByAttribute(bookmarkItems, "uri", testURL_02);
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onEditorReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onEditorReady: function() {
|
||||
let bookmarkItems = document.getElementById("bookmark-items");
|
||||
let bookmark = document.getAnonymousElementByAttribute(bookmarkItems, "uri", testURL_02);
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
|
||||
let taggeduri = PlacesUtils.tagging.getURIsForTag("tag-three");
|
||||
is(taggeduri[0].spec, testURL_02, "Old tag still associated with bookmark");
|
||||
@ -132,7 +129,7 @@ gTests.push({
|
||||
let tagsarray = PlacesUtils.tagging.getTagsForURI(makeURI(testURL_02), {});
|
||||
is(tagsarray.length, 4, "Bookmark still has same number of tags");
|
||||
|
||||
BookmarkList.close();
|
||||
BrowserUI.activePanel = null;
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
@ -147,19 +144,17 @@ gTests.push({
|
||||
|
||||
run: function() {
|
||||
// Open the bookmark list
|
||||
BookmarkList.show();
|
||||
BrowserUI.doCommand("cmd_bookmarks");
|
||||
|
||||
// Go into edit mode
|
||||
let bookmarkItems = document.getElementById("bookmark-items");
|
||||
let bookmark = document.getAnonymousElementByAttribute(bookmarkItems, "uri", testURL_02);
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
bookmark.startEditing();
|
||||
|
||||
waitFor(gCurrentTest.onEditorReady, function() { return bookmark.isEditing == true; });
|
||||
},
|
||||
|
||||
onEditorReady: function() {
|
||||
let bookmarkItems = document.getElementById("bookmark-items");
|
||||
let bookmark = document.getAnonymousElementByAttribute(bookmarkItems, "uri", testURL_02);
|
||||
let bookmark = document.getAnonymousElementByAttribute(BookmarkList.panel, "uri", testURL_02);
|
||||
|
||||
let tagstextbox = document.getAnonymousElementByAttribute(bookmark, "anonid", "tags");
|
||||
tagstextbox.value = "tagone, tag two, tag4";
|
||||
@ -172,8 +167,7 @@ gTests.push({
|
||||
let tagsarray = PlacesUtils.tagging.getTagsForURI(makeURI(testURL_02), {});
|
||||
is(tagsarray.length, 3, "Tag is successfully deleted");
|
||||
|
||||
BookmarkList.close();
|
||||
|
||||
BrowserUI.activePanel = null;
|
||||
runNextTest();
|
||||
}
|
||||
});
|
||||
|
@ -7,11 +7,10 @@ var gCurrentTest = null;
|
||||
|
||||
function pageLoaded(url) {
|
||||
return function() {
|
||||
let tab = gCurrentTest._tab;
|
||||
let tab = gCurrentTest._currentTab;
|
||||
return !tab.isLoading() && tab.browser.currentURI.spec == url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Entry point (must be named "test")
|
||||
@ -19,7 +18,7 @@ function test() {
|
||||
// The "runNextTest" approach is async, so we need to call "waitForExplicitFinish()"
|
||||
// We call "finish()" when the tests are finished
|
||||
waitForExplicitFinish();
|
||||
|
||||
|
||||
// Start the tests
|
||||
runNextTest();
|
||||
}
|
||||
@ -49,10 +48,10 @@ function runNextTest() {
|
||||
// Case: Loading a page into the URLBar with VK_RETURN
|
||||
gTests.push({
|
||||
desc: "Loading a page into the URLBar with VK_RETURN",
|
||||
_tab: null,
|
||||
_currentTab: null,
|
||||
|
||||
run: function() {
|
||||
this._tab = Browser.addTab(testURL_01, true);
|
||||
this._currentTab = Browser.addTab(testURL_01, true);
|
||||
|
||||
// Wait for the tab to load, then do the test
|
||||
waitFor(gCurrentTest.onPageReady, pageLoaded(testURL_01));
|
||||
@ -65,11 +64,11 @@ gTests.push({
|
||||
|
||||
// Test back button state
|
||||
let back = document.getElementById("tool-back");
|
||||
is(back.disabled, !gCurrentTest._tab.browser.canGoBack, "Back button check");
|
||||
is(back.disabled, !gCurrentTest._currentTab.browser.canGoBack, "Back button check");
|
||||
|
||||
// Test forward button state
|
||||
let forward = document.getElementById("tool-forward");
|
||||
is(forward.disabled, !gCurrentTest._tab.browser.canGoForward, "Forward button check");
|
||||
is(forward.disabled, !gCurrentTest._currentTab.browser.canGoForward, "Forward button check");
|
||||
|
||||
// Focus the url edit
|
||||
let urlbarEdit = document.getElementById("urlbar-edit");
|
||||
@ -78,7 +77,7 @@ gTests.push({
|
||||
// Wait for the awesomebar to load, then do the test
|
||||
window.addEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
},
|
||||
|
||||
|
||||
onFocusReady: function() {
|
||||
window.removeEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
// Test mode
|
||||
@ -87,11 +86,11 @@ gTests.push({
|
||||
|
||||
// Test back button state
|
||||
let back = document.getElementById("tool-back");
|
||||
is(back.disabled, !gCurrentTest._tab.browser.canGoBack, "Back button check");
|
||||
is(back.disabled, !gCurrentTest._currentTab.browser.canGoBack, "Back button check");
|
||||
|
||||
// Test forward button state
|
||||
let forward = document.getElementById("tool-forward");
|
||||
is(forward.disabled, !gCurrentTest._tab.browser.canGoForward, "Forward button check");
|
||||
is(forward.disabled, !gCurrentTest._currentTab.browser.canGoForward, "Forward button check");
|
||||
|
||||
// Check button states (url edit is focused)
|
||||
let go = document.getElementById("tool-go");
|
||||
@ -131,11 +130,11 @@ gTests.push({
|
||||
let reloadStyle = window.getComputedStyle(reload, null);
|
||||
is(reloadStyle.visibility, "visible", "RELOAD is visible");
|
||||
|
||||
let uri = gCurrentTest._tab.browser.currentURI.spec;
|
||||
let uri = gCurrentTest._currentTab.browser.currentURI.spec;
|
||||
is(uri, testURL_02, "URL Matches newly created Tab");
|
||||
|
||||
// Go back in session
|
||||
gCurrentTest._tab.browser.goBack();
|
||||
gCurrentTest._currentTab.browser.goBack();
|
||||
|
||||
// Wait for the tab to load, then do the test
|
||||
waitFor(gCurrentTest.onPageBack, pageLoaded(testURL_01));
|
||||
@ -144,31 +143,31 @@ gTests.push({
|
||||
onPageBack: function() {
|
||||
// Test back button state
|
||||
let back = document.getElementById("tool-back");
|
||||
is(back.disabled, !gCurrentTest._tab.browser.canGoBack, "Back button check");
|
||||
is(back.disabled, !gCurrentTest._currentTab.browser.canGoBack, "Back button check");
|
||||
|
||||
// Test forward button state
|
||||
let forward = document.getElementById("tool-forward");
|
||||
is(forward.disabled, !gCurrentTest._tab.browser.canGoForward, "Forward button check");
|
||||
is(forward.disabled, !gCurrentTest._currentTab.browser.canGoForward, "Forward button check");
|
||||
|
||||
Browser.closeTab(gCurrentTest._currentTab);
|
||||
|
||||
Browser.closeTab(gCurrentTest._tab);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Case: Loading a page into the URLBar with GO button
|
||||
gTests.push({
|
||||
desc: "Loading a page into the URLBar with GO button",
|
||||
_tab: null,
|
||||
_currentTab: null,
|
||||
|
||||
run: function() {
|
||||
this._tab = Browser.addTab(testURL_01, true);
|
||||
this._currentTab = Browser.addTab(testURL_01, true);
|
||||
|
||||
// Wait for the tab to load, then do the test
|
||||
waitFor(gCurrentTest.onPageReady, pageLoaded(testURL_01));
|
||||
},
|
||||
|
||||
|
||||
onPageReady: function() {
|
||||
let urlIcons = document.getElementById("urlbar-icons");
|
||||
is(urlIcons.getAttribute("mode"), "view", "URL Mode is set to 'view'");
|
||||
@ -180,7 +179,7 @@ gTests.push({
|
||||
// Wait for the awesomebar to load, then do the test
|
||||
window.addEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
},
|
||||
|
||||
|
||||
onFocusReady: function() {
|
||||
window.removeEventListener("popupshown", gCurrentTest.onFocusReady, false);
|
||||
let urlIcons = document.getElementById("urlbar-icons");
|
||||
@ -223,10 +222,10 @@ gTests.push({
|
||||
let reloadStyle = window.getComputedStyle(reload, null);
|
||||
is(reloadStyle.visibility, "visible", "RELOAD is visible");
|
||||
|
||||
let uri = gCurrentTest._tab.browser.currentURI.spec;
|
||||
let uri = gCurrentTest._currentTab.browser.currentURI.spec;
|
||||
is(uri, testURL_02, "URL Matches newly created Tab");
|
||||
|
||||
Browser.closeTab(gCurrentTest._tab);
|
||||
Browser.closeTab(gCurrentTest._currentTab);
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user