From 9abd863be4006125067dd57b63ba0658251b4f12 Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Fri, 22 Mar 2019 01:21:40 -0700 Subject: [PATCH 1/6] Issue 3816: Disabling metrics reporting auditors: @pilgrim-brave, @bbondy --- browser/metrics/metrics_reporting_util.cc | 2 +- .../metrics/enabled_state_provider.cc | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 chromium_src/components/metrics/enabled_state_provider.cc diff --git a/browser/metrics/metrics_reporting_util.cc b/browser/metrics/metrics_reporting_util.cc index 8d42a5337172..444d802105ac 100644 --- a/browser/metrics/metrics_reporting_util.cc +++ b/browser/metrics/metrics_reporting_util.cc @@ -18,7 +18,7 @@ bool GetDefaultPrefValueForMetricsReporting() { case version_info::Channel::CANARY: return true; case version_info::Channel::UNKNOWN: - return false; + return true; default: NOTREACHED(); return false; diff --git a/chromium_src/components/metrics/enabled_state_provider.cc b/chromium_src/components/metrics/enabled_state_provider.cc new file mode 100644 index 000000000000..0e3d640dd7c2 --- /dev/null +++ b/chromium_src/components/metrics/enabled_state_provider.cc @@ -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 From 9a084692e5ee70c6fa4ed63d647cd3e41fe9c70d Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Fri, 22 Mar 2019 11:42:12 -0700 Subject: [PATCH 2/6] Adding unittest for disabled metrics reporting --- .../enabled_state_provider_unittest.cc | 27 +++++++++++++++++++ test/BUILD.gn | 1 + 2 files changed, 28 insertions(+) create mode 100644 chromium_src/components/metrics/enabled_state_provider_unittest.cc diff --git a/chromium_src/components/metrics/enabled_state_provider_unittest.cc b/chromium_src/components/metrics/enabled_state_provider_unittest.cc new file mode 100644 index 000000000000..9b4c26244d33 --- /dev/null +++ b/chromium_src/components/metrics/enabled_state_provider_unittest.cc @@ -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()); +} diff --git a/test/BUILD.gn b/test/BUILD.gn index f1d1188d8ea1..9a3d5cc90dd3 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -66,6 +66,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", From fbacafd5ad147037bcd4e82cdd46fae1a0741b26 Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Sat, 23 Mar 2019 22:40:25 -0700 Subject: [PATCH 3/6] Issue 3871: Updating ad-block deps to resolve npm audit error --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index e423f85393f8..9b751e3ba05c 100644 --- a/DEPS +++ b/DEPS @@ -1,7 +1,7 @@ use_relative_paths = True deps = { - "vendor/ad-block": "https://github.com/brave/ad-block.git@e54c59fe288d8f08de683b8f4f320a4c7bead4eb", + "vendor/ad-block": "https://github.com/brave/ad-block.git@d5c7128599889e4e2a797b402a517c664d53fad2", "vendor/autoplay-whitelist": "https://github.com/brave/autoplay-whitelist.git@458053a3c95b403cbe0872f289a2aafa106ee9d8", "vendor/extension-whitelist": "https://github.com/brave/extension-whitelist.git@463e5e4e06e0ca84927176e8c72f6076ae9b6829", "vendor/tracking-protection": "https://github.com/brave/tracking-protection.git@29b1f86b11a8c7438fd7d57b446a77a84946712a", From eff6c404c22f6383f1ceb1b65caf98f4d3f23a8e Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Sun, 24 Mar 2019 21:31:00 -0700 Subject: [PATCH 4/6] Issue 3877: Update crypto deps to fix npm audit error --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index 9b751e3ba05c..b1e7e7125592 100644 --- a/DEPS +++ b/DEPS @@ -17,7 +17,7 @@ deps = { "vendor/bat-native-anonize": "https://github.com/brave-intl/bat-native-anonize.git@b8ef1a3f85aec0a0522a9230d59b3958a2150fab", "vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@1b4362968c8f22720bfb75af6f506d4ecc0f3116", "components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@76bf8f1295b46a7112756af631a8f5cd217953e6", - "components/brave_sync/extension/brave-crypto": "https://github.com/brave/crypto@518d17d97003d1ccb2116c498ab363e0834e184c", + "components/brave_sync/extension/brave-crypto": "https://github.com/brave/crypto@0cd5dda4fd7c948d6c13107cb4f9b7d293ffc7e3", "vendor/bat-native-usermodel": "https://github.com/brave-intl/bat-native-usermodel.git@c3b6111aa862c5c452c84be8a225d5f1df32b284", "vendor/challenge_bypass_ristretto_ffi": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@2c0e28f76e4b6f53947bf4faa5afd93614f96aca", } From 19c5347d9215b84b977e8cd3901d225e270210f4 Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Mon, 25 Mar 2019 09:22:20 -0700 Subject: [PATCH 5/6] Issue 3878: Update js-yaml in sync to fix npm audit error --- DEPS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DEPS b/DEPS index b1e7e7125592..096f49cfa0ba 100644 --- a/DEPS +++ b/DEPS @@ -16,7 +16,7 @@ deps = { "vendor/bip39wally-core-native": "https://github.com/brave-intl/bip39wally-core-native.git@9b119931c702d55be994117eb505d56310720b1d", "vendor/bat-native-anonize": "https://github.com/brave-intl/bat-native-anonize.git@b8ef1a3f85aec0a0522a9230d59b3958a2150fab", "vendor/bat-native-tweetnacl": "https://github.com/brave-intl/bat-native-tweetnacl.git@1b4362968c8f22720bfb75af6f506d4ecc0f3116", - "components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@76bf8f1295b46a7112756af631a8f5cd217953e6", + "components/brave_sync/extension/brave-sync": "https://github.com/brave/sync.git@6691e9594f66050ba30206d9f49f90ce1a44bb51", "components/brave_sync/extension/brave-crypto": "https://github.com/brave/crypto@0cd5dda4fd7c948d6c13107cb4f9b7d293ffc7e3", "vendor/bat-native-usermodel": "https://github.com/brave-intl/bat-native-usermodel.git@c3b6111aa862c5c452c84be8a225d5f1df32b284", "vendor/challenge_bypass_ristretto_ffi": "https://github.com/brave-intl/challenge-bypass-ristretto-ffi.git@2c0e28f76e4b6f53947bf4faa5afd93614f96aca", From c3bf60787c14240f0b3958b0dcb48291e8ced9ed Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Mon, 25 Mar 2019 10:34:08 -0700 Subject: [PATCH 6/6] Reverting changes needed for testing on DEBUG builds --- browser/metrics/metrics_reporting_util.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/metrics/metrics_reporting_util.cc b/browser/metrics/metrics_reporting_util.cc index 444d802105ac..8d42a5337172 100644 --- a/browser/metrics/metrics_reporting_util.cc +++ b/browser/metrics/metrics_reporting_util.cc @@ -18,7 +18,7 @@ bool GetDefaultPrefValueForMetricsReporting() { case version_info::Channel::CANARY: return true; case version_info::Channel::UNKNOWN: - return true; + return false; default: NOTREACHED(); return false;