Bug 1288885: Migrate bookmarks mochitests to xpcshell. r=aswan

MozReview-Commit-ID: 9PFJcqXXxhU

--HG--
rename : toolkit/components/extensions/test/mochitest/test_ext_bookmarks.html => browser/components/extensions/test/xpcshell/test_ext_bookmarks.js
extra : source : 8c67ff2971ecc155ce26dc5d9905c5de7e4bfd4b
This commit is contained in:
Kris Maglione 2016-07-22 17:29:52 -07:00
parent 4a132af371
commit f6052f7eae
4 changed files with 8 additions and 23 deletions

View File

@ -1,16 +1,5 @@
<!DOCTYPE HTML>
<html>
<head>
<title>WebExtension test</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
function backgroundScript() {
@ -276,13 +265,13 @@ function backgroundScript() {
return browser.bookmarks.search("Menu Item");
}).then(results => {
browser.test.assertEq(1, results.length, "Expected number of results returned for menu item search");
checkBookmark({title: "Menu Item", url: "http://menu.org/", index: 3, parentId: bookmarkGuids.menuGuid}, results[0]);
checkBookmark({title: "Menu Item", url: "http://menu.org/", index: 0, parentId: bookmarkGuids.menuGuid}, results[0]);
// finds toolbar items
return browser.bookmarks.search("Toolbar Item");
}).then(results => {
browser.test.assertEq(1, results.length, "Expected number of results returned for toolbar item search");
checkBookmark({title: "Toolbar Item", url: "http://toolbar.org/", index: 2, parentId: bookmarkGuids.toolbarGuid}, results[0]);
checkBookmark({title: "Toolbar Item", url: "http://toolbar.org/", index: 0, parentId: bookmarkGuids.toolbarGuid}, results[0]);
// finds folders
return browser.bookmarks.search("Mozilla Folder");
@ -389,7 +378,7 @@ function backgroundScript() {
return browser.bookmarks.move(corporationBookmark.id, {parentId: bookmarkGuids.menuGuid});
}).then(result => {
browser.test.assertEq(bookmarkGuids.menuGuid, result.parentId, "Bookmark has the expected parent");
browser.test.assertEq(childCount + 1, result.index, "Bookmark has the expected index");
browser.test.assertEq(childCount, result.index, "Bookmark has the expected index");
return browser.bookmarks.move(corporationBookmark.id, {index: 1});
}).then(result => {
@ -490,8 +479,3 @@ add_task(function* test_contentscript() {
yield extension.awaitFinish("bookmarks");
yield extension.unload();
});
</script>
</body>
</html>

View File

@ -3,4 +3,5 @@ head = head.js
tail =
firefox-appdir = browser
[test_ext_bookmarks.js]
[test_ext_manifest_commands.js]

View File

@ -75,8 +75,6 @@ skip-if = (os == 'android' || buildapp == 'b2g') # sender.tab is undefined on b2
[test_ext_storage_tab.html]
skip-if = os == 'android' # Android does not currently support tabs.
[test_ext_cookies.html]
[test_ext_bookmarks.html]
skip-if = (os == 'android' || buildapp == 'b2g') # unimplemented api. Bug 1258975 on android.
[test_ext_background_window_properties.html]
[test_ext_background_sub_windows.html]
[test_ext_background_api_injection.html]

View File

@ -8,6 +8,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "Extension",
"resource://gre/modules/Extension.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionData",
"resource://gre/modules/Extension.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionManagement",
"resource://gre/modules/ExtensionManagement.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ExtensionTestUtils",
"resource://testing-common/ExtensionXPCShellUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",