Skip to content

Commit

Permalink
CachedFlag now has two different ctors
Browse files Browse the repository at this point in the history
fixes brave/brave-browser#38524

Related Chromium change:
https://source.chromium.org/chromium/chromium/src/+/d185bd9ea3aa006e8dfc789dce07f3d902886c9a

[Android] Allow CachedFlags to specify test defaults

	This mimics fieldtrial_testing_config.json for CachedFlag in tests.
	It does not affect the flag value in developer builds like
	fieldtrial_testing_config.json does, however.

	Bug: 40239922
	Change-Id: I8b67a6c2feeadd5ce12dcf6d41fe4c2e3e3d240f
	Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5523173
  • Loading branch information
AlexeyBarabash authored and emerick committed May 24, 2024
1 parent 34800f8 commit 49c0c59
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,14 @@ public void testConstructorsExistAndMatch() throws Exception {
FeatureMap.class,
String.class,
boolean.class));
Assert.assertTrue(
constructorsMatch(
"org/chromium/base/cached_flags/CachedFlag",
"org/chromium/base/cached_flags/BraveCachedFlag",
FeatureMap.class,
String.class,
boolean.class,
boolean.class));

Assert.assertTrue(
constructorsMatch(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ public class BraveCachedFlag extends CachedFlag {
// Will be deleted in bytecode. Variable from the parent class will be used instead.
private boolean mDefaultValue;

public BraveCachedFlag(
FeatureMap featureMap,
String featureName,
boolean defaultValue,
boolean defaultValueInTests) {
super(featureMap, featureName, defaultValue, defaultValueInTests);

maybeOverrideDefaultValue(featureName, defaultValue);
}

public BraveCachedFlag(FeatureMap featureMap, String featureName, boolean defaultValue) {
super(featureMap, featureName, defaultValue);

Expand Down

0 comments on commit 49c0c59

Please sign in to comment.