OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h" | 5 #include "ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/prefs/pref_registry_simple.h" | |
11 #include "base/prefs/testing_pref_service.h" | |
12 #include "components/metrics/metrics_pref_names.h" | 10 #include "components/metrics/metrics_pref_names.h" |
| 11 #include "components/prefs/pref_registry_simple.h" |
| 12 #include "components/prefs/testing_pref_service.h" |
13 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" | 13 #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" |
14 #include "ios/chrome/test/testing_application_context.h" | 14 #include "ios/chrome/test/testing_application_context.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 | 16 |
17 class IOSChromeMetricsServiceAccessorTest : public testing::Test { | 17 class IOSChromeMetricsServiceAccessorTest : public testing::Test { |
18 public: | 18 public: |
19 IOSChromeMetricsServiceAccessorTest() {} | 19 IOSChromeMetricsServiceAccessorTest() {} |
20 | 20 |
21 PrefService* GetLocalState() { return local_state_.Get(); } | 21 PrefService* GetLocalState() { return local_state_.Get(); } |
22 | 22 |
(...skipping 26 matching lines...) Expand all Loading... |
49 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); | 49 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); |
50 GetLocalState()->SetBoolean(pref, true); | 50 GetLocalState()->SetBoolean(pref, true); |
51 EXPECT_FALSE( | 51 EXPECT_FALSE( |
52 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); | 52 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); |
53 #else | 53 #else |
54 // Metrics Reporting is never enabled when GOOGLE_CHROME_BUILD is undefined. | 54 // Metrics Reporting is never enabled when GOOGLE_CHROME_BUILD is undefined. |
55 EXPECT_FALSE( | 55 EXPECT_FALSE( |
56 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); | 56 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); |
57 #endif | 57 #endif |
58 } | 58 } |
OLD | NEW |