| 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> |
| 8 |
| 7 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 8 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
| 9 #include "ash/test/shelf_button_pressed_metric_tracker_test_api.h" | 11 #include "ash/test/shelf_button_pressed_metric_tracker_test_api.h" |
| 10 #include "ash/test/shelf_test_api.h" | 12 #include "ash/test/shelf_test_api.h" |
| 11 #include "ash/test/shelf_view_test_api.h" | 13 #include "ash/test/shelf_view_test_api.h" |
| 12 #include "base/macros.h" | 14 #include "base/macros.h" |
| 13 #include "base/test/histogram_tester.h" | 15 #include "base/test/histogram_tester.h" |
| 14 #include "base/test/simple_test_tick_clock.h" | 16 #include "base/test/simple_test_tick_clock.h" |
| 15 #include "base/test/user_action_tester.h" | 17 #include "base/test/user_action_tester.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 113 |
| 112 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 114 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 113 ShelfViewTestAPI shelf_view_test_api(ShelfTestAPI(shelf).shelf_view()); | 115 ShelfViewTestAPI shelf_view_test_api(ShelfTestAPI(shelf).shelf_view()); |
| 114 | 116 |
| 115 metric_tracker_ = shelf_view_test_api.shelf_button_pressed_metric_tracker(); | 117 metric_tracker_ = shelf_view_test_api.shelf_button_pressed_metric_tracker(); |
| 116 | 118 |
| 117 ShelfButtonPressedMetricTrackerTestAPI test_api(metric_tracker_); | 119 ShelfButtonPressedMetricTrackerTestAPI test_api(metric_tracker_); |
| 118 | 120 |
| 119 scoped_ptr<base::TickClock> test_tick_clock(new base::SimpleTestTickClock()); | 121 scoped_ptr<base::TickClock> test_tick_clock(new base::SimpleTestTickClock()); |
| 120 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get()); | 122 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get()); |
| 121 test_api.SetTickClock(test_tick_clock.Pass()); | 123 test_api.SetTickClock(std::move(test_tick_clock)); |
| 122 | 124 |
| 123 // Ensure the TickClock->NowTicks() doesn't return base::TimeTicks because | 125 // Ensure the TickClock->NowTicks() doesn't return base::TimeTicks because |
| 124 // ShelfButtonPressedMetricTracker interprets that value as unset. | 126 // ShelfButtonPressedMetricTracker interprets that value as unset. |
| 125 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(100)); | 127 tick_clock_->Advance(base::TimeDelta::FromMilliseconds(100)); |
| 126 } | 128 } |
| 127 | 129 |
| 128 void ShelfButtonPressedMetricTrackerTest::TearDown() { | 130 void ShelfButtonPressedMetricTrackerTest::TearDown() { |
| 129 tick_clock_ = nullptr; | 131 tick_clock_ = nullptr; |
| 130 | 132 |
| 131 AshTestBase::TearDown(); | 133 AshTestBase::TearDown(); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 | 292 |
| 291 histogram_tester.ExpectTotalCount( | 293 histogram_tester.ExpectTotalCount( |
| 292 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); | 294 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); |
| 293 histogram_tester.ExpectBucketCount( | 295 histogram_tester.ExpectBucketCount( |
| 294 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, | 296 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, |
| 295 kTimeDeltaInMilliseconds, 1); | 297 kTimeDeltaInMilliseconds, 1); |
| 296 } | 298 } |
| 297 | 299 |
| 298 } // namespace test | 300 } // namespace test |
| 299 } // namespace ash | 301 } // namespace ash |
| OLD | NEW |