| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 return PolymerTest.flushTasks(); | 144 return PolymerTest.flushTasks(); |
| 145 }).then(() => { | 145 }).then(() => { |
| 146 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPosition'][0]); | 146 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPosition'][0]); |
| 147 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPositionSubset'][0]); | 147 assertEquals(1, histogramMap['HistoryPage.RemoveEntryPositionSubset'][0]); |
| 148 }); | 148 }); |
| 149 }); | 149 }); |
| 150 | 150 |
| 151 test('synced-device-manager', function() { | 151 test('synced-device-manager', function() { |
| 152 app.selectedPage_ = 'syncedTabs'; | 152 app.selectedPage_ = 'syncedTabs'; |
| 153 var histogram; | 153 var histogram; |
| 154 var menuButton; |
| 154 return PolymerTest.flushTasks().then(() => { | 155 return PolymerTest.flushTasks().then(() => { |
| 155 histogram = histogramMap[SYNCED_TABS_HISTOGRAM_NAME]; | 156 histogram = histogramMap[SYNCED_TABS_HISTOGRAM_NAME]; |
| 156 assertEquals(1, histogram[SyncedTabsHistogram.INITIALIZED]); | 157 assertEquals(1, histogram[SyncedTabsHistogram.INITIALIZED]); |
| 157 | 158 |
| 158 var sessionList = [ | 159 var sessionList = [ |
| 159 createSession( | 160 createSession( |
| 160 'Nexus 5', | 161 'Nexus 5', |
| 161 [createWindow(['http://www.google.com', 'http://example.com'])] | 162 [createWindow(['http://www.google.com', 'http://example.com'])] |
| 162 ), | 163 ), |
| 163 createSession( | 164 createSession( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 176 }).then(() => { | 177 }).then(() => { |
| 177 cards = polymerSelectAll( | 178 cards = polymerSelectAll( |
| 178 app.$$('#synced-devices'), 'history-synced-device-card'); | 179 app.$$('#synced-devices'), 'history-synced-device-card'); |
| 179 MockInteractions.tap(cards[0].$['card-heading']); | 180 MockInteractions.tap(cards[0].$['card-heading']); |
| 180 assertEquals(1, histogram[SyncedTabsHistogram.COLLAPSE_SESSION]); | 181 assertEquals(1, histogram[SyncedTabsHistogram.COLLAPSE_SESSION]); |
| 181 MockInteractions.tap(cards[0].$['card-heading']); | 182 MockInteractions.tap(cards[0].$['card-heading']); |
| 182 assertEquals(1, histogram[SyncedTabsHistogram.EXPAND_SESSION]); | 183 assertEquals(1, histogram[SyncedTabsHistogram.EXPAND_SESSION]); |
| 183 MockInteractions.tap(polymerSelectAll(cards[0], '.website-title')[0]); | 184 MockInteractions.tap(polymerSelectAll(cards[0], '.website-title')[0]); |
| 184 assertEquals(1, histogram[SyncedTabsHistogram.LINK_CLICKED]); | 185 assertEquals(1, histogram[SyncedTabsHistogram.LINK_CLICKED]); |
| 185 | 186 |
| 186 MockInteractions.tap(cards[0].$['menu-button']); | 187 menuButton = cards[0].$['menu-button']; |
| 188 MockInteractions.tap(menuButton); |
| 187 return PolymerTest.flushTasks(); | 189 return PolymerTest.flushTasks(); |
| 188 }).then(() => { | 190 }).then(() => { |
| 189 MockInteractions.tap(app.$$('#synced-devices').$$('#menuOpenButton')); | 191 MockInteractions.tap(app.$$('#synced-devices').$$('#menuOpenButton')); |
| 190 assertEquals(1, histogram[SyncedTabsHistogram.OPEN_ALL]); | 192 assertEquals(1, histogram[SyncedTabsHistogram.OPEN_ALL]); |
| 191 | 193 |
| 194 MockInteractions.tap(menuButton); |
| 195 return PolymerTest.flushTasks(); |
| 196 }).then(() => { |
| 192 MockInteractions.tap(app.$$('#synced-devices').$$('#menuDeleteButton')); | 197 MockInteractions.tap(app.$$('#synced-devices').$$('#menuDeleteButton')); |
| 193 assertEquals(1, histogram[SyncedTabsHistogram.HIDE_FOR_NOW]); | 198 assertEquals(1, histogram[SyncedTabsHistogram.HIDE_FOR_NOW]); |
| 194 }); | 199 }); |
| 195 }); | 200 }); |
| 196 }); | 201 }); |
| OLD | NEW |