Skip to content

Commit

Permalink
Merge pull request #2074 from brave/fix_3816_0.63.x
Browse files Browse the repository at this point in the history
Disable metrics services on 0.63.x
  • Loading branch information
jumde committed Mar 26, 2019
2 parents 7ff136e + 840bc97 commit acca7ca
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
17 changes: 17 additions & 0 deletions chromium_src/components/metrics/enabled_state_provider.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* 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 "components/metrics/enabled_state_provider.h"

#include "base/base_switches.h"
#include "base/command_line.h"

namespace metrics {

bool EnabledStateProvider::IsReportingEnabled() const {
return false;
}

} // namespace metrics
27 changes: 27 additions & 0 deletions chromium_src/components/metrics/enabled_state_provider_unittest.cc
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());
}
1 change: 1 addition & 0 deletions test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ test("brave_unit_tests") {
"//brave/chromium_src/chrome/browser/history/history_utils_unittest.cc",
"//brave/chromium_src/chrome/browser/signin/account_consistency_disabled_unittest.cc",
"//brave/chromium_src/chrome/browser/ui/bookmarks/brave_bookmark_context_menu_controller_unittest.cc",
"//brave/chromium_src/components/metrics/enabled_state_provider_unittest.cc",
"//brave/chromium_src/components/search_engines/brave_template_url_prepopulate_data_unittest.cc",
"//brave/chromium_src/components/search_engines/brave_template_url_service_util_unittest.cc",
"//brave/chromium_src/components/version_info/brave_version_info_unittest.cc",
Expand Down

0 comments on commit acca7ca

Please sign in to comment.