Bug 446171 - Part 2: Add a browser test for bookmark all tabs; r=mak

MozReview-Commit-ID: Ga64MDyDEyB

--HG--
extra : rebase_source : 92754b332f6ad60e894acc728ad1e6f6d337d550
extra : histedit_source : 12af32a436e541b03b1455f34aa8acfdba5ce94f
This commit is contained in:
Scott Wu 2016-04-15 08:14:59 +08:00
parent ca33d182f4
commit 3fbc24f182
4 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Bookmark Dummy 1</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
</head>
<body>
<p>Bookmark Dummy 1</p>
</body>
</html>

View File

@ -0,0 +1,9 @@
<html>
<head>
<title>Bookmark Dummy 2</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
</head>
<body>
<p>Bookmark Dummy 2</p>
</body>
</html>

View File

@ -51,3 +51,7 @@ skip-if = true # temporarily disabled for breaking the treeview - bug 658744
[browser_toolbar_migration.js]
[browser_toolbarbutton_menu_context.js]
[browser_views_liveupdate.js]
[browser_bookmark_all_tabs.js]
support-files =
bookmark_dummy_1.html
bookmark_dummy_2.html

View File

@ -0,0 +1,37 @@
/**
* Test for Bug 446171 - Name field of bookmarks saved via 'Bookmark All Tabs'
* has '(null)' value if history is disabled or just in private browsing mode
*/
"use strict"
add_task(function* () {
const BASE_URL = "http://example.org/browser/browser/components/places/tests/browser/";
const TEST_PAGES = [
BASE_URL + "bookmark_dummy_1.html",
BASE_URL + "bookmark_dummy_2.html",
BASE_URL + "bookmark_dummy_1.html"
];
function promiseAddTab(url) {
return BrowserTestUtils.openNewForegroundTab(gBrowser, url);
}
let tabs = yield Promise.all(TEST_PAGES.map(promiseAddTab));
let URIs = PlacesCommandHook.uniqueCurrentPages;
is(URIs.length, 3, "Only unique pages are returned");
Assert.deepEqual(URIs.map(URI => URI.uri.spec), [
"about:blank",
BASE_URL + "bookmark_dummy_1.html",
BASE_URL + "bookmark_dummy_2.html"
], "Correct URIs are returned");
Assert.deepEqual(URIs.map(URI => URI.title), [
"", "Bookmark Dummy 1", "Bookmark Dummy 2"
], "Correct titles are returned");
registerCleanupFunction(function* () {
yield Promise.all(tabs.map(BrowserTestUtils.removeTab));
});
});