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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); | 299 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
300 | 300 |
301 // Confirmation dialog should appear. | 301 // Confirmation dialog should appear. |
302 assertTrue(listContainer.$.dialog.open); | 302 assertTrue(listContainer.$.dialog.open); |
303 | 303 |
304 app.set('queryState_.searchTerm', 'something else'); | 304 app.set('queryState_.searchTerm', 'something else'); |
305 assertFalse(listContainer.$.dialog.open); | 305 assertFalse(listContainer.$.dialog.open); |
306 }); | 306 }); |
307 }); | 307 }); |
308 | 308 |
| 309 test('clicking file:// url sends message to chrome', function(done) { |
| 310 var fileURL = 'file:///home/myfile'; |
| 311 app.historyResult(createHistoryInfo(), [ |
| 312 createHistoryEntry('2016-03-15', fileURL), |
| 313 ]); |
| 314 flush().then(function() { |
| 315 var items = |
| 316 Polymer.dom(element.root).querySelectorAll('history-item'); |
| 317 |
| 318 registerMessageCallback('navigateToUrl', this, function(info) { |
| 319 assertEquals(fileURL, info[0]); |
| 320 done(); |
| 321 }); |
| 322 |
| 323 MockInteractions.tap(items[0].$.title); |
| 324 }); |
| 325 }); |
| 326 |
309 teardown(function() { | 327 teardown(function() { |
310 element.historyData_ = []; | 328 element.historyData_ = []; |
311 registerMessageCallback('removeVisits', this, undefined); | 329 registerMessageCallback('removeVisits', this, undefined); |
312 registerMessageCallback('queryHistory', this, function() {}); | 330 registerMessageCallback('queryHistory', this, function() {}); |
| 331 registerMessageCallback('navigateToUrl', this, undefined); |
313 app.queryState_.queryingDisabled = true; | 332 app.queryState_.queryingDisabled = true; |
314 app.set('queryState_.searchTerm', ''); | 333 app.set('queryState_.searchTerm', ''); |
315 return flush(); | 334 return flush(); |
316 }); | 335 }); |
317 }); | 336 }); |
318 } | 337 } |
319 return { | 338 return { |
320 registerTests: registerTests | 339 registerTests: registerTests |
321 }; | 340 }; |
322 }); | 341 }); |
OLD | NEW |