From cff249c000951e501f7f9be03c5be94534860e88 Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Mon, 25 Mar 2019 18:40:02 -0700 Subject: [PATCH 1/2] Merge pull request #2029 from brave/fix_3816 Disabling metrics reporting; Updating ad-block deps to fix audit_deps error; Updating crypto deps to fix audit_deps error; --- DEPS | 6 ++--- .../metrics/enabled_state_provider.cc | 17 ++++++++++++ .../enabled_state_provider_unittest.cc | 27 +++++++++++++++++++ test/BUILD.gn | 1 + 4 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 chromium_src/components/metrics/enabled_state_provider.cc create mode 100644 chromium_src/components/metrics/enabled_state_provider_unittest.cc diff --git a/DEPS b/DEPS index c9741784c987..024e2f10cf3d 100644 --- a/DEPS +++ b/DEPS @@ -1,7 +1,7 @@ use_relative_paths = True deps = { - "vendor/ad-block": "https://github.com/brave/ad-block.git@74b167c8b49c33f3f61c15dafa2ffde953a25653", + "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@e67738e656244f7ab6e0ed9815071ca744f5468f", @@ -16,8 +16,8 @@ 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-crypto": "https://github.com/brave/crypto@518d17d97003d1ccb2116c498ab363e0834e184c", + "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", } 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 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 1235dd4cd155..c90c18e04b08 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -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", From 840bc97d0c87d9fad992c283d499faca156438da Mon Sep 17 00:00:00 2001 From: Pranjal Jumde Date: Mon, 25 Mar 2019 19:36:38 -0700 Subject: [PATCH 2/2] Reverting DEPS because it might cause compatibility issues. --- DEPS | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DEPS b/DEPS index 024e2f10cf3d..c9741784c987 100644 --- a/DEPS +++ b/DEPS @@ -1,7 +1,7 @@ use_relative_paths = True deps = { - "vendor/ad-block": "https://github.com/brave/ad-block.git@d5c7128599889e4e2a797b402a517c664d53fad2", + "vendor/ad-block": "https://github.com/brave/ad-block.git@74b167c8b49c33f3f61c15dafa2ffde953a25653", "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@e67738e656244f7ab6e0ed9815071ca744f5468f", @@ -16,8 +16,8 @@ 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@6691e9594f66050ba30206d9f49f90ce1a44bb51", - "components/brave_sync/extension/brave-crypto": "https://github.com/brave/crypto@0cd5dda4fd7c948d6c13107cb4f9b7d293ffc7e3", + "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", "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", }