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

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

Issue 1497193002: Remove all the ephemeral apps code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Tests Created 5 years 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
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 1865a131db2ad0518f8ac8b95c09b8b2abeed80b..10b7c25c5c7a98f3c462527a507c1fe517f044f6 100644
--- a/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
+++ b/chrome/browser/extensions/extension_storage_monitor_browsertest.cc
@@ -97,11 +97,6 @@ class ExtensionStorageMonitorTest : public ExtensionBrowserTest {
return storage_monitor_->initial_extension_threshold_;
}
- int64 GetInitialEphemeralThreshold() {
- CHECK(storage_monitor_);
- return storage_monitor_->initial_ephemeral_threshold_;
- }
-
void DisableForInstalledExtensions() {
CHECK(storage_monitor_);
storage_monitor_->enable_for_all_extensions_ = false;
@@ -114,19 +109,6 @@ class ExtensionStorageMonitorTest : public ExtensionBrowserTest {
return extension;
}
- const Extension* InitWriteDataEphemeralApp() {
- // The threshold for installed extensions should be higher than ephemeral
- // apps.
- storage_monitor_->initial_extension_threshold_ =
- storage_monitor_->initial_ephemeral_threshold_ * 4;
-
- base::FilePath path = test_data_dir_.AppendASCII(kWriteDataApp);
- const Extension* extension = InstallEphemeralAppWithSourceAndFlags(
- path, 1, Manifest::INTERNAL, Extension::NO_FLAGS);
- EXPECT_TRUE(extension);
- return extension;
- }
-
std::string GetNotificationId(const std::string& extension_id) {
return monitor()->GetNotificationId(extension_id);
}
@@ -160,7 +142,6 @@ class ExtensionStorageMonitorTest : public ExtensionBrowserTest {
// to trigger notifications in these tests.
storage_monitor_->enable_for_all_extensions_ = true;
storage_monitor_->initial_extension_threshold_ = kInitialUsageThreshold;
- storage_monitor_->initial_ephemeral_threshold_ = kInitialUsageThreshold;
// To ensure storage events are dispatched from QuotaManager immediately.
storage_monitor_->observer_rate_ = base::TimeDelta();
@@ -257,52 +238,6 @@ IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest, UserDisabledNotifications) {
WriteBytesNotExpectingNotification(extension, next_data_size);
}
-// Verify that thresholds for ephemeral apps are reset when they are
-// promoted to regular installed apps.
-IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest, EphemeralAppLowUsage) {
- const Extension* extension = InitWriteDataEphemeralApp();
- ASSERT_TRUE(extension);
- WriteBytesExpectingNotification(extension, GetInitialEphemeralThreshold());
-
- // Store the number of bytes until the next threshold is reached.
- int64 next_threshold = GetNextStorageThreshold(extension->id());
- int64 next_data_size = next_threshold - GetInitialEphemeralThreshold();
- ASSERT_GT(next_data_size, 0);
- EXPECT_GE(GetInitialExtensionThreshold(), next_threshold);
-
- // Promote the ephemeral app.
- ExtensionService* service =
- ExtensionSystem::Get(profile())->extension_service();
- service->PromoteEphemeralApp(extension, false);
-
- // The next threshold should now be equal to the initial threshold for
- // extensions (which is higher than the initial threshold for ephemeral apps).
- EXPECT_EQ(GetInitialExtensionThreshold(),
- GetNextStorageThreshold(extension->id()));
-
- // Since the threshold was increased, a notification should not be
- // triggered.
- WriteBytesNotExpectingNotification(extension, next_data_size);
-}
-
-// Verify that thresholds for ephemeral apps are not reset when they are
-// promoted to regular installed apps if their usage is higher than the initial
-// threshold for installed extensions.
-IN_PROC_BROWSER_TEST_F(ExtensionStorageMonitorTest, EphemeralAppWithHighUsage) {
- const Extension* extension = InitWriteDataEphemeralApp();
- ASSERT_TRUE(extension);
- WriteBytesExpectingNotification(extension, GetInitialExtensionThreshold());
- int64 saved_next_threshold = GetNextStorageThreshold(extension->id());
-
- // Promote the ephemeral app.
- ExtensionService* service =
- ExtensionSystem::Get(profile())->extension_service();
- service->PromoteEphemeralApp(extension, false);
-
- // The next threshold should not have changed.
- EXPECT_EQ(saved_next_threshold, GetNextStorageThreshold(extension->id()));
-}
-
// Ensure that monitoring is disabled for installed extensions if
// |enable_for_all_extensions_| is false. This test can be removed if monitoring
// is eventually enabled for all extensions.

Powered by Google App Engine
This is Rietveld 408576698