1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/places/tests/unit/test_425563.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,71 @@ 1.4 +/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +function run_test() 1.11 +{ 1.12 + run_next_test(); 1.13 +} 1.14 + 1.15 +add_task(function test_execute() 1.16 +{ 1.17 + let count_visited_URIs = ["http://www.test-link.com/", 1.18 + "http://www.test-typed.com/", 1.19 + "http://www.test-bookmark.com/", 1.20 + "http://www.test-redirect-permanent.com/", 1.21 + "http://www.test-redirect-temporary.com/"]; 1.22 + 1.23 + let notcount_visited_URIs = ["http://www.test-embed.com/", 1.24 + "http://www.test-download.com/", 1.25 + "http://www.test-framed.com/"]; 1.26 + 1.27 + // add visits, one for each transition type 1.28 + yield promiseAddVisits([ 1.29 + { uri: uri("http://www.test-link.com/"), 1.30 + transition: TRANSITION_LINK }, 1.31 + { uri: uri("http://www.test-typed.com/"), 1.32 + transition: TRANSITION_TYPED }, 1.33 + { uri: uri("http://www.test-bookmark.com/"), 1.34 + transition: TRANSITION_BOOKMARK }, 1.35 + { uri: uri("http://www.test-embed.com/"), 1.36 + transition: TRANSITION_EMBED }, 1.37 + { uri: uri("http://www.test-framed.com/"), 1.38 + transition: TRANSITION_FRAMED_LINK }, 1.39 + { uri: uri("http://www.test-redirect-permanent.com/"), 1.40 + transition: TRANSITION_REDIRECT_PERMANENT }, 1.41 + { uri: uri("http://www.test-redirect-temporary.com/"), 1.42 + transition: TRANSITION_REDIRECT_TEMPORARY }, 1.43 + { uri: uri("http://www.test-download.com/"), 1.44 + transition: TRANSITION_DOWNLOAD }, 1.45 + ]); 1.46 + 1.47 + // check that all links are marked as visited 1.48 + count_visited_URIs.forEach(function (visited_uri) { 1.49 + do_check_true(yield promiseIsURIVisited(uri(visited_uri))); 1.50 + }); 1.51 + notcount_visited_URIs.forEach(function (visited_uri) { 1.52 + do_check_true(yield promiseIsURIVisited(uri(visited_uri))); 1.53 + }); 1.54 + 1.55 + // check that visit_count does not take in count embed and downloads 1.56 + // maxVisits query are directly binded to visit_count 1.57 + let options = PlacesUtils.history.getNewQueryOptions(); 1.58 + options.sortingMode = options.SORT_BY_VISITCOUNT_DESCENDING; 1.59 + options.resultType = options.RESULTS_AS_VISIT; 1.60 + options.includeHidden = true; 1.61 + let query = PlacesUtils.history.getNewQuery(); 1.62 + query.minVisits = 1; 1.63 + let root = PlacesUtils.history.executeQuery(query, options).root; 1.64 + 1.65 + root.containerOpen = true; 1.66 + let cc = root.childCount; 1.67 + do_check_eq(cc, count_visited_URIs.length); 1.68 + 1.69 + for (let i = 0; i < cc; i++) { 1.70 + let node = root.getChild(i); 1.71 + do_check_neq(count_visited_URIs.indexOf(node.uri), -1); 1.72 + } 1.73 + root.containerOpen = false; 1.74 +});