Skip to content

Commit

Permalink
Issue 4283: Disable field trials
Browse files Browse the repository at this point in the history
  • Loading branch information
jumde committed May 21, 2019
1 parent 4d8bf87 commit 8a0447f
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/brave_main_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "chrome/common/chrome_switches.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/autofill_payments_features.h"
#include "components/omnibox/common/omnibox_features.h"
#include "components/password_manager/core/common/password_manager_features.h"
#include "components/unified_consent/feature.h"
#include "content/public/common/content_features.h"
Expand Down Expand Up @@ -139,6 +140,7 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) {
extensions_features::kNewExtensionUpdaterService.name,
#endif
features::kDesktopPWAWindowing.name,
omnibox::kSimplifyHttpsIndicator.name,
};

// Disabled features.
Expand Down
22 changes: 22 additions & 0 deletions chromium_src/components/omnibox/browser/location_bar_model_impl.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* 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/omnibox/browser/location_bar_model_impl.h"

#include "components/omnibox/browser/omnibox_field_trial.h"

#define GetFieldTrialParamValueByFeature \
GetFieldTrialParamValueByFeature_ChromiumImpl

namespace base {
std::string GetFieldTrialParamValueByFeature(const base::Feature& feature,
const std::string& param_name) {
return OmniboxFieldTrial::kSimplifyHttpsIndicatorParameterBothToLock;
}
} // namespace base

#include "../../../../../../../components/omnibox/browser/location_bar_model_impl.cc" // NOLINT

#undef GetFieldTrialParamValueByFeature
20 changes: 20 additions & 0 deletions chromium_src/components/variations/service/field_trial_unittest.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* 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/variations/service/buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace {
typedef testing::Test FieldTrialsTest;

TEST_F(FieldTrialsTest, FieldTrialsTestingEnabled) {
bool enabled = false;
#if BUILDFLAG(FIELDTRIAL_TESTING_ENABLED)
enabled = true
#endif // BUILDFLAG(FIELDTRIAL_TESTING_ENABLED)
EXPECT_FALSE(enabled);
}

} // namespace
13 changes: 13 additions & 0 deletions patches/components-variations-service-BUILD.gn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/components/variations/service/BUILD.gn b/components/variations/service/BUILD.gn
index bdabd37ad8d0f98aad110d68f8058885d3f3c31a..98864341b6223ca591bcd19dc9097d1b6fb829b0 100644
--- a/components/variations/service/BUILD.gn
+++ b/components/variations/service/BUILD.gn
@@ -11,7 +11,7 @@ declare_args() {
# Note: this setting is ignored if is_chrome_branded.
# TODO(thakis): It's strange this is called "_like_official_build" but then
# checks is_chrome_branded, not is_official_build.
- fieldtrial_testing_like_official_build = is_chrome_branded
+ fieldtrial_testing_like_official_build = true
}

fieldtrial_testing_enabled =
3 changes: 2 additions & 1 deletion test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ test("brave_unit_tests") {
"//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/translate/core/browser/translate_manager_unittest.cc",
"//brave/chromium_src/components/variations/service/field_trial_unittest.cc",
"//brave/chromium_src/components/version_info/brave_version_info_unittest.cc",
"//brave/chromium_src/components/translate/core/browser/translate_manager_unittest.cc",
"//brave/chromium_src/net/cookies/brave_canonical_cookie_unittest.cc",
"//brave/common/brave_content_client_unittest.cc",
"//brave/common/importer/brave_mock_importer_bridge.cc",
Expand Down

0 comments on commit 8a0447f

Please sign in to comment.