michael@0: /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /** michael@0: * Adds a test URI visit to history. michael@0: * michael@0: * @param aURI michael@0: * The URI to add a visit for. michael@0: * @param aReferrer michael@0: * The referring URI for the given URI. This can be null. michael@0: */ michael@0: function add_visit(aURI, aDayOffset, aTransition) { michael@0: yield promiseAddVisits({ michael@0: uri: aURI, michael@0: transition: aTransition, michael@0: visitDate: (Date.now() + aDayOffset*86400000) * 1000 michael@0: }); michael@0: } michael@0: michael@0: function run_test() michael@0: { michael@0: run_next_test(); michael@0: } michael@0: michael@0: add_task(function test_execute() michael@0: { michael@0: yield add_visit(uri("http://mirror1.mozilla.com/a"), -1, TRANSITION_LINK); michael@0: yield add_visit(uri("http://mirror2.mozilla.com/b"), -2, TRANSITION_LINK); michael@0: yield add_visit(uri("http://mirror3.mozilla.com/c"), -4, TRANSITION_FRAMED_LINK); michael@0: yield add_visit(uri("http://mirror1.google.com/b"), -1, TRANSITION_EMBED); michael@0: yield add_visit(uri("http://mirror2.google.com/a"), -2, TRANSITION_LINK); michael@0: yield add_visit(uri("http://mirror1.apache.org/b"), -3, TRANSITION_LINK); michael@0: yield add_visit(uri("http://mirror2.apache.org/a"), -4, TRANSITION_FRAMED_LINK); michael@0: michael@0: let queries = [ michael@0: PlacesUtils.history.getNewQuery(), michael@0: PlacesUtils.history.getNewQuery() michael@0: ]; michael@0: queries[0].domain = "mozilla.com"; michael@0: queries[1].domain = "google.com"; michael@0: michael@0: let root = PlacesUtils.history.executeQueries( michael@0: queries, queries.length, PlacesUtils.history.getNewQueryOptions() michael@0: ).root; michael@0: root.containerOpen = true; michael@0: let childCount = root.childCount; michael@0: root.containerOpen = false; michael@0: michael@0: do_check_eq(childCount, 3); michael@0: });