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

Side by Side Diff: chrome/browser/metrics/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 "chrome/browser/metrics/chrome_metrics_service_accessor.h" 5 #include "chrome/browser/metrics/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 "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 17 matching lines...) Expand all
28 private: 28 private:
29 content::TestBrowserThreadBundle thread_bundle_; 29 content::TestBrowserThreadBundle thread_bundle_;
30 ScopedTestingLocalState testing_local_state_; 30 ScopedTestingLocalState testing_local_state_;
31 31
32 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceAccessorTest); 32 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsServiceAccessorTest);
33 }; 33 };
34 34
35 TEST_F(ChromeMetricsServiceAccessorTest, MetricsReportingEnabled) { 35 TEST_F(ChromeMetricsServiceAccessorTest, MetricsReportingEnabled) {
36 #if defined(GOOGLE_CHROME_BUILD) 36 #if defined(GOOGLE_CHROME_BUILD)
37 const char* pref = metrics::prefs::kMetricsReportingEnabled; 37 const char* pref = metrics::prefs::kMetricsReportingEnabled;
38 GetLocalState()->SetDefaultPrefValue(pref, new base::FundamentalValue(false)); 38 GetLocalState()->SetDefaultPrefValue(pref, new base::Value(false));
39 39
40 GetLocalState()->SetBoolean(pref, false); 40 GetLocalState()->SetBoolean(pref, false);
41 EXPECT_FALSE( 41 EXPECT_FALSE(
42 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 42 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
43 GetLocalState()->SetBoolean(pref, true); 43 GetLocalState()->SetBoolean(pref, true);
44 EXPECT_TRUE( 44 EXPECT_TRUE(
45 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 45 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
46 GetLocalState()->ClearPref(pref); 46 GetLocalState()->ClearPref(pref);
47 EXPECT_FALSE( 47 EXPECT_FALSE(
48 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 48 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
49 49
50 // If field trials are forced, metrics should always be disabled, regardless 50 // If field trials are forced, metrics should always be disabled, regardless
51 // of the value of the pref. 51 // of the value of the pref.
52 base::CommandLine::ForCurrentProcess()->AppendSwitch( 52 base::CommandLine::ForCurrentProcess()->AppendSwitch(
53 switches::kForceFieldTrials); 53 switches::kForceFieldTrials);
54 EXPECT_FALSE( 54 EXPECT_FALSE(
55 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 55 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
56 GetLocalState()->SetBoolean(pref, true); 56 GetLocalState()->SetBoolean(pref, true);
57 EXPECT_FALSE( 57 EXPECT_FALSE(
58 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 58 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
59 #else 59 #else
60 // Metrics Reporting is never enabled when GOOGLE_CHROME_BUILD is undefined. 60 // Metrics Reporting is never enabled when GOOGLE_CHROME_BUILD is undefined.
61 EXPECT_FALSE( 61 EXPECT_FALSE(
62 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled()); 62 ChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
63 #endif 63 #endif
64 } 64 }
OLDNEW
« no previous file with comments | « chrome/browser/metrics/android_metrics_provider.cc ('k') | chrome/browser/net/disk_cache_dir_policy_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698