Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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 /**
8 * Adds a test URI visit to history.
9 *
10 * @param aURI
11 * The URI to add a visit for.
12 * @param aReferrer
13 * The referring URI for the given URI. This can be null.
14 */
15 function add_visit(aURI, aDayOffset, aTransition) {
16 yield promiseAddVisits({
17 uri: aURI,
18 transition: aTransition,
19 visitDate: (Date.now() + aDayOffset*86400000) * 1000
20 });
21 }
23 function run_test()
24 {
25 run_next_test();
26 }
28 add_task(function test_execute()
29 {
30 yield add_visit(uri("http://mirror1.mozilla.com/a"), -1, TRANSITION_LINK);
31 yield add_visit(uri("http://mirror2.mozilla.com/b"), -2, TRANSITION_LINK);
32 yield add_visit(uri("http://mirror3.mozilla.com/c"), -4, TRANSITION_FRAMED_LINK);
33 yield add_visit(uri("http://mirror1.google.com/b"), -1, TRANSITION_EMBED);
34 yield add_visit(uri("http://mirror2.google.com/a"), -2, TRANSITION_LINK);
35 yield add_visit(uri("http://mirror1.apache.org/b"), -3, TRANSITION_LINK);
36 yield add_visit(uri("http://mirror2.apache.org/a"), -4, TRANSITION_FRAMED_LINK);
38 let queries = [
39 PlacesUtils.history.getNewQuery(),
40 PlacesUtils.history.getNewQuery()
41 ];
42 queries[0].domain = "mozilla.com";
43 queries[1].domain = "google.com";
45 let root = PlacesUtils.history.executeQueries(
46 queries, queries.length, PlacesUtils.history.getNewQueryOptions()
47 ).root;
48 root.containerOpen = true;
49 let childCount = root.childCount;
50 root.containerOpen = false;
52 do_check_eq(childCount, 3);
53 });