Chromium Code Reviews| 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 element; | 8 var element; |
| 9 var toolbar; | 9 var toolbar; |
| 10 var TEST_HISTORY_RESULTS; | 10 var TEST_HISTORY_RESULTS; |
| (...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 registerMessageCallback('queryHistory', this, function (info) { | 46 registerMessageCallback('queryHistory', this, function (info) { |
| 47 assertEquals(info[0], 'Test'); | 47 assertEquals(info[0], 'Test'); |
| 48 done(); | 48 done(); |
| 49 }); | 49 }); |
| 50 | 50 |
| 51 toolbar.onSearch('Test'); | 51 toolbar.onSearch('Test'); |
| 52 }); | 52 }); |
| 53 | 53 |
| 54 test('more from this site sends and sets correct data', function(done) { | 54 test('more from this site sends and sets correct data', function(done) { |
| 55 registerMessageCallback('queryHistory', this, function (info) { | 55 registerMessageCallback('queryHistory', this, function (info) { |
|
dpapad
2016/05/18 23:39:13
FYI, we have established the "browser proxy" patte
tsergeant
2016/05/19 07:11:55
Cool, I'd be interested to know more.
| |
| 56 assertEquals(info[0], 'example.com'); | 56 assertEquals('example.com', info[0]); |
| 57 flush(function() { | 57 flush(function() { |
|
dpapad
2016/05/18 23:39:13
Unrelated to this CL, how about making flush() ret
tsergeant
2016/05/19 07:11:55
calamity@ and I talked about this yesterday, actua
| |
| 58 assertEquals(toolbar.$$('#search-input').$$('#search-input').value, | 58 assertEquals('example.com', toolbar.$['main-toolbar'].getValue()); |
| 59 'example.com'); | |
| 60 done(); | 59 done(); |
| 61 }); | 60 }); |
| 62 }); | 61 }); |
| 63 | 62 |
| 64 element.$.sharedMenu.itemData = {domain: 'example.com'}; | 63 element.$.sharedMenu.itemData = {domain: 'example.com'}; |
| 65 MockInteractions.tap(element.$.menuMoreButton); | 64 element.onMoreFromSiteTap_(); |
|
dpapad
2016/05/18 23:39:13
Simulating a tap action seems much better than cal
tsergeant
2016/05/19 07:11:55
In a previous version of this patch, simulating a
| |
| 66 }); | 65 }); |
| 67 | 66 |
| 68 teardown(function() { | 67 teardown(function() { |
| 69 element.historyData = []; | 68 element.historyData = []; |
| 70 registerMessageCallback('queryHistory', this, undefined); | 69 registerMessageCallback('queryHistory', this, undefined); |
| 71 toolbar.count = 0; | 70 toolbar.count = 0; |
| 72 }); | 71 }); |
| 73 }); | 72 }); |
| 74 } | 73 } |
| 75 return { | 74 return { |
| 76 registerTests: registerTests | 75 registerTests: registerTests |
| 77 }; | 76 }; |
| 78 }); | 77 }); |
| OLD | NEW |