OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // History api test for Chrome. | |
6 // browser_tests --gtest_filter=HistoryExtensionApiTest.GetMostVisited | |
7 | |
8 // runHistoryTestFns is defined in ./common.js . | |
9 | |
10 var regex_urls = [ | |
11 /chrome-extension\:\/\/[a-p]{32}\/test1.html/, | |
12 /chrome-extension\:\/\/[a-p]{32}\/test2.html/, | |
13 /chrome-extension\:\/\/[a-p]{32}\/test3.html/, | |
14 /chrome-extension\:\/\/[a-p]{32}\/get_most_visited.html/ | |
15 ]; | |
16 | |
17 var titles = [ | |
18 "Test1", | |
19 "Test2", | |
20 "Test3", | |
21 "Get Most Visited" | |
22 ]; | |
23 | |
24 | |
25 runHistoryTestFns([ | |
26 function getMostVisitedAll() { | |
27 chrome.history.getMostVisited({'maxResults':100}, function(items) { | |
28 assertEq(4, items.length); | |
29 for (var i = 0; i< items.length; i++) { | |
30 assertTrue(regex_urls[i].test(items[i].url)); | |
31 assertEq(titles[i], items[i].title); | |
32 assertEq(items[i].redirects.length, 1); | |
Aaron Boodman
2012/03/20 02:24:24
In unit testing asserts that have two terms, the e
| |
33 } | |
34 chrome.test.succeed(); | |
35 }); | |
36 | |
37 chrome.history.getMostVisited({'maxResults':2}, function(items) { | |
38 assertEq(2, items.length); | |
39 for (var i = 0; i< items.length; i++) { | |
40 assertTrue(regex_urls[i].test(items[i].url)); | |
41 assertEq(titles[i], items[i].title); | |
42 assertEq(items[i].redirects.length, 1); | |
43 } | |
44 chrome.test.succeed(); | |
45 }); | |
46 } | |
47 ]); | |
OLD | NEW |