| 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_toolbar_test', function() { | 5 cr.define('md_history.history_toolbar_test', function() { |
| 6 function registerTests() { | 6 function registerTests() { |
| 7 suite('history-toolbar', function() { | 7 suite('history-toolbar', function() { |
| 8 var app; | 8 var app; |
| 9 var element; | 9 var element; |
| 10 var toolbar; | 10 var toolbar; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 test('search term gathered correctly from toolbar', function(done) { | 45 test('search term gathered correctly from toolbar', function(done) { |
| 46 app.queryingDisabled_ = false; | 46 app.queryingDisabled_ = false; |
| 47 registerMessageCallback('queryHistory', this, function (info) { | 47 registerMessageCallback('queryHistory', this, function (info) { |
| 48 assertEquals(info[0], 'Test'); | 48 assertEquals(info[0], 'Test'); |
| 49 done(); | 49 done(); |
| 50 }); | 50 }); |
| 51 | 51 |
| 52 toolbar.onSearch('Test'); | 52 toolbar.onSearch('Test'); |
| 53 }); | 53 }); |
| 54 | 54 |
| 55 test('more from this site sends and sets correct data', function(done) { | |
| 56 app.queryingDisabled_ = false; | |
| 57 registerMessageCallback('queryHistory', this, function (info) { | |
| 58 assertEquals('example.com', info[0]); | |
| 59 flush().then(function() { | |
| 60 assertEquals( | |
| 61 'example.com', | |
| 62 toolbar.$['main-toolbar'].getSearchField().getValue()); | |
| 63 done(); | |
| 64 }); | |
| 65 }); | |
| 66 | |
| 67 element.$.sharedMenu.itemData = {domain: 'example.com'}; | |
| 68 MockInteractions.tap(element.$.menuMoreButton); | |
| 69 }); | |
| 70 | |
| 71 teardown(function() { | 55 teardown(function() { |
| 72 element.historyData_ = []; | 56 element.historyData_ = []; |
| 73 element.searchedTerm = ''; | 57 element.searchedTerm = ''; |
| 74 registerMessageCallback('queryHistory', this, undefined); | 58 registerMessageCallback('queryHistory', this, undefined); |
| 75 toolbar.count = 0; | 59 toolbar.count = 0; |
| 76 }); | 60 }); |
| 77 }); | 61 }); |
| 78 } | 62 } |
| 79 return { | 63 return { |
| 80 registerTests: registerTests | 64 registerTests: registerTests |
| 81 }; | 65 }; |
| 82 }); | 66 }); |
| OLD | NEW |