Index: chrome/test/data/webui/md_history/history_metrics_test.js |
diff --git a/chrome/test/data/webui/md_history/history_metrics_test.js b/chrome/test/data/webui/md_history/history_metrics_test.js |
index dbe008f74599e4664f3f54279608ddbe5e14d38c..fc10a03d538d6259c9acac58090402518f15d33c 100644 |
--- a/chrome/test/data/webui/md_history/history_metrics_test.js |
+++ b/chrome/test/data/webui/md_history/history_metrics_test.js |
@@ -6,13 +6,18 @@ cr.define('md_history.history_metrics_test', function() { |
function registerTests() { |
suite('Metrics', function() { |
- var browserService; |
var app; |
var histogramMap; |
+ var actionMap; |
+ |
+ suiteSetup(function() { |
+ disableLinkClicks(); |
+ }); |
setup(function() { |
PolymerTest.clearBody(); |
histogramMap = {}; |
+ actionMap = {}; |
/** |
* @constructor |
@@ -34,6 +39,19 @@ cr.define('md_history.history_metrics_test', function() { |
histogramMap[histogram][value] = 0; |
histogramMap[histogram][value]++; |
+ }, |
+ |
+ /** @override */ |
+ recordAction: function(action) { |
+ if (!(action in actionMap)) |
+ actionMap[action] = 0 |
+ |
+ actionMap[action]++; |
+ }, |
+ |
+ /** @override */ |
+ deleteItems: function() { |
+ return flush(); |
} |
}; |
@@ -64,6 +82,122 @@ cr.define('md_history.history_metrics_test', function() { |
assertEquals(1, histogram[HistoryViewHistogram.GROUPED_MONTH]); |
}); |
}); |
+ |
+ test('history-list', function() { |
+ var historyEntry = |
+ createHistoryEntry('2015-01-01', 'http://www.google.com'); |
+ historyEntry.starred = true; |
+ app.historyResult(createHistoryInfo(), [ |
+ createHistoryEntry('2015-01-01', 'http://www.example.com'), |
+ historyEntry |
+ ]); |
+ |
+ return flush().then(() => { |
+ var items = polymerSelectAll( |
+ app.$.history.$['infinite-list'], 'history-item'); |
+ MockInteractions.tap(items[1].$$('#bookmark-star')); |
+ assertEquals(1, actionMap['BookmarkStarClicked']); |
+ MockInteractions.tap(items[1].$.title); |
+ assertEquals(1, actionMap['EntryLinkClick']); |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.ClickPosition'][1]); |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.ClickPositionSubset'] |
+ [1]); |
+ |
+ app.set('queryState_.searchTerm', 'goog'); |
+ assertEquals(1, actionMap['Search']); |
+ app.historyResult(createHistoryInfo('goog'), [ |
+ createHistoryEntry('2015-01-01', 'http://www.google.com'), |
+ createHistoryEntry('2015-01-01', 'http://www.google.com'), |
+ createHistoryEntry('2015-01-01', 'http://www.google.com') |
+ ]); |
+ return flush(); |
+ }).then(() => { |
+ items = polymerSelectAll( |
+ app.$.history.$['infinite-list'], 'history-item'); |
+ MockInteractions.tap(items[0].$.title); |
+ assertEquals(1, actionMap['SearchResultClick']); |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.ClickPosition'][0]); |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.ClickPositionSubset'] |
+ [0]); |
+ MockInteractions.tap(items[0].$.checkbox); |
+ MockInteractions.tap(items[2].$.checkbox); |
+ return flush(); |
+ }).then(() => { |
+ MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
tsergeant
2016/08/18 04:14:34
You can check that RemoveSelected is recorded here
calamity
2016/08/19 13:59:44
Done.
|
+ return flush(); |
+ }).then(() => { |
+ MockInteractions.tap(app.$.history.$$('.cancel-button')); |
+ assertEquals(1, actionMap['CancelRemoveSelected']); |
+ MockInteractions.tap(app.$.toolbar.$$('#delete-button')); |
+ return flush(); |
+ }).then(() => { |
+ MockInteractions.tap(app.$.history.$$('.action-button')); |
+ assertEquals(1, actionMap['ConfirmRemoveSelected']); |
+ return flush(); |
+ }).then(() => { |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.RemoveEntryPosition'] |
+ [0]); |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.RemoveEntryPositionSubset'][0]); |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.RemoveEntryPosition'] |
+ [2]); |
+ assertEquals( |
+ 1, histogramMap['HistoryPage.RemoveEntryPositionSubset'][2]); |
+ }); |
+ }); |
+ |
+ test('synced-device-manager', function() { |
+ app.selectedPage_ = 'syncedTabs'; |
+ var histogram; |
+ return flush().then(() => { |
+ histogram = |
+ histogramMap[SYNCED_TABS_HISTOGRAM_NAME]; |
+ assertEquals(1, histogram[SyncedTabsHistogram.INITIALIZED]); |
+ |
+ var sessionList = [ |
+ createSession( |
+ 'Nexus 5', |
+ [createWindow(['http://www.google.com', 'http://example.com'])] |
+ ), |
+ createSession( |
+ 'Nexus 6', |
+ [ |
+ createWindow(['http://test.com']), |
+ createWindow(['http://www.gmail.com', 'http://badssl.com']) |
+ ] |
+ ), |
+ ]; |
+ setForeignSessions(sessionList, true); |
+ return flush(); |
+ }).then(() => { |
+ assertEquals(1, histogram[SyncedTabsHistogram.HAS_FOREIGN_DATA]); |
+ return flush(); |
+ }).then(() => { |
+ cards = polymerSelectAll( |
+ app.$$('#synced-devices'), 'history-synced-device-card'); |
+ MockInteractions.tap(cards[0].$['card-heading']); |
+ assertEquals(1, histogram[SyncedTabsHistogram.COLLAPSE_SESSION]); |
+ MockInteractions.tap(cards[0].$['card-heading']); |
+ assertEquals(1, histogram[SyncedTabsHistogram.EXPAND_SESSION]); |
+ MockInteractions.tap(polymerSelectAll(cards[0], '.website-title')[0]); |
+ assertEquals(1, histogram[SyncedTabsHistogram.LINK_CLICKED]); |
+ |
+ MockInteractions.tap(cards[0].$['menu-button']); |
+ return flush(); |
+ }).then(() => { |
+ MockInteractions.tap(app.$$('#synced-devices').$$('#open-all')); |
+ assertEquals(1, histogram[SyncedTabsHistogram.OPEN_ALL]); |
+ |
+ MockInteractions.tap(app.$$('#synced-devices').$$('#delete-session')); |
+ assertEquals(1, histogram[SyncedTabsHistogram.HIDE_FOR_NOW]); |
+ }); |
+ }); |
}); |
} |
return { |