Commits

Virgil Dupras  committed d5530dc Draft

Added automated tests for bug #801415

  • Participants
  • Parent commits 2704e44

Comments (0)

Files changed (3)

File toolkit/components/places/tests/unit/bug801450.html

+<!DOCTYPE NETSCAPE-Bookmark-file-1>
+	<HTML>
+	<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
+	<Title>Bookmarks</Title>
+	<H1>Bookmarks</H1>
+    <DT><H3>Subtitle</H3>
+	<DL><p>
+		<DT><A HREF="http://www.mozilla.org/">Mozilla</A>
+    </DL><p>
+</HTML>

File toolkit/components/places/tests/unit/test_801450.js

+/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* 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/. */
+
+// Get Services
+Cu.import("resource://gre/modules/BookmarkHTMLUtils.jsm");
+
+function run_test() {
+    do_test_pending();
+    var bookmarksFile = do_get_file("bug801450.html");
+    try {
+        BookmarkHTMLUtils.importFromFile(bookmarksFile, true, after_import);
+    } catch(ex) { do_throw("couldn't import bookmarks file: " + ex); }
+}
+
+function after_import(success) {
+    do_check_true(success);
+    root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
+    root.containerOpen = true;
+    do_check_eq(root.childCount, 1);
+    var folder = root.getChild(0);
+    folder = folder.QueryInterface(Ci.nsINavHistoryContainerResultNode);
+    folder.containerOpen = true;
+    do_check_eq(folder.title, "Subtitle");
+    do_check_eq(folder.childCount, 1);
+    var bookmark = folder.getChild(0);
+    do_check_eq(bookmark.uri, "http://www.mozilla.org/")
+    do_check_eq(bookmark.title, "Mozilla")
+    do_test_finished();
+}

File toolkit/components/places/tests/unit/xpcshell.ini

 [test_485442_crash_bug_nsNavHistoryQuery_GetUri.js]
 [test_486978_sort_by_date_queries.js]
 [test_536081.js]
+[test_801450.js]
 [test_adaptive.js]
 # Bug 676989: test hangs consistently on Android
 skip-if = os == "android"