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/common/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/common/shelf/wm_shelf.h" |
10 #include "ash/test/ash_test_base.h" | 10 #include "ash/test/ash_test_base.h" |
11 #include "ash/test/shelf_button_pressed_metric_tracker_test_api.h" | 11 #include "ash/test/shelf_button_pressed_metric_tracker_test_api.h" |
12 #include "ash/test/shelf_test_api.h" | 12 #include "ash/test/shelf_test_api.h" |
13 #include "ash/test/shelf_view_test_api.h" | 13 #include "ash/test/shelf_view_test_api.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/test/histogram_tester.h" | 15 #include "base/test/histogram_tester.h" |
16 #include "base/test/simple_test_tick_clock.h" | 16 #include "base/test/simple_test_tick_clock.h" |
17 #include "base/test/user_action_tester.h" | 17 #include "base/test/user_action_tester.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "ui/events/event.h" | 19 #include "ui/events/event.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 ShelfButtonPressedMetricTracker:: | 99 ShelfButtonPressedMetricTracker:: |
100 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName; | 100 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName; |
101 | 101 |
102 ShelfButtonPressedMetricTrackerTest::ShelfButtonPressedMetricTrackerTest() {} | 102 ShelfButtonPressedMetricTrackerTest::ShelfButtonPressedMetricTrackerTest() {} |
103 | 103 |
104 ShelfButtonPressedMetricTrackerTest::~ShelfButtonPressedMetricTrackerTest() {} | 104 ShelfButtonPressedMetricTrackerTest::~ShelfButtonPressedMetricTrackerTest() {} |
105 | 105 |
106 void ShelfButtonPressedMetricTrackerTest::SetUp() { | 106 void ShelfButtonPressedMetricTrackerTest::SetUp() { |
107 AshTestBase::SetUp(); | 107 AshTestBase::SetUp(); |
108 | 108 |
109 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 109 WmShelf* wm_shelf = GetPrimaryShelf(); |
110 ShelfViewTestAPI shelf_view_test_api(ShelfTestAPI(shelf).shelf_view()); | 110 ShelfViewTestAPI shelf_view_test_api(wm_shelf->GetShelfViewForTesting()); |
111 | 111 |
112 metric_tracker_ = shelf_view_test_api.shelf_button_pressed_metric_tracker(); | 112 metric_tracker_ = shelf_view_test_api.shelf_button_pressed_metric_tracker(); |
113 | 113 |
114 ShelfButtonPressedMetricTrackerTestAPI test_api(metric_tracker_); | 114 ShelfButtonPressedMetricTrackerTestAPI test_api(metric_tracker_); |
115 | 115 |
116 std::unique_ptr<base::TickClock> test_tick_clock( | 116 std::unique_ptr<base::TickClock> test_tick_clock( |
117 new base::SimpleTestTickClock()); | 117 new base::SimpleTestTickClock()); |
118 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get()); | 118 tick_clock_ = static_cast<base::SimpleTestTickClock*>(test_tick_clock.get()); |
119 test_api.SetTickClock(std::move(test_tick_clock)); | 119 test_api.SetTickClock(std::move(test_tick_clock)); |
120 | 120 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 histogram_tester.ExpectTotalCount( | 289 histogram_tester.ExpectTotalCount( |
290 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); | 290 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); |
291 histogram_tester.ExpectBucketCount( | 291 histogram_tester.ExpectBucketCount( |
292 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, | 292 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, |
293 kTimeDeltaInMilliseconds, 1); | 293 kTimeDeltaInMilliseconds, 1); |
294 } | 294 } |
295 | 295 |
296 } // namespace test | 296 } // namespace test |
297 } // namespace ash | 297 } // namespace ash |
OLD | NEW |