Rename Brave Ads Set*Pref unit test helpers to Set*PrefValue

This commit is contained in:
Terry Mancey
2023-10-05 14:17:41 -05:00
parent e898f20c0c
commit eae4077d2f
17 changed files with 89 additions and 84 deletions
@@ -16,7 +16,8 @@ namespace brave_ads {
namespace {
void MockDiagnosticId() {
SetStringPref(prefs::kDiagnosticId, "c1298fde-7fdb-401f-a3ce-0b58fe86e6e2");
SetStringPrefValue(prefs::kDiagnosticId,
"c1298fde-7fdb-401f-a3ce-0b58fe86e6e2");
}
} // namespace
@@ -24,7 +24,7 @@ TEST_F(BraveAdsStatementUtilTest, GetNextPaymentDate) {
const base::Time next_token_redemption_at =
TimeFromString("5 February 2020", /*is_local*/ false);
SetTimePref(prefs::kNextTokenRedemptionAt, next_token_redemption_at);
SetTimePrefValue(prefs::kNextTokenRedemptionAt, next_token_redemption_at);
const TransactionList transactions;
@@ -20,7 +20,8 @@ class BraveAdsDiagnosticIdUserDataTest : public UnitTestBase {};
TEST_F(BraveAdsDiagnosticIdUserDataTest,
BuildDiagnosticIdUserDataForRewardsUser) {
// Arrange
SetStringPref(prefs::kDiagnosticId, "c1298fde-7fdb-401f-a3ce-0b58fe86e6e2");
SetStringPrefValue(prefs::kDiagnosticId,
"c1298fde-7fdb-401f-a3ce-0b58fe86e6e2");
// Act
@@ -38,7 +39,8 @@ TEST_F(BraveAdsDiagnosticIdUserDataTest,
// Arrange
DisableBraveRewardsForTesting();
SetStringPref(prefs::kDiagnosticId, "c1298fde-7fdb-401f-a3ce-0b58fe86e6e2");
SetStringPrefValue(prefs::kDiagnosticId,
"c1298fde-7fdb-401f-a3ce-0b58fe86e6e2");
// Act
@@ -49,7 +51,7 @@ TEST_F(BraveAdsDiagnosticIdUserDataTest,
TEST_F(BraveAdsDiagnosticIdUserDataTest,
DoNotBuildDiagnosticUserDataIfDiagnosticIdIsInvalid) {
// Arrange
SetStringPref(prefs::kDiagnosticId, "INVALID");
SetStringPrefValue(prefs::kDiagnosticId, "INVALID");
// Act
@@ -60,7 +62,7 @@ TEST_F(BraveAdsDiagnosticIdUserDataTest,
TEST_F(BraveAdsDiagnosticIdUserDataTest,
DoNotBuildDiagnosticIdUserDataIfDiagnosticIdIsEmpty) {
// Arrange
SetStringPref(prefs::kDiagnosticId, "");
SetStringPrefValue(prefs::kDiagnosticId, "");
// Act
@@ -46,7 +46,7 @@ TEST_F(BraveAdsRedeemPaymentTokensTest, RedeemPaymentTokens) {
{{net::HTTP_OK, BuildRedeemPaymentTokensUrlResponseBodyForTesting()}}}};
MockUrlResponses(ads_client_mock_, url_responses);
SetTimePref(prefs::kNextTokenRedemptionAt, Now());
SetTimePrefValue(prefs::kNextTokenRedemptionAt, Now());
SetPaymentTokensForTesting(/*count*/ 1);
@@ -79,7 +79,7 @@ TEST_F(BraveAdsRedeemPaymentTokensTest, RedeemPaymentTokensMultipleTimes) {
{net::HTTP_OK, BuildRedeemPaymentTokensUrlResponseBodyForTesting()}}}};
MockUrlResponses(ads_client_mock_, url_responses);
SetTimePref(prefs::kNextTokenRedemptionAt, Now());
SetTimePrefValue(prefs::kNextTokenRedemptionAt, Now());
const PaymentTokenList payment_tokens =
SetPaymentTokensForTesting(/*count*/ 1);
@@ -116,7 +116,7 @@ TEST_F(BraveAdsRedeemPaymentTokensTest, ScheduleNextTokenRedemption) {
{{net::HTTP_OK, BuildRedeemPaymentTokensUrlResponseBodyForTesting()}}}};
MockUrlResponses(ads_client_mock_, url_responses);
SetTimePref(prefs::kNextTokenRedemptionAt, Now());
SetTimePrefValue(prefs::kNextTokenRedemptionAt, Now());
SetPaymentTokensForTesting(/*count*/ 1);
@@ -142,7 +142,7 @@ TEST_F(BraveAdsRedeemPaymentTokensTest, ScheduleNextTokenRedemption) {
TEST_F(BraveAdsRedeemPaymentTokensTest, NoPaymentTokens) {
// Arrange
SetTimePref(prefs::kNextTokenRedemptionAt, Now());
SetTimePrefValue(prefs::kNextTokenRedemptionAt, Now());
// Act
EXPECT_CALL(ads_client_mock_, UrlRequest).Times(0);
@@ -176,7 +176,7 @@ TEST_F(BraveAdsRedeemPaymentTokensTest, Retry) {
{net::HTTP_OK, BuildRedeemPaymentTokensUrlResponseBodyForTesting()}}}};
MockUrlResponses(ads_client_mock_, url_responses);
SetTimePref(prefs::kNextTokenRedemptionAt, Now());
SetTimePrefValue(prefs::kNextTokenRedemptionAt, Now());
SetPaymentTokensForTesting(/*count*/ 1);
@@ -12,48 +12,48 @@
namespace brave_ads {
void SetBooleanPref(const std::string& path, const bool value) {
void SetBooleanPrefValue(const std::string& path, const bool value) {
SetPrefValue(path, base::NumberToString(static_cast<int>(value)));
}
void SetIntegerPref(const std::string& path, const int value) {
void SetIntegerPrefValue(const std::string& path, const int value) {
SetPrefValue(path, base::NumberToString(static_cast<int>(value)));
}
void SetDoublePref(const std::string& path, const double value) {
void SetDoublePrefValue(const std::string& path, const double value) {
SetPrefValue(path, base::NumberToString(static_cast<int>(value)));
}
void SetStringPref(const std::string& path, const std::string& value) {
void SetStringPrefValue(const std::string& path, const std::string& value) {
SetPrefValue(path, value);
}
void SetInt64Pref(const std::string& path, const int64_t value) {
void SetInt64PrefValue(const std::string& path, const int64_t value) {
SetPrefValue(path, base::NumberToString(static_cast<int>(value)));
}
void SetUint64Pref(const std::string& path, const uint64_t value) {
void SetUint64PrefValue(const std::string& path, const uint64_t value) {
SetPrefValue(path, base::NumberToString(static_cast<int>(value)));
}
void SetDictPref(const std::string& path, base::Value::Dict value) {
void SetDictPrefValue(const std::string& path, base::Value::Dict value) {
std::string json;
CHECK(base::JSONWriter::Write(value, &json));
SetPrefValue(path, json);
}
void SetListPref(const std::string& path, base::Value::List value) {
void SetListPrefValue(const std::string& path, base::Value::List value) {
std::string json;
CHECK(base::JSONWriter::Write(value, &json));
SetPrefValue(path, json);
}
void SetTimePref(const std::string& path, const base::Time value) {
void SetTimePrefValue(const std::string& path, const base::Time value) {
SetPrefValue(path, base::NumberToString(
value.ToDeltaSinceWindowsEpoch().InMicroseconds()));
}
void SetLocalStatePref(const std::string& path, const std::string& value) {
void SetLocalStatePrefValue(const std::string& path, const std::string& value) {
SetPrefValue(path, value);
}
@@ -17,18 +17,18 @@ class Time;
namespace brave_ads {
// Unlike |ads_client_mock_->Set*Pref| in |UnitTestBase|, |Set*Pref| will not
// notify observers.
void SetBooleanPref(const std::string& path, bool value);
void SetIntegerPref(const std::string& path, int value);
void SetDoublePref(const std::string& path, double value);
void SetStringPref(const std::string& path, const std::string& value);
void SetInt64Pref(const std::string& path, int64_t value);
void SetUint64Pref(const std::string& path, uint64_t value);
void SetDictPref(const std::string& path, base::Value::Dict value = {});
void SetListPref(const std::string& path, base::Value::List value = {});
void SetTimePref(const std::string& path, base::Time value);
void SetLocalStatePref(const std::string& path, const std::string& value);
// Unlike |ads_client_mock_->Set*Pref| in |UnitTestBase|, |Set*PrefValue| will
// not notify observers.
void SetBooleanPrefValue(const std::string& path, bool value);
void SetIntegerPrefValue(const std::string& path, int value);
void SetDoublePrefValue(const std::string& path, double value);
void SetStringPrefValue(const std::string& path, const std::string& value);
void SetInt64PrefValue(const std::string& path, int64_t value);
void SetUint64PrefValue(const std::string& path, uint64_t value);
void SetDictPrefValue(const std::string& path, base::Value::Dict value = {});
void SetListPrefValue(const std::string& path, base::Value::List value = {});
void SetTimePrefValue(const std::string& path, base::Time value);
void SetLocalStatePrefValue(const std::string& path, const std::string& value);
} // namespace brave_ads
@@ -23,7 +23,7 @@ constexpr char kClientIssue23794Filename[] = "client_issue_23794.json";
class BraveAdsLegacyClientMigrationIssue23794Test : public UnitTestBase {
protected:
void SetUpMocks() override {
SetBooleanPref(prefs::kHasMigratedClientState, false);
SetBooleanPrefValue(prefs::kHasMigratedClientState, false);
}
};
@@ -23,7 +23,7 @@ constexpr char kInvalidJsonFilename[] = "invalid.json";
class BraveAdsLegacyClientMigrationTest : public UnitTestBase {
protected:
void SetUpMocks() override {
SetBooleanPref(prefs::kHasMigratedClientState, false);
SetBooleanPrefValue(prefs::kHasMigratedClientState, false);
}
};
@@ -17,7 +17,7 @@ class BraveAdsLegacyClientMigrationUtilTest : public UnitTestBase {};
TEST_F(BraveAdsLegacyClientMigrationUtilTest, HasMigrated) {
// Arrange
SetBooleanPref(prefs::kHasMigratedClientState, true);
SetBooleanPrefValue(prefs::kHasMigratedClientState, true);
// Act
@@ -27,7 +27,7 @@ TEST_F(BraveAdsLegacyClientMigrationUtilTest, HasMigrated) {
TEST_F(BraveAdsLegacyClientMigrationUtilTest, HasNotMigrated) {
// Arrange
SetBooleanPref(prefs::kHasMigratedClientState, false);
SetBooleanPrefValue(prefs::kHasMigratedClientState, false);
// Act
@@ -24,7 +24,7 @@ constexpr char kInvalidJsonFilename[] = "invalid.json";
class BraveAdsLegacyConfirmationMigrationTest : public UnitTestBase {
protected:
void SetUpMocks() override {
SetBooleanPref(prefs::kHasMigratedConfirmationState, false);
SetBooleanPrefValue(prefs::kHasMigratedConfirmationState, false);
}
};
@@ -17,7 +17,7 @@ class BraveAdsLegacyConfirmationMigrationUtilTest : public UnitTestBase {};
TEST_F(BraveAdsLegacyConfirmationMigrationUtilTest, HasMigrated) {
// Arrange
SetBooleanPref(prefs::kHasMigratedConfirmationState, true);
SetBooleanPrefValue(prefs::kHasMigratedConfirmationState, true);
// Act
@@ -27,7 +27,7 @@ TEST_F(BraveAdsLegacyConfirmationMigrationUtilTest, HasMigrated) {
TEST_F(BraveAdsLegacyConfirmationMigrationUtilTest, HasNotMigrated) {
// Arrange
SetBooleanPref(prefs::kHasMigratedConfirmationState, false);
SetBooleanPrefValue(prefs::kHasMigratedConfirmationState, false);
// Act
@@ -31,7 +31,7 @@ class BraveAdsLegacyRewardsMigrationIssue25384Test : public UnitTestBase {
TEST_F(BraveAdsLegacyRewardsMigrationIssue25384Test, Migrate) {
// Arrange
SetBooleanPref(prefs::kHasMigratedRewardsState, false);
SetBooleanPrefValue(prefs::kHasMigratedRewardsState, false);
base::MockCallback<InitializeCallback> callback;
EXPECT_CALL(callback, Run(/*success*/ true));
@@ -139,7 +139,7 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsNotAllowedForGeoTargetWithNoRegion) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, false);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, false);
CreativeAdInfo creative_ad;
creative_ad.creative_set_id = kCreativeSetId;
@@ -154,7 +154,7 @@ TEST_P(
TEST_P(BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsSupportedAndAutoDetected) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
MockUrlResponseForTestParam();
@@ -174,7 +174,7 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsSupportedAndAutoDetectedForMultipleGeoTargets) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
MockUrlResponseForTestParam();
@@ -195,7 +195,7 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsSupportedAndAutoDetectedForGeoTargetWithNoRegion) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
MockUrlResponseForTestParam();
@@ -215,10 +215,10 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsSupportedAndSubdivisionWasManuallySelected) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
SetStringPref(prefs::kSubdivisionTargetingSubdivision,
BuildSubdivisionForTestParam());
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision,
BuildSubdivisionForTestParam());
MockUrlResponseForTestParam();
@@ -238,10 +238,10 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsSupportedAndSubdivisionWasManuallySelectedForMultipleGeoTargets) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
SetStringPref(prefs::kSubdivisionTargetingSubdivision,
BuildSubdivisionForTestParam());
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision,
BuildSubdivisionForTestParam());
MockUrlResponseForTestParam();
@@ -262,10 +262,10 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsSupportedAndManuallySelectedForGeoTargetWithNoRegion) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
SetStringPref(prefs::kSubdivisionTargetingSubdivision,
BuildSubdivisionForTestParam());
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision,
BuildSubdivisionForTestParam());
MockUrlResponseForTestParam();
@@ -284,7 +284,7 @@ TEST_P(
TEST_P(BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldExcludeIfSubdivisionTargetingIsSupportedForUnsupportedGeoTarget) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
MockUrlResponseForTestParam();
@@ -303,7 +303,7 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldExcludeIfSubdivisionTargetingIsNotSupportedForSubdivisionGeoTarget) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
MockUrlResponseForTestParam();
@@ -324,7 +324,7 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsNotSupportedForNonSubdivisionGeoTarget) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
const URLResponseMap url_responses = {
{BuildSubdivisionUrlPath(),
@@ -348,9 +348,9 @@ TEST_P(
TEST_P(BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldExcludeIfSubdivisionTargetingIsDisabledForSubdivisionGeoTarget) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
SetStringPref(prefs::kSubdivisionTargetingSubdivision, "DISABLED");
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision, "DISABLED");
MockUrlResponseForTestParam();
@@ -370,9 +370,9 @@ TEST_P(
BraveAdsSubdivisionTargetingExclusionRuleTest,
ShouldIncludeIfSubdivisionTargetingIsDisabledForNonSubdivisionGeoTarget) {
// Arrange
SetBooleanPref(prefs::kShouldAllowSubdivisionTargeting, true);
SetBooleanPrefValue(prefs::kShouldAllowSubdivisionTargeting, true);
SetStringPref(prefs::kSubdivisionTargetingSubdivision, "DISABLED");
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision, "DISABLED");
MockUrlResponseForTestParam();
@@ -100,7 +100,7 @@ TEST_F(BraveAdsSettingsTest, MaximumNotificationAdsPerHour) {
scoped_feature_list.InitAndEnableFeatureWithParameters(
kNotificationAdFeature, {{"default_ads_per_hour", "2"}});
SetInt64Pref(prefs::kMaximumNotificationAdsPerHour, 3);
SetInt64PrefValue(prefs::kMaximumNotificationAdsPerHour, 3);
// Act
@@ -14,28 +14,28 @@
namespace brave_ads {
void DisableBraveRewardsForTesting() {
SetBooleanPref(brave_rewards::prefs::kEnabled, false);
SetBooleanPrefValue(brave_rewards::prefs::kEnabled, false);
}
void OptOutOfBraveNewsAdsForTesting() {
SetBooleanPref(brave_news::prefs::kBraveNewsOptedIn, false);
SetBooleanPref(brave_news::prefs::kNewTabPageShowToday, false);
SetBooleanPrefValue(brave_news::prefs::kBraveNewsOptedIn, false);
SetBooleanPrefValue(brave_news::prefs::kNewTabPageShowToday, false);
}
void OptOutOfNewTabPageAdsForTesting() {
SetBooleanPref(ntp_background_images::prefs::kNewTabPageShowBackgroundImage,
false);
SetBooleanPref(ntp_background_images::prefs::
kNewTabPageShowSponsoredImagesBackgroundImage,
false);
SetBooleanPrefValue(
ntp_background_images::prefs::kNewTabPageShowBackgroundImage, false);
SetBooleanPrefValue(ntp_background_images::prefs::
kNewTabPageShowSponsoredImagesBackgroundImage,
false);
}
void OptOutOfNotificationAdsForTesting() {
SetBooleanPref(prefs::kOptedInToNotificationAds, false);
SetBooleanPrefValue(prefs::kOptedInToNotificationAds, false);
}
void SetMaximumNotificationAdsPerHourForTesting(const int max_ads_per_hour) {
SetInt64Pref(prefs::kMaximumNotificationAdsPerHour, max_ads_per_hour);
SetInt64PrefValue(prefs::kMaximumNotificationAdsPerHour, max_ads_per_hour);
}
} // namespace brave_ads
@@ -174,8 +174,8 @@ TEST_F(BraveAdsSubdivisionTargetingTest,
TEST_F(BraveAdsSubdivisionTargetingTest,
ShouldAllowIfDisabledAndCountryIsSupported) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingSubdivision,
kSubdivisionTargetingDisabled);
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision,
kSubdivisionTargetingDisabled);
MockHttpOkUrlResponse(/*country_code*/ "US", /*subdivision_code*/ "CA");
// Act
@@ -190,8 +190,8 @@ TEST_F(BraveAdsSubdivisionTargetingTest,
TEST_F(BraveAdsSubdivisionTargetingTest,
ShouldAllowIfDisabledAndCountryIsUnsupported) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingSubdivision,
kSubdivisionTargetingDisabled);
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision,
kSubdivisionTargetingDisabled);
MockHttpOkUrlResponse(/*country_code*/ "XX", /*subdivision_code*/ "XX");
// Act
@@ -206,7 +206,8 @@ TEST_F(BraveAdsSubdivisionTargetingTest,
TEST_F(BraveAdsSubdivisionTargetingTest,
ShouldAllowAndAutoDetectIfCountryIsSupported) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingAutoDetectedSubdivision, "US-CA");
SetStringPrefValue(prefs::kSubdivisionTargetingAutoDetectedSubdivision,
"US-CA");
// Act
NotifyDidInitializeAds();
@@ -222,7 +223,8 @@ TEST_F(BraveAdsSubdivisionTargetingTest,
TEST_F(BraveAdsSubdivisionTargetingTest,
ShouldAllowAndAutoDetectIfSubdivisionCodeIsUnsupported) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingAutoDetectedSubdivision, "XX-XX");
SetStringPrefValue(prefs::kSubdivisionTargetingAutoDetectedSubdivision,
"XX-XX");
// Act
NotifyDidInitializeAds();
@@ -251,8 +253,8 @@ TEST_F(BraveAdsSubdivisionTargetingTest,
TEST_F(BraveAdsSubdivisionTargetingTest, ShouldAllowIfSubdivisionCodeNotValid) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingAutoDetectedSubdivision,
"CA-NO REGION");
SetStringPrefValue(prefs::kSubdivisionTargetingAutoDetectedSubdivision,
"CA-NO REGION");
// Act
NotifyDidInitializeAds();
@@ -304,7 +306,7 @@ TEST_F(BraveAdsSubdivisionTargetingTest,
TEST_F(BraveAdsSubdivisionTargetingTest,
ShouldAllowWhenUserSelectSubdivisionWithSameCountry) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingSubdivision, "US-FL");
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision, "US-FL");
MockHttpOkUrlResponse(/*country_code*/ "US", /*subdivision_code*/ "CA");
// Act
@@ -324,7 +326,7 @@ TEST_F(BraveAdsSubdivisionTargetingTest,
TEST_F(BraveAdsSubdivisionTargetingTest,
ShouldAllowWhenUserSelectSubdivisionAndAutodetectedCountryIsSupported) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingSubdivision, "US-FL");
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision, "US-FL");
MockHttpOkUrlResponse(/*country_code*/ "CA", /*subdivision_code*/ "AL");
// Act
@@ -342,7 +344,7 @@ TEST_F(
BraveAdsSubdivisionTargetingTest,
ShouldNotAllowWhenUserSelectSubdivisionAndAutodetectedCountryIsUnsupported) {
// Arrange
SetStringPref(prefs::kSubdivisionTargetingSubdivision, "US-FL");
SetStringPrefValue(prefs::kSubdivisionTargetingSubdivision, "US-FL");
MockHttpOkUrlResponse(/*country_code*/ "XX", /*subdivision_code*/ "XX");
// Act
@@ -58,7 +58,7 @@ class BraveAdsNotificationAdHandlerUtilShouldServeAtRegularIntervalsTest
void SetUpMocks() override {
const ParamInfo param = GetParam();
SetBooleanPref(prefs::kOptedInToNotificationAds, param.should_opt_in);
SetBooleanPrefValue(prefs::kOptedInToNotificationAds, param.should_opt_in);
MockCanShowNotificationAdsWhileBrowserIsBackgrounded(
ads_client_mock_, param.can_show_while_browser_is_backgrounded);