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

Unified Diff: chrome/browser/apps/ephemeral_app_service_browsertest.cc

Issue 383703002: Clear the ephemeral app cache from Clear Browsing Data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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
Index: chrome/browser/apps/ephemeral_app_service_browsertest.cc
diff --git a/chrome/browser/apps/ephemeral_app_service_browsertest.cc b/chrome/browser/apps/ephemeral_app_service_browsertest.cc
index 9ecf7a8ad18c4aa5be0251e0854a97b1a28df3ba..ba671b97cdedf1007c00039ae23090861e023d6f 100644
--- a/chrome/browser/apps/ephemeral_app_service_browsertest.cc
+++ b/chrome/browser/apps/ephemeral_app_service_browsertest.cc
@@ -99,8 +99,7 @@ IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest,
}
// Verify that the count of ephemeral apps is maintained correctly.
-IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest,
- EphemeralAppCount) {
+IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest, EphemeralAppCount) {
EphemeralAppService* ephemeral_service =
EphemeralAppService::Get(browser()->profile());
ASSERT_TRUE(ephemeral_service);
@@ -129,3 +128,28 @@ IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest,
PromoteEphemeralApp(app);
EXPECT_EQ(0, ephemeral_service->ephemeral_app_count());
}
+
+// Verify that the cache of ephemeral apps is correctly cleared. Running apps
+// should not be removed.
+IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest, ClearCachedApps) {
+ const Extension* running_app =
+ InstallAndLaunchEphemeralApp(kMessagingReceiverApp);
+ const Extension* inactive_app =
+ InstallAndLaunchEphemeralApp(kDispatchEventTestApp);
+ std::string inactive_app_id = inactive_app->id();
+ std::string running_app_id = running_app->id();
+ CloseApp(inactive_app_id);
+
+ EphemeralAppService* ephemeral_service =
+ EphemeralAppService::Get(browser()->profile());
+ ASSERT_TRUE(ephemeral_service);
+ ephemeral_service->ClearCachedApps();
tapted 2014/07/11 01:16:36 before this, perhaps EXPECT_EQ(2, ephemeral_servic
tmdiep 2014/07/11 03:11:43 Done.
+
+ ExtensionService* service =
+ ExtensionSystem::Get(browser()->profile())->extension_service();
tapted 2014/07/11 01:16:36 nit: I think you're inheriting an `extension_servi
tmdiep 2014/07/11 03:11:43 Updated to use ExtensionRegistry since the functio
+ ASSERT_TRUE(service);
+ EXPECT_FALSE(service->GetInstalledExtension(inactive_app_id));
+ EXPECT_TRUE(service->GetInstalledExtension(running_app_id));
+
+ EXPECT_EQ(1, ephemeral_service->ephemeral_app_count());
+}

Powered by Google App Engine
This is Rietveld 408576698