OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 cr.define('md_history.history_list_test', function() { | 5 cr.define('md_history.history_list_test', function() { |
6 function registerTests() { | 6 function registerTests() { |
7 suite('history-list', function() { | 7 suite('history-list', function() { |
8 var app; | 8 var app; |
9 var element; | 9 var element; |
10 var toolbar; | 10 var toolbar; |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); | 260 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
261 | 261 |
262 // Confirmation dialog should appear. | 262 // Confirmation dialog should appear. |
263 assertTrue(listContainer.$.dialog.opened); | 263 assertTrue(listContainer.$.dialog.opened); |
264 | 264 |
265 app.set('queryState_.searchTerm', 'something else'); | 265 app.set('queryState_.searchTerm', 'something else'); |
266 assertFalse(listContainer.$.dialog.opened); | 266 assertFalse(listContainer.$.dialog.opened); |
267 }); | 267 }); |
268 }); | 268 }); |
269 | 269 |
270 test('clicking file:// url sends message to chrome', function(done) { | |
271 var fileURL = 'file:///home/myfile'; | |
272 app.historyResult(createHistoryInfo(), [ | |
273 createHistoryEntry('2016-03-15', fileURL), | |
274 ]); | |
275 flush().then(function() { | |
276 var items = | |
277 Polymer.dom(element.root).querySelectorAll('history-item'); | |
278 | |
279 registerMessageCallback('navigateToUrl', this, function(info) { | |
Dan Beam
2016/08/02 06:02:43
registerMessageCallback() is a bummer. didn't kno
calamity
2016/08/08 05:06:43
Any alternatives?
Dan Beam
2016/08/08 21:27:59
don't call chrome.send() directly from your code.
| |
280 assertEquals(fileURL, info[0]); | |
281 done(); | |
282 }); | |
283 | |
284 MockInteractions.tap(items[0].$.title); | |
285 }); | |
286 }); | |
287 | |
270 teardown(function() { | 288 teardown(function() { |
271 element.historyData_ = []; | 289 element.historyData_ = []; |
272 registerMessageCallback('removeVisits', this, undefined); | 290 registerMessageCallback('removeVisits', this, undefined); |
273 registerMessageCallback('queryHistory', this, function() {}); | 291 registerMessageCallback('queryHistory', this, function() {}); |
292 registerMessageCallback('navigateToUrl', this, function() {}); | |
Dan Beam
2016/08/02 06:02:43
why is this necessary?
calamity
2016/08/08 05:06:43
undefined would work here too. We need to tear dow
| |
274 app.queryState_.queryingDisabled = true; | 293 app.queryState_.queryingDisabled = true; |
275 app.set('queryState_.searchTerm', ''); | 294 app.set('queryState_.searchTerm', ''); |
276 return flush(); | 295 return flush(); |
277 }); | 296 }); |
278 }); | 297 }); |
279 } | 298 } |
280 return { | 299 return { |
281 registerTests: registerTests | 300 registerTests: registerTests |
282 }; | 301 }; |
283 }); | 302 }); |
OLD | NEW |