Bug 1347427 - Remove intermittent browser_bug248970.js test, cause it's not testing anything useful. r=standard8 draft
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 17 Jul 2017 21:59:41 +0200
changeset 610009 2f31ead6fc3f4d025296e1e409421558d410a6c7
parent 609768 d43779e278d2e4d3e21dba2fcb585a3bf4b1288e
child 637734 9e1c39d21e65c72d25b6b69f9c317315173a9e6e
push id68753
push usermak77@bonardo.net
push dateMon, 17 Jul 2017 20:00:48 +0000
reviewersstandard8
bugs1347427, 248970
milestone56.0a1
Bug 1347427 - Remove intermittent browser_bug248970.js test, cause it's not testing anything useful. r=standard8 MozReview-Commit-ID: 6P6UixK13Ns
toolkit/components/places/tests/browser/browser.ini
toolkit/components/places/tests/browser/browser_bug248970.js
--- a/toolkit/components/places/tests/browser/browser.ini
+++ b/toolkit/components/places/tests/browser/browser.ini
@@ -1,17 +1,16 @@
 [DEFAULT]
 support-files =
   colorAnalyzer/category-discover.png
   colorAnalyzer/dictionaryGeneric-16.png
   colorAnalyzer/extensionGeneric-16.png
   colorAnalyzer/localeGeneric.png
   head.js
 
-[browser_bug248970.js]
 [browser_bug399606.js]
 [browser_bug461710.js]
 [browser_bug646422.js]
 [browser_bug680727.js]
 [browser_colorAnalyzer.js]
 [browser_double_redirect.js]
 [browser_favicon_privatebrowsing_perwindowpb.js]
 [browser_favicon_setAndFetchFaviconForPage.js]
deleted file mode 100644
--- a/toolkit/components/places/tests/browser/browser_bug248970.js
+++ /dev/null
@@ -1,152 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-// This test performs checks on the history testing area as outlined
-// https://wiki.mozilla.org/Firefox3.1/PrivateBrowsing/TestPlan#History
-// http://developer.mozilla.org/en/Using_the_Places_history_service
-
-var visitedURIs = [
-  "http://www.test-link.com/",
-  "http://www.test-typed.com/",
-  "http://www.test-bookmark.com/",
-  "http://www.test-redirect-permanent.com/",
-  "http://www.test-redirect-temporary.com/",
-  "http://www.test-embed.com/",
-  "http://www.test-framed.com/",
-  "http://www.test-download.com/"
-].map(NetUtil.newURI.bind(NetUtil));
-
-add_task(async function() {
-  let windowsToClose = [];
-  let placeItemsCount = 0;
-
-  registerCleanupFunction(function() {
-    windowsToClose.forEach(function(win) {
-      win.close();
-    });
-  });
-
-  await PlacesTestUtils.clearHistory();
-
-   // Ensure we wait for the default bookmarks import.
-  await new Promise(resolve => {
-    waitForCondition(() => {
-      placeItemsCount = getPlacesItemsCount();
-      return placeItemsCount > 0
-    }, resolve, "Should have default bookmarks")
-  });
-
-  // Create a handful of history items with various visit types
-  await PlacesTestUtils.addVisits([
-    { uri: visitedURIs[0], transition: TRANSITION_LINK },
-    { uri: visitedURIs[1], transition: TRANSITION_TYPED },
-    { uri: visitedURIs[2], transition: TRANSITION_BOOKMARK },
-    { uri: visitedURIs[3], transition: TRANSITION_REDIRECT_PERMANENT },
-    { uri: visitedURIs[4], transition: TRANSITION_REDIRECT_TEMPORARY },
-    { uri: visitedURIs[5], transition: TRANSITION_EMBED },
-    { uri: visitedURIs[6], transition: TRANSITION_FRAMED_LINK },
-    { uri: visitedURIs[7], transition: TRANSITION_DOWNLOAD }
-  ]);
-
-  placeItemsCount += 7;
-  // We added 7 new items to history.
-  is(getPlacesItemsCount(), placeItemsCount,
-     "Check the total items count");
-
-  async function testOnWindow(aIsPrivate, aCount) {
-    let win = await new Promise(resolve => {
-      whenNewWindowLoaded({ private: aIsPrivate }, resolve);
-    });
-    windowsToClose.push(win);
-
-    // History items should be retrievable by query
-    await checkHistoryItems();
-
-    // Updates the place items count
-    let count = getPlacesItemsCount();
-
-    // Create Bookmark
-    let title = "title " + windowsToClose.length;
-    let keyword = "keyword " + windowsToClose.length;
-    let url = "http://test-a-" + windowsToClose.length + ".com/";
-
-    await PlacesUtils.bookmarks.insert({ url, title,
-                                         parentGuid: PlacesUtils.bookmarks.menuGuid });
-    await PlacesUtils.keywords.insert({ url, keyword });
-    count++;
-
-    ok((await PlacesUtils.bookmarks.fetch({ url })),
-       "Bookmark should be bookmarked, data should be retrievable");
-    is(getPlacesItemsCount(), count,
-       "Check the new bookmark items count");
-    is(isBookmarkAltered(), false, "Check if bookmark has been visited");
-  }
-
-  // Test on windows.
-  await testOnWindow(false);
-  await testOnWindow(true);
-  await testOnWindow(false);
-});
-
-/**
- * Function performs a really simple query on our places entries,
- * and makes sure that the number of entries equal num_places_entries.
- */
-function getPlacesItemsCount() {
-  // Get bookmarks count
-  let options = PlacesUtils.history.getNewQueryOptions();
-  options.includeHidden = true;
-  options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
-  let root = PlacesUtils.history.executeQuery(
-    PlacesUtils.history.getNewQuery(), options).root;
-  root.containerOpen = true;
-  let cc = root.childCount;
-  root.containerOpen = false;
-
-  // Get history item count
-  options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_HISTORY;
-  root = PlacesUtils.history.executeQuery(
-    PlacesUtils.history.getNewQuery(), options).root;
-  root.containerOpen = true;
-  cc += root.childCount;
-  root.containerOpen = false;
-
-  return cc;
-}
-
-async function checkHistoryItems() {
-  for (let i = 0; i < visitedURIs.length; i++) {
-    let visitedUri = visitedURIs[i];
-    ok((await promiseIsURIVisited(visitedUri)), "");
-    if (/embed/.test(visitedUri.spec)) {
-      is((await PlacesTestUtils.isPageInDB(visitedUri)), false, "Check if URI is in database");
-    } else {
-      ok((await PlacesTestUtils.isPageInDB(visitedUri)), "Check if URI is in database");
-    }
-  }
-}
-
-/**
- * Function attempts to check if Bookmark-A has been visited
- * during private browsing mode, function should return false
- *
- * @returns false if the accessCount has not changed
- *          true if the accessCount has changed
- */
-function isBookmarkAltered() {
-  let options = PlacesUtils.history.getNewQueryOptions();
-  options.queryType = Ci.nsINavHistoryQueryOptions.QUERY_TYPE_BOOKMARKS;
-  options.maxResults = 1; // should only expect a new bookmark
-
-  let query = PlacesUtils.history.getNewQuery();
-  query.setFolders([PlacesUtils.bookmarks.bookmarksMenuFolder], 1);
-
-  let root = PlacesUtils.history.executeQuery(query, options).root;
-  root.containerOpen = true;
-  is(root.childCount, options.maxResults, "Check new bookmarks results");
-  let node = root.getChild(0);
-  root.containerOpen = false;
-
-  return (node.accessCount != 0);
-}