OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 /** @const */ var TOTAL_RESULT_COUNT = 160; | 5 /** @const */ var TOTAL_RESULT_COUNT = 160; |
6 /** @const */ var WAIT_TIMEOUT = 200; | 6 /** @const */ var WAIT_TIMEOUT = 200; |
7 | 7 |
8 /** | 8 /** |
9 * Create a fake history result with the given timestamp. | 9 * Create a fake history result with the given timestamp. |
10 * @param {Number} timestamp Timestamp of the entry, in ms since the epoch. | 10 * @param {Number} timestamp Timestamp of the entry, in ms since the epoch. |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 }, | 133 }, |
134 | 134 |
135 /** | 135 /** |
136 * Stub for the 'queryHistory' message to the history backend. | 136 * Stub for the 'queryHistory' message to the history backend. |
137 * Simulates a history database using the fake history data that is | 137 * Simulates a history database using the fake history data that is |
138 * initialized in preLoad(). | 138 * initialized in preLoad(). |
139 * @param {Array} arguments The original arguments to queryHistory. | 139 * @param {Array} arguments The original arguments to queryHistory. |
140 */ | 140 */ |
141 queryHistoryStub_: function(args) { | 141 queryHistoryStub_: function(args) { |
142 var searchText = args[0]; | 142 var searchText = args[0]; |
143 var range = args[1] | 143 var offset = args[1]; |
144 var cursor = args[2]; | 144 var range = args[2]; |
145 var maxCount = args[3]; | 145 var cursor = args[3]; |
| 146 var maxCount = args[4]; |
146 | 147 |
147 var resultCount = Math.min(maxCount, this.fakeHistory_.length - cursor); | 148 var resultCount = Math.min(maxCount, this.fakeHistory_.length - cursor); |
148 var results = this.fakeHistory_.slice(cursor, cursor + resultCount); | 149 var results = this.fakeHistory_.slice(cursor, cursor + resultCount); |
149 var newCursor = cursor + results.length; | 150 var newCursor = cursor + results.length; |
150 | 151 |
151 callFrontendAsync( | 152 callFrontendAsync( |
152 'historyResult', | 153 'historyResult', |
153 { | 154 { |
154 term: searchText, | 155 term: searchText, |
155 finished: newCursor >= this.fakeHistory_.length, | 156 finished: newCursor >= this.fakeHistory_.length, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 var nextEntry = document.querySelectorAll('.title a')[3]; | 309 var nextEntry = document.querySelectorAll('.title a')[3]; |
309 removeButton.click(); | 310 removeButton.click(); |
310 waitForCallback('historyResult', function() { | 311 waitForCallback('historyResult', function() { |
311 // The next entry after the deleted ones should now be the first. | 312 // The next entry after the deleted ones should now be the first. |
312 expectEquals(document.querySelector('.title a').textContent, | 313 expectEquals(document.querySelector('.title a').textContent, |
313 nextEntry.textContent); | 314 nextEntry.textContent); |
314 testDone(); | 315 testDone(); |
315 }); | 316 }); |
316 }); | 317 }); |
317 }); | 318 }); |
OLD | NEW |