Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1604)

Unified Diff: chrome/browser/extensions/extension_storage_monitor_browsertest.cc

Issue 310183005: Added uninstall option to notification of high disk usage by an extension (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@exstorage_refactor
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/extension_storage_monitor.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_storage_monitor_browsertest.cc
diff --git a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
index c2d52a249ed9aab22eb9627ecb9307136ba2b5b4..1c32600bdcaf19a3d5397821ca240bddb11604e1 100644
--- a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
+++ b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
@@ -149,6 +149,12 @@ class ExtensionStorageMonitorTest : public ExtensionBrowserTest {
WriteBytes(extension, num_bytes, false);
}
+ void SimulateUninstallDialogAccept() {
+ // Ensure the uninstall dialog was shown and fake an accept.
+ ASSERT_TRUE(monitor()->uninstall_dialog_.get());
+ monitor()->ExtensionUninstallAccepted();
+ }
+
private:
void InitStorageMonitor() {
storage_monitor_ = ExtensionStorageMonitor::Get(profile());
@@ -239,7 +245,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest, UserDisabledNotifications) {
EXPECT_TRUE(IsStorageNotificationEnabled(extension->id()));
- // Fake clicking the notification button.
+ // Fake clicking the notification button to disable notifications.
message_center::MessageCenter::Get()->ClickOnNotificationButton(
GetNotificationId(extension->id()),
ExtensionStorageMonitor::BUTTON_DISABLE_NOTIFICATION);
@@ -312,4 +318,25 @@ IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest,
ASSERT_TRUE(extension);
WriteBytesNotExpectingNotification(extension, GetInitialExtensionThreshold());
}
+
+// Verify that notifications are disabled when the user clicks the action button
+// in the notification.
+IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest, UninstallExtension) {
+ const Extension* extension = InitWriteDataApp();
+ ASSERT_TRUE(extension);
+ WriteBytesExpectingNotification(extension, GetInitialExtensionThreshold());
+
+ // Fake clicking the notification button to uninstall.
+ message_center::MessageCenter::Get()->ClickOnNotificationButton(
+ GetNotificationId(extension->id()),
+ ExtensionStorageMonitor::BUTTON_UNINSTALL);
+
+ // Also fake accepting the uninstall.
+ content::WindowedNotificationObserver uninstalled_signal(
+ chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED,
+ content::Source<Profile>(profile()));
+ SimulateUninstallDialogAccept();
+ uninstalled_signal.Wait();
+}
+
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/extension_storage_monitor.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698