-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding unittest for disabled metrics reporting
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
chromium_src/components/metrics/enabled_state_provider_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Copyright (c) 2019 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "chrome/browser/metrics/chrome_metrics_services_manager_client.h" | ||
|
||
#include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | ||
#include "components/metrics/enabled_state_provider.h" | ||
#include "components/metrics/metrics_pref_names.h" | ||
#include "components/prefs/pref_registry_simple.h" | ||
#include "components/prefs/testing_pref_service.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
TEST(ChromeMetricsServicesManagerClient, MetricsReportingDisabled) { | ||
TestingPrefServiceSimple local_state; | ||
metrics::RegisterMetricsReportingStatePrefs(local_state.registry()); | ||
local_state.registry()->RegisterBooleanPref( | ||
metrics::prefs::kMetricsReportingEnabled, true); | ||
|
||
ChromeMetricsServicesManagerClient client(&local_state); | ||
const metrics::EnabledStateProvider& provider = | ||
client.GetEnabledStateProviderForTesting(); | ||
|
||
// Reporting should never be enabled | ||
EXPECT_FALSE(provider.IsReportingEnabled()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters