OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 /** | 6 /** |
7 * @fileoverview Tests the local NTP. | 7 * @fileoverview Tests the local NTP. |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 /** | 80 /** |
81 * Tests that non-Google NTPs do not show a fakebox. | 81 * Tests that non-Google NTPs do not show a fakebox. |
82 */ | 82 */ |
83 function testDoesNotShowFakeboxIfNotGoogle() { | 83 function testDoesNotShowFakeboxIfNotGoogle() { |
84 var localNTP = LocalNTP(); | 84 var localNTP = LocalNTP(); |
85 configData.isGooglePage = false; | 85 configData.isGooglePage = false; |
86 localNTP.init(); | 86 localNTP.init(); |
87 assert(!$('fakebox')); | 87 assert(!$('fakebox')); |
88 assert(!$('logo')); | 88 assert(!$('logo')); |
89 } | 89 } |
| 90 |
| 91 |
| 92 /** |
| 93 * Tests that clicking on a Most Visited link calls navigateContentWindow. |
| 94 */ |
| 95 function testMostVisitedLinkCallsNavigateContentWindow() { |
| 96 var ntpHandle = chrome.embeddedSearch.newTabPage; |
| 97 var originalNavigateContentWindow = ntpHandle.navigateContentWindow; |
| 98 |
| 99 var navigateContentWindowCalls = 0; |
| 100 ntpHandle.navigateContentWindow = function() { |
| 101 navigateContentWindowCalls++; |
| 102 } |
| 103 |
| 104 var params = {}; |
| 105 var href = 'file:///some/local/file'; |
| 106 var title = 'Title'; |
| 107 var text = 'text'; |
| 108 var provider = 'foobar'; |
| 109 var link = createMostVisitedLink(params, href, title, text, provider); |
| 110 |
| 111 link.click(); |
| 112 |
| 113 ntpHandle.navigateContentWindow = originalNavigateContentWindow; |
| 114 assert(navigateContentWindowCalls > 0); |
| 115 } |
OLD | NEW |