Commit f4434d97 authored by Yulun Wu's avatar Yulun Wu Committed by Commit Bot

Stop showing release notes notification afer oobe

Bug: 1047373
Change-Id: Iff288056d2006c9c97aa0f517e8d7f66e592f143
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032046
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#737096}
parent 206020a1
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "base/test/scoped_feature_list.h" #include "base/test/scoped_feature_list.h"
#include "chrome/browser/notifications/notification_display_service_tester.h" #include "chrome/browser/notifications/notification_display_service_tester.h"
#include "chrome/browser/notifications/system_notification_helper.h" #include "chrome/browser/notifications/system_notification_helper.h"
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h" #include "chrome/grit/generated_resources.h"
#include "chrome/test/base/browser_with_test_window_test.h" #include "chrome/test/base/browser_with_test_window_test.h"
#include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_browser_process.h"
...@@ -66,9 +67,18 @@ class ReleaseNotesNotificationTest : public BrowserWithTestWindowTest { ...@@ -66,9 +67,18 @@ class ReleaseNotesNotificationTest : public BrowserWithTestWindowTest {
DISALLOW_COPY_AND_ASSIGN(ReleaseNotesNotificationTest); DISALLOW_COPY_AND_ASSIGN(ReleaseNotesNotificationTest);
}; };
TEST_F(ReleaseNotesNotificationTest, DoNotShowReleaseNotesNotification) {
release_notes_notification_->MaybeShowReleaseNotes();
EXPECT_EQ(false, HasReleaseNotesNotification());
EXPECT_EQ(0, notification_count_);
}
TEST_F(ReleaseNotesNotificationTest, ShowReleaseNotesNotification) { TEST_F(ReleaseNotesNotificationTest, ShowReleaseNotesNotification) {
std::unique_ptr<ReleaseNotesStorage> release_notes_storage =
std::make_unique<ReleaseNotesStorage>(profile());
profile()->GetPrefs()->SetInteger(prefs::kReleaseNotesLastShownMilestone, -1);
release_notes_notification_->MaybeShowReleaseNotes(); release_notes_notification_->MaybeShowReleaseNotes();
ASSERT_TRUE(HasReleaseNotesNotification()); EXPECT_EQ(true, HasReleaseNotesNotification());
EXPECT_EQ(1, notification_count_); EXPECT_EQ(1, notification_count_);
} }
......
...@@ -34,7 +34,8 @@ constexpr int kTimesToShowSuggestionChip = 1; ...@@ -34,7 +34,8 @@ constexpr int kTimesToShowSuggestionChip = 1;
namespace chromeos { namespace chromeos {
void ReleaseNotesStorage::RegisterProfilePrefs(PrefRegistrySimple* registry) { void ReleaseNotesStorage::RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterIntegerPref(prefs::kReleaseNotesLastShownMilestone, 0); registry->RegisterIntegerPref(prefs::kReleaseNotesLastShownMilestone,
GetMilestone());
registry->RegisterIntegerPref( registry->RegisterIntegerPref(
prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 0); prefs::kReleaseNotesSuggestionChipTimesLeftToShow, 0);
} }
......
...@@ -77,6 +77,21 @@ TEST_P(ReleaseNotesStorageTest, ModifyLastRelease) { ...@@ -77,6 +77,21 @@ TEST_P(ReleaseNotesStorageTest, ModifyLastRelease) {
EXPECT_EQ(false, release_notes_storage->ShouldNotify()); EXPECT_EQ(false, release_notes_storage->ShouldNotify());
} }
// Release notes sets current milestone to "last shown" after OOBE and should
// not be shown.
TEST_P(ReleaseNotesStorageTest, ShouldNotShowReleaseNotesOOBE) {
const bool should_show_notification = GetParam();
SetupFeatureFlag(should_show_notification);
std::unique_ptr<Profile> profile = CreateProfile("test@gmail.com");
profile->GetProfilePolicyConnector()->OverrideIsManagedForTesting(false);
std::unique_ptr<ReleaseNotesStorage> release_notes_storage =
std::make_unique<ReleaseNotesStorage>(profile.get());
EXPECT_EQ(false, release_notes_storage->ShouldNotify());
}
TEST_P(ReleaseNotesStorageTest, ShouldShowReleaseNotes) { TEST_P(ReleaseNotesStorageTest, ShouldShowReleaseNotes) {
const bool should_show_notification = GetParam(); const bool should_show_notification = GetParam();
SetupFeatureFlag(should_show_notification); SetupFeatureFlag(should_show_notification);
......
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