| 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 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @extends {md_history.BrowserService} | 7 * @extends {md_history.BrowserService} |
| 8 */ | 8 */ |
| 9 var TestMetricsBrowserService = function() { | 9 var TestMetricsBrowserService = function() { |
| 10 this.histogramMap = {}; | 10 this.histogramMap = {}; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 test('history-list', function() { | 82 test('history-list', function() { |
| 83 var historyEntry = | 83 var historyEntry = |
| 84 createHistoryEntry('2015-01-01', 'http://www.google.com'); | 84 createHistoryEntry('2015-01-01', 'http://www.google.com'); |
| 85 historyEntry.starred = true; | 85 historyEntry.starred = true; |
| 86 app.historyResult(createHistoryInfo(), [ | 86 app.historyResult(createHistoryInfo(), [ |
| 87 createHistoryEntry('2015-01-01', 'http://www.example.com'), | 87 createHistoryEntry('2015-01-01', 'http://www.example.com'), |
| 88 historyEntry | 88 historyEntry |
| 89 ]); | 89 ]); |
| 90 | 90 |
| 91 return PolymerTest.flushTasks().then(() => { | 91 return PolymerTest.flushTasks().then(() => { |
| 92 var items = polymerSelectAll( | 92 var items = polymerSelectAll(app.$.history, 'history-item'); |
| 93 app.$.history.$['infinite-list'], 'history-item'); | |
| 94 MockInteractions.tap(items[1].$$('#bookmark-star')); | 93 MockInteractions.tap(items[1].$$('#bookmark-star')); |
| 95 assertEquals(1, actionMap['BookmarkStarClicked']); | 94 assertEquals(1, actionMap['BookmarkStarClicked']); |
| 96 MockInteractions.tap(items[1].$.title); | 95 MockInteractions.tap(items[1].$.title); |
| 97 assertEquals(1, actionMap['EntryLinkClick']); | 96 assertEquals(1, actionMap['EntryLinkClick']); |
| 98 assertEquals(1, histogramMap['HistoryPage.ClickPosition'][1]); | 97 assertEquals(1, histogramMap['HistoryPage.ClickPosition'][1]); |
| 99 assertEquals(1, histogramMap['HistoryPage.ClickPositionSubset'][1]); | 98 assertEquals(1, histogramMap['HistoryPage.ClickPositionSubset'][1]); |
| 100 | 99 |
| 101 app.fire('change-query', {search: 'goog'}); | 100 app.fire('change-query', {search: 'goog'}); |
| 102 assertEquals(1, actionMap['Search']); | 101 assertEquals(1, actionMap['Search']); |
| 103 app.set('queryState_.incremental', true); | 102 app.set('queryState_.incremental', true); |
| 104 app.historyResult(createHistoryInfo('goog'), [ | 103 app.historyResult(createHistoryInfo('goog'), [ |
| 105 createHistoryEntry('2015-01-01', 'http://www.google.com'), | 104 createHistoryEntry('2015-01-01', 'http://www.google.com'), |
| 106 createHistoryEntry('2015-01-01', 'http://www.google.com'), | 105 createHistoryEntry('2015-01-01', 'http://www.google.com'), |
| 107 createHistoryEntry('2015-01-01', 'http://www.google.com') | 106 createHistoryEntry('2015-01-01', 'http://www.google.com') |
| 108 ]); | 107 ]); |
| 109 return PolymerTest.flushTasks(); | 108 return PolymerTest.flushTasks(); |
| 110 }).then(() => { | 109 }).then(() => { |
| 111 items = polymerSelectAll( | 110 items = polymerSelectAll(app.$.history, 'history-item'); |
| 112 app.$.history.$['infinite-list'], 'history-item'); | |
| 113 MockInteractions.tap(items[0].$.title); | 111 MockInteractions.tap(items[0].$.title); |
| 114 assertEquals(1, actionMap['SearchResultClick']); | 112 assertEquals(1, actionMap['SearchResultClick']); |
| 115 assertEquals(1, histogramMap['HistoryPage.ClickPosition'][0]); | 113 assertEquals(1, histogramMap['HistoryPage.ClickPosition'][0]); |
| 116 assertEquals(1, histogramMap['HistoryPage.ClickPositionSubset'][0]); | 114 assertEquals(1, histogramMap['HistoryPage.ClickPositionSubset'][0]); |
| 117 MockInteractions.tap(items[0].$.checkbox); | 115 MockInteractions.tap(items[0].$.checkbox); |
| 118 MockInteractions.tap(items[4].$.checkbox); | 116 MockInteractions.tap(items[4].$.checkbox); |
| 119 return PolymerTest.flushTasks(); | 117 return PolymerTest.flushTasks(); |
| 120 }).then(() => { | 118 }).then(() => { |
| 121 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); | 119 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
| 122 assertEquals(1, actionMap['RemoveSelected']); | 120 assertEquals(1, actionMap['RemoveSelected']); |
| 123 return PolymerTest.flushTasks(); | 121 return PolymerTest.flushTasks(); |
| 124 }).then(() => { | 122 }).then(() => { |
| 125 MockInteractions.tap(app.$.history.$$('.cancel-button')); | 123 MockInteractions.tap(app.$.history.$$('.cancel-button')); |
| 126 assertEquals(1, actionMap['CancelRemoveSelected']); | 124 assertEquals(1, actionMap['CancelRemoveSelected']); |
| 127 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); | 125 MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
| 128 return PolymerTest.flushTasks(); | 126 return PolymerTest.flushTasks(); |
| 129 }).then(() => { | 127 }).then(() => { |
| 130 MockInteractions.tap(app.$.history.$$('.action-button')); | 128 MockInteractions.tap(app.$.history.$$('.action-button')); |
| 131 assertEquals(1, actionMap['ConfirmRemoveSelected']); | 129 assertEquals(1, actionMap['ConfirmRemoveSelected']); |
| 132 return PolymerTest.flushTasks(); | 130 return PolymerTest.flushTasks(); |
| 133 }).then(() => { | 131 }).then(() => { |
| 134 items = polymerSelectAll( | 132 items = polymerSelectAll(app.$.history, 'history-item'); |
| 135 app.$.history.$['infinite-list'], 'history-item'); | |
| 136 MockInteractions.tap(items[0].$['menu-button']); | 133 MockInteractions.tap(items[0].$['menu-button']); |
| 137 return PolymerTest.flushTasks(); | 134 return PolymerTest.flushTasks(); |
| 138 }).then(() => { | 135 }).then(() => { |
| 139 MockInteractions.tap(app.$.history.$$('#menuRemoveButton')); | 136 MockInteractions.tap(app.$.history.$$('#menuRemoveButton')); |
| 140 return PolymerTest.flushTasks(); | 137 return PolymerTest.flushTasks(); |
| 141 }).then(() => { | 138 }).then(() => { |
| 142 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPosition'][0]); | 139 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPosition'][0]); |
| 143 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPositionSubset'][0]); | 140 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPositionSubset'][0]); |
| 144 }); | 141 }); |
| 145 }); | 142 }); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 assertEquals(1, histogram[SyncedTabsHistogram.OPEN_ALL]); | 185 assertEquals(1, histogram[SyncedTabsHistogram.OPEN_ALL]); |
| 189 | 186 |
| 190 MockInteractions.tap(menuButton); | 187 MockInteractions.tap(menuButton); |
| 191 return PolymerTest.flushTasks(); | 188 return PolymerTest.flushTasks(); |
| 192 }).then(() => { | 189 }).then(() => { |
| 193 MockInteractions.tap(app.$$('#synced-devices').$$('#menuDeleteButton')); | 190 MockInteractions.tap(app.$$('#synced-devices').$$('#menuDeleteButton')); |
| 194 assertEquals(1, histogram[SyncedTabsHistogram.HIDE_FOR_NOW]); | 191 assertEquals(1, histogram[SyncedTabsHistogram.HIDE_FOR_NOW]); |
| 195 }); | 192 }); |
| 196 }); | 193 }); |
| 197 }); | 194 }); |
| OLD | NEW |