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

Side by Side Diff: ash/shelf/shelf_button_pressed_metric_tracker_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 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
« no previous file with comments | « no previous file | ash/test/task_switch_time_tracker_test_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "ash/shelf/shelf_button_pressed_metric_tracker.h" 5 #include "ash/shelf/shelf_button_pressed_metric_tracker.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "ash/shelf/shelf.h" 9 #include "ash/shelf/shelf.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void ShelfButtonPressedMetricTrackerTest::SetUp() { 111 void ShelfButtonPressedMetricTrackerTest::SetUp() {
112 AshTestBase::SetUp(); 112 AshTestBase::SetUp();
113 113
114 Shelf* shelf = Shelf::ForPrimaryDisplay(); 114 Shelf* shelf = Shelf::ForPrimaryDisplay();
115 ShelfViewTestAPI shelf_view_test_api(ShelfTestAPI(shelf).shelf_view()); 115 ShelfViewTestAPI shelf_view_test_api(ShelfTestAPI(shelf).shelf_view());
116 116
117 metric_tracker_ = shelf_view_test_api.shelf_button_pressed_metric_tracker(); 117 metric_tracker_ = shelf_view_test_api.shelf_button_pressed_metric_tracker();
118 118
119 ShelfButtonPressedMetricTrackerTestAPI test_api(metric_tracker_); 119 ShelfButtonPressedMetricTrackerTestAPI test_api(metric_tracker_);
120 120
121 scoped_ptr<base::TickClock> test_tick_clock(new base::SimpleTestTickClock()); 121 // Ensure the TickClock->NowTicks() doesn't return base::TimeTicks because
122 // ShelfButtonPressedMetricTracker interprets that value as unset.
123 scoped_ptr<base::TickClock> test_tick_clock(new base::SimpleTestTickClock(
124 base::TimeTicks() + base::TimeDelta::FromMilliseconds(100)));
122 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get()); 125 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get());
123 test_api.SetTickClock(std::move(test_tick_clock)); 126 test_api.SetTickClock(std::move(test_tick_clock));
124
125 // Ensure the TickClock->NowTicks() doesn't return base::TimeTicks because
126 // ShelfButtonPressedMetricTracker interprets that value as unset.
127 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(100));
128 } 127 }
129 128
130 void ShelfButtonPressedMetricTrackerTest::TearDown() { 129 void ShelfButtonPressedMetricTrackerTest::TearDown() {
131 tick_clock_ = nullptr; 130 tick_clock_ = nullptr;
132 131
133 AshTestBase::TearDown(); 132 AshTestBase::TearDown();
134 } 133 }
135 134
136 void ShelfButtonPressedMetricTrackerTest::ButtonPressed( 135 void ShelfButtonPressedMetricTrackerTest::ButtonPressed(
137 const ui::Event& event) { 136 const ui::Event& event) {
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 291
293 histogram_tester.ExpectTotalCount( 292 histogram_tester.ExpectTotalCount(
294 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); 293 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1);
295 histogram_tester.ExpectBucketCount( 294 histogram_tester.ExpectBucketCount(
296 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 295 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName,
297 kTimeDeltaInMilliseconds, 1); 296 kTimeDeltaInMilliseconds, 1);
298 } 297 }
299 298
300 } // namespace test 299 } // namespace test
301 } // namespace ash 300 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/test/task_switch_time_tracker_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698