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 "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" | 5 #include "chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 base::MessageLoop message_loop_; | 35 base::MessageLoop message_loop_; |
36 | 36 |
37 // Dummy screen required by a ChromeBrowserMainExtraPartsMetrics test target. | 37 // Dummy screen required by a ChromeBrowserMainExtraPartsMetrics test target. |
38 gfx::test::TestScreen test_screen_; | 38 gfx::test::TestScreen test_screen_; |
39 | 39 |
40 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetricsTest); | 40 DISALLOW_COPY_AND_ASSIGN(ChromeBrowserMainExtraPartsMetricsTest); |
41 }; | 41 }; |
42 | 42 |
43 ChromeBrowserMainExtraPartsMetricsTest::ChromeBrowserMainExtraPartsMetricsTest() | 43 ChromeBrowserMainExtraPartsMetricsTest::ChromeBrowserMainExtraPartsMetricsTest() |
44 : device_data_manager_test_api_() { | 44 : device_data_manager_test_api_() { |
45 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, &test_screen_); | 45 gfx::Screen::SetScreenInstance(&test_screen_); |
46 } | 46 } |
47 | 47 |
48 ChromeBrowserMainExtraPartsMetricsTest:: | 48 ChromeBrowserMainExtraPartsMetricsTest:: |
49 ~ChromeBrowserMainExtraPartsMetricsTest() { | 49 ~ChromeBrowserMainExtraPartsMetricsTest() { |
50 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, nullptr); | 50 gfx::Screen::SetScreenInstance(nullptr); |
51 } | 51 } |
52 | 52 |
53 // Verify a TouchEventsEnabled value isn't recorded during construction. | 53 // Verify a TouchEventsEnabled value isn't recorded during construction. |
54 TEST_F(ChromeBrowserMainExtraPartsMetricsTest, | 54 TEST_F(ChromeBrowserMainExtraPartsMetricsTest, |
55 VerifyTouchEventsEnabledIsNotRecordedAfterConstruction) { | 55 VerifyTouchEventsEnabledIsNotRecordedAfterConstruction) { |
56 base::HistogramTester histogram_tester; | 56 base::HistogramTester histogram_tester; |
57 ChromeBrowserMainExtraPartsMetrics test_target; | 57 ChromeBrowserMainExtraPartsMetrics test_target; |
58 histogram_tester.ExpectTotalCount(kTouchEventsEnabledHistogramName, 0); | 58 histogram_tester.ExpectTotalCount(kTouchEventsEnabledHistogramName, 0); |
59 } | 59 } |
60 | 60 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 TEST_F(ChromeBrowserMainExtraPartsMetricsTest, | 117 TEST_F(ChromeBrowserMainExtraPartsMetricsTest, |
118 VerifyTouchEventsEnabledIsRecordedAfterPostBrowserStart) { | 118 VerifyTouchEventsEnabledIsRecordedAfterPostBrowserStart) { |
119 base::HistogramTester histogram_tester; | 119 base::HistogramTester histogram_tester; |
120 ChromeBrowserMainExtraPartsMetrics test_target; | 120 ChromeBrowserMainExtraPartsMetrics test_target; |
121 | 121 |
122 test_target.PostBrowserStart(); | 122 test_target.PostBrowserStart(); |
123 histogram_tester.ExpectTotalCount(kTouchEventsEnabledHistogramName, 1); | 123 histogram_tester.ExpectTotalCount(kTouchEventsEnabledHistogramName, 1); |
124 } | 124 } |
125 | 125 |
126 #endif // defined(USE_OZONE) || defined(USE_X11) | 126 #endif // defined(USE_OZONE) || defined(USE_X11) |
OLD | NEW |