| OLD | NEW |
| 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 Loading... |
| 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 std::unique_ptr<base::TickClock> test_tick_clock( |
| 122 new base::SimpleTestTickClock()); |
| 122 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get()); | 123 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get()); |
| 123 test_api.SetTickClock(std::move(test_tick_clock)); | 124 test_api.SetTickClock(std::move(test_tick_clock)); |
| 124 | 125 |
| 125 // Ensure the TickClock->NowTicks() doesn't return base::TimeTicks because | 126 // Ensure the TickClock->NowTicks() doesn't return base::TimeTicks because |
| 126 // ShelfButtonPressedMetricTracker interprets that value as unset. | 127 // ShelfButtonPressedMetricTracker interprets that value as unset. |
| 127 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(100)); | 128 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(100)); |
| 128 } | 129 } |
| 129 | 130 |
| 130 void ShelfButtonPressedMetricTrackerTest::TearDown() { | 131 void ShelfButtonPressedMetricTrackerTest::TearDown() { |
| 131 tick_clock_ = nullptr; | 132 tick_clock_ = nullptr; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 293 |
| 293 histogram_tester.ExpectTotalCount( | 294 histogram_tester.ExpectTotalCount( |
| 294 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); | 295 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); |
| 295 histogram_tester.ExpectBucketCount( | 296 histogram_tester.ExpectBucketCount( |
| 296 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, | 297 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, |
| 297 kTimeDeltaInMilliseconds, 1); | 298 kTimeDeltaInMilliseconds, 1); |
| 298 } | 299 } |
| 299 | 300 |
| 300 } // namespace test | 301 } // namespace test |
| 301 } // namespace ash | 302 } // namespace ash |
| OLD | NEW |