Chromium Code Reviews| 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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..051e686d87a490a1a9ab0e12c09eef68f4b43c7a |
| --- /dev/null |
| +++ b/chrome/test/data/webui/md_history/history_metrics_test.js |
| @@ -0,0 +1,41 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +cr.define('md_history.history_metrics_test', function() { |
| + function registerTests() { |
| + suite('Metrics', function() { |
| + test('History.HistoryView', function() { |
| + var app = $('history-app'); |
| + app.grouped_ = true; |
| + |
| + var histogram = window.histogramMap['History.HistoryView']; |
| + assertEquals(1, histogram[HistoryViewHistogram.HISTORY]); |
| + |
| + app.selectedPage_ = 'syncedTabs'; |
| + return waitForAnimationFrame().then(() => { |
| + assertEquals(1, histogram[HistoryViewHistogram.SIGNIN_PROMO]); |
| + updateSignInState(true); |
| + return waitForAnimationFrame(); |
|
tsergeant
2016/08/15 07:05:18
waitForAnimationFrame is very specific. Does flush
calamity
2016/08/17 03:15:29
flush() doesn't seem to work. Since HistoryView is
|
| + }).then(() => { |
| + assertEquals(1, histogram[HistoryViewHistogram.SYNCED_TABS]); |
| + app.selectedPage_ = 'history'; |
| + return waitForAnimationFrame(); |
| + }).then(() => { |
| + assertEquals(2, histogram[HistoryViewHistogram.HISTORY]); |
| + app.set('queryState_.range', HistoryRange.WEEK); |
| + return waitForAnimationFrame(); |
| + }).then(() => { |
| + assertEquals(1, histogram[HistoryViewHistogram.GROUPED_WEEK]); |
| + app.set('queryState_.range', HistoryRange.MONTH); |
| + return waitForAnimationFrame(); |
| + }).then(() => { |
| + assertEquals(1, histogram[HistoryViewHistogram.GROUPED_MONTH]); |
| + }); |
| + }); |
| + }); |
| + } |
| + return { |
| + registerTests: registerTests |
| + }; |
| +}); |