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/public/cpp/config.h" | 9 #include "ash/public/cpp/config.h" |
10 #include "ash/shelf/wm_shelf.h" | 10 #include "ash/shelf/shelf.h" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
12 #include "ash/test/ash_test_base.h" | 12 #include "ash/test/ash_test_base.h" |
13 #include "ash/test/shelf_button_pressed_metric_tracker_test_api.h" | 13 #include "ash/test/shelf_button_pressed_metric_tracker_test_api.h" |
14 #include "ash/test/shelf_view_test_api.h" | 14 #include "ash/test/shelf_view_test_api.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/test/histogram_tester.h" | 16 #include "base/test/histogram_tester.h" |
17 #include "base/test/simple_test_tick_clock.h" | 17 #include "base/test/simple_test_tick_clock.h" |
18 #include "base/test/user_action_tester.h" | 18 #include "base/test/user_action_tester.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "ui/events/event.h" | 20 #include "ui/events/event.h" |
(...skipping 78 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 WmShelf* wm_shelf = GetPrimaryShelf(); | 109 Shelf* shelf = GetPrimaryShelf(); |
110 ShelfViewTestAPI shelf_view_test_api(wm_shelf->GetShelfViewForTesting()); | 110 ShelfViewTestAPI shelf_view_test_api(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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 histogram_tester.ExpectTotalCount( | 308 histogram_tester.ExpectTotalCount( |
309 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); | 309 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); |
310 histogram_tester.ExpectBucketCount( | 310 histogram_tester.ExpectBucketCount( |
311 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, | 311 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, |
312 kTimeDeltaInMilliseconds, 1); | 312 kTimeDeltaInMilliseconds, 1); |
313 } | 313 } |
314 | 314 |
315 } // namespace test | 315 } // namespace test |
316 } // namespace ash | 316 } // namespace ash |
OLD | NEW |