Commit 0f55c487 authored by Hesen Zhang's avatar Hesen Zhang Committed by Commit Bot

[Update notification service]: add CreateFromFinch for config.

Bug: 1043237, 1013685
Change-Id: Ie089eef59d7fdd0ad0d5f4defff1abeac6a07aa6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2008612
Commit-Queue: Hesen Zhang <hesen@chromium.org>
Auto-Submit: Hesen Zhang <hesen@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735153}
parent d266ae97
......@@ -53,8 +53,12 @@ constexpr double kDefaultThrottleIntervalOffset = 0.0;
// Default update notification state.
constexpr bool kDefaultUpdateNotificationState = false;
// TODO(hesen): Create a CreateFromFinch method (issue 1043237).
std::unique_ptr<UpdateNotificationConfig> UpdateNotificationConfig::Create() {
return std::make_unique<UpdateNotificationConfig>();
}
std::unique_ptr<UpdateNotificationConfig>
UpdateNotificationConfig::CreateFromFinch() {
std::unique_ptr<UpdateNotificationConfig> config =
std::make_unique<UpdateNotificationConfig>();
......
......@@ -51,9 +51,12 @@ constexpr char kUpdateNotificationThrottleOffsetCoefficientParamName[] =
"update_notification_throttle_co_offset";
struct UpdateNotificationConfig {
// Create a update notification config.
// Create a default update notification config.
static std::unique_ptr<UpdateNotificationConfig> Create();
// Create an update notification config read from Finch.
static std::unique_ptr<UpdateNotificationConfig> CreateFromFinch();
UpdateNotificationConfig();
~UpdateNotificationConfig();
......
......@@ -37,7 +37,7 @@ TEST(UpdateNotificationConfigTest, FinchConfigTest) {
scoped_feature_list.InitAndEnableFeatureWithParameters(
chrome::android::kInlineUpdateFlow, parameters);
std::unique_ptr<UpdateNotificationConfig> config =
UpdateNotificationConfig::Create();
UpdateNotificationConfig::CreateFromFinch();
EXPECT_TRUE(config->is_enabled);
EXPECT_EQ(config->default_interval.InDays(), 7);
EXPECT_EQ(config->deliver_window_morning.first.InHours(), 5);
......
......@@ -41,7 +41,7 @@ KeyedService* UpdateNotificationServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
auto* schedule_service =
NotificationScheduleServiceFactory::GetForBrowserContext(context);
auto config = updates::UpdateNotificationConfig::Create();
auto config = updates::UpdateNotificationConfig::CreateFromFinch();
auto bridge =
std::make_unique<updates::UpdateNotificationServiceBridgeAndroid>();
return static_cast<KeyedService*>(new updates::UpdateNotificationServiceImpl(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment