Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/metrics/metrics_pref_names.h" 10 #include "components/metrics/metrics_pref_names.h"
(...skipping 11 matching lines...) Expand all
22 22
23 private: 23 private:
24 IOSChromeScopedTestingLocalState local_state_; 24 IOSChromeScopedTestingLocalState local_state_;
25 25
26 DISALLOW_COPY_AND_ASSIGN(IOSChromeMetricsServiceAccessorTest); 26 DISALLOW_COPY_AND_ASSIGN(IOSChromeMetricsServiceAccessorTest);
27 }; 27 };
28 28
29 TEST_F(IOSChromeMetricsServiceAccessorTest, MetricsReportingEnabled) { 29 TEST_F(IOSChromeMetricsServiceAccessorTest, MetricsReportingEnabled) {
30 #if defined(GOOGLE_CHROME_BUILD) 30 #if defined(GOOGLE_CHROME_BUILD)
31 const char* pref = metrics::prefs::kMetricsReportingEnabled; 31 const char* pref = metrics::prefs::kMetricsReportingEnabled;
32 GetLocalState()->SetDefaultPrefValue(pref, new base::FundamentalValue(false)); 32 GetLocalState()->SetDefaultPrefValue(pref, new base::Value(false));
33 33
34 GetLocalState()->SetBoolean(pref, false); 34 GetLocalState()->SetBoolean(pref, false);
35 EXPECT_FALSE( 35 EXPECT_FALSE(
36 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 36 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
37 GetLocalState()->SetBoolean(pref, true); 37 GetLocalState()->SetBoolean(pref, true);
38 EXPECT_TRUE( 38 EXPECT_TRUE(
39 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 39 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
40 GetLocalState()->ClearPref(pref); 40 GetLocalState()->ClearPref(pref);
41 EXPECT_FALSE( 41 EXPECT_FALSE(
42 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 42 IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
43 43
44 // If field trials are forced, metrics should always be disabled, regardless 44 // If field trials are forced, metrics should always be disabled, regardless
45 // of the value of the pref. 45 // of the value of the pref.
46 base::CommandLine::ForCurrentProcess()->AppendSwitch( 46 base::CommandLine::ForCurrentProcess()->AppendSwitch(
47 switches::kForceFieldTrials); 47 switches::kForceFieldTrials);
48 EXPECT_FALSE( 48 EXPECT_FALSE(
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 }
OLDNEW
« no previous file with comments | « headless/public/internal/value_conversions.h ('k') | ios/chrome/browser/passwords/credential_manager_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698