toolkit/components/places/tests/queries/test_excludeReadOnlyFolders.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim:set ts=2 sw=2 sts=2 et: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 // The test data for our database, note that the ordering of the results that
     8 // will be returned by the query (the isInQuery: true objects) is IMPORTANT.
     9 // see compareArrayToResult in head_queries.js for more info.
    10 var testData = [
    11   // Normal folder
    12   { isInQuery: true, isFolder: true, title: "Folder 1",
    13     parentFolder: PlacesUtils.toolbarFolderId },
    15   // Read only folder
    16   { isInQuery: false, isFolder: true, title: "Folder 2 RO",
    17     parentFolder: PlacesUtils.toolbarFolderId, readOnly: true }
    18 ];
    20 function run_test()
    21 {
    22   run_next_test();
    23 }
    25 add_task(function test_excludeReadOnlyFolders()
    26 {
    27   yield task_populateDB(testData);
    29   var query = PlacesUtils.history.getNewQuery();
    30   query.setFolders([PlacesUtils.toolbarFolderId], 1);
    32   // Options
    33   var options = PlacesUtils.history.getNewQueryOptions();
    34   options.excludeQueries = true;
    35   options.excludeReadOnlyFolders = true;
    37   // Results
    38   var result = PlacesUtils.history.executeQuery(query, options);
    39   var root = result.root;
    40   root.containerOpen = true;
    42   displayResultSet(root);
    43   // The readonly folder should not be in our result set.
    44   do_check_eq(1, root.childCount);
    45   do_check_eq("Folder 1", root.getChild(0).title);
    47   root.containerOpen = false;
    48 });

mercurial