Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/test/data/webui/md_history/history_metrics_test.js

Issue 2643533003: MD History: Use one-way binding for history query state. (Closed)
Patch Set: Remove wrapper function Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 var histogram = histogramMap['History.HistoryPageView']; 69 var histogram = histogramMap['History.HistoryPageView'];
70 assertEquals(1, histogram[HistoryPageViewHistogram.HISTORY]); 70 assertEquals(1, histogram[HistoryPageViewHistogram.HISTORY]);
71 71
72 app.selectedPage_ = 'syncedTabs'; 72 app.selectedPage_ = 'syncedTabs';
73 assertEquals(1, histogram[HistoryPageViewHistogram.SIGNIN_PROMO]); 73 assertEquals(1, histogram[HistoryPageViewHistogram.SIGNIN_PROMO]);
74 updateSignInState(true); 74 updateSignInState(true);
75 return PolymerTest.flushTasks().then(() => { 75 return PolymerTest.flushTasks().then(() => {
76 assertEquals(1, histogram[HistoryPageViewHistogram.SYNCED_TABS]); 76 assertEquals(1, histogram[HistoryPageViewHistogram.SYNCED_TABS]);
77 app.selectedPage_ = 'history'; 77 app.selectedPage_ = 'history';
78 assertEquals(2, histogram[HistoryPageViewHistogram.HISTORY]); 78 assertEquals(2, histogram[HistoryPageViewHistogram.HISTORY]);
79 app.set('queryState_.range', HistoryRange.WEEK); 79 app.fire('change-query', {range: HistoryRange.WEEK});
80 assertEquals(1, histogram[HistoryPageViewHistogram.GROUPED_WEEK]); 80 assertEquals(1, histogram[HistoryPageViewHistogram.GROUPED_WEEK]);
81 app.set('queryState_.range', HistoryRange.MONTH); 81 app.fire('change-query', {range: HistoryRange.MONTH});
82 assertEquals(1, histogram[HistoryPageViewHistogram.GROUPED_MONTH]); 82 assertEquals(1, histogram[HistoryPageViewHistogram.GROUPED_MONTH]);
83 }); 83 });
84 }); 84 });
85 85
86 test('history-list', function() { 86 test('history-list', function() {
87 var historyEntry = 87 var historyEntry =
88 createHistoryEntry('2015-01-01', 'http://www.google.com'); 88 createHistoryEntry('2015-01-01', 'http://www.google.com');
89 historyEntry.starred = true; 89 historyEntry.starred = true;
90 app.historyResult(createHistoryInfo(), [ 90 app.historyResult(createHistoryInfo(), [
91 createHistoryEntry('2015-01-01', 'http://www.example.com'), 91 createHistoryEntry('2015-01-01', 'http://www.example.com'),
92 historyEntry 92 historyEntry
93 ]); 93 ]);
94 94
95 return PolymerTest.flushTasks().then(() => { 95 return PolymerTest.flushTasks().then(() => {
96 var items = polymerSelectAll( 96 var items = polymerSelectAll(
97 app.$.history.$['infinite-list'], 'history-item'); 97 app.$.history.$['infinite-list'], 'history-item');
98 MockInteractions.tap(items[1].$$('#bookmark-star')); 98 MockInteractions.tap(items[1].$$('#bookmark-star'));
99 assertEquals(1, actionMap['BookmarkStarClicked']); 99 assertEquals(1, actionMap['BookmarkStarClicked']);
100 MockInteractions.tap(items[1].$.title); 100 MockInteractions.tap(items[1].$.title);
101 assertEquals(1, actionMap['EntryLinkClick']); 101 assertEquals(1, actionMap['EntryLinkClick']);
102 assertEquals(1, histogramMap['HistoryPage.ClickPosition'][1]); 102 assertEquals(1, histogramMap['HistoryPage.ClickPosition'][1]);
103 assertEquals(1, histogramMap['HistoryPage.ClickPositionSubset'][1]); 103 assertEquals(1, histogramMap['HistoryPage.ClickPositionSubset'][1]);
104 104
105 app.set('queryState_.searchTerm', 'goog'); 105 app.fire('change-query', {search: 'goog'});
106 assertEquals(1, actionMap['Search']); 106 assertEquals(1, actionMap['Search']);
107 app.set('queryState_.incremental', true); 107 app.set('queryState_.incremental', true);
108 app.historyResult(createHistoryInfo('goog'), [ 108 app.historyResult(createHistoryInfo('goog'), [
109 createHistoryEntry('2015-01-01', 'http://www.google.com'), 109 createHistoryEntry('2015-01-01', 'http://www.google.com'),
110 createHistoryEntry('2015-01-01', 'http://www.google.com'), 110 createHistoryEntry('2015-01-01', 'http://www.google.com'),
111 createHistoryEntry('2015-01-01', 'http://www.google.com') 111 createHistoryEntry('2015-01-01', 'http://www.google.com')
112 ]); 112 ]);
113 return PolymerTest.flushTasks(); 113 return PolymerTest.flushTasks();
114 }).then(() => { 114 }).then(() => {
115 items = polymerSelectAll( 115 items = polymerSelectAll(
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 assertEquals(1, histogram[SyncedTabsHistogram.OPEN_ALL]); 192 assertEquals(1, histogram[SyncedTabsHistogram.OPEN_ALL]);
193 193
194 MockInteractions.tap(menuButton); 194 MockInteractions.tap(menuButton);
195 return PolymerTest.flushTasks(); 195 return PolymerTest.flushTasks();
196 }).then(() => { 196 }).then(() => {
197 MockInteractions.tap(app.$$('#synced-devices').$$('#menuDeleteButton')); 197 MockInteractions.tap(app.$$('#synced-devices').$$('#menuDeleteButton'));
198 assertEquals(1, histogram[SyncedTabsHistogram.HIDE_FOR_NOW]); 198 assertEquals(1, histogram[SyncedTabsHistogram.HIDE_FOR_NOW]);
199 }); 199 });
200 }); 200 });
201 }); 201 });
OLDNEW
« no previous file with comments | « chrome/test/data/webui/md_history/history_list_test.js ('k') | chrome/test/data/webui/md_history/history_routing_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698