| OLD | NEW |
| (Empty) |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include <vector> | |
| 6 | |
| 7 #include "chrome/browser/apps/ephemeral_app_browsertest.h" | |
| 8 #include "chrome/browser/apps/ephemeral_app_service.h" | |
| 9 #include "extensions/browser/extension_registry.h" | |
| 10 | |
| 11 using extensions::Extension; | |
| 12 using extensions::ExtensionRegistry; | |
| 13 | |
| 14 class EphemeralAppServiceBrowserTest : public EphemeralAppTestBase {}; | |
| 15 | |
| 16 // Verify that the cache of ephemeral apps is correctly cleared. All ephemeral | |
| 17 // apps should be removed. | |
| 18 IN_PROC_BROWSER_TEST_F(EphemeralAppServiceBrowserTest, ClearCachedApps) { | |
| 19 const Extension* running_app = | |
| 20 InstallAndLaunchEphemeralApp(kMessagingReceiverApp); | |
| 21 const Extension* inactive_app = | |
| 22 InstallAndLaunchEphemeralApp(kDispatchEventTestApp); | |
| 23 std::string inactive_app_id = inactive_app->id(); | |
| 24 std::string running_app_id = running_app->id(); | |
| 25 CloseAppWaitForUnload(inactive_app_id); | |
| 26 | |
| 27 EphemeralAppService* ephemeral_service = | |
| 28 EphemeralAppService::Get(browser()->profile()); | |
| 29 ASSERT_TRUE(ephemeral_service); | |
| 30 | |
| 31 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | |
| 32 ASSERT_TRUE(registry); | |
| 33 | |
| 34 int extension_count = registry->GenerateInstalledExtensionsSet()->size(); | |
| 35 | |
| 36 ephemeral_service->ClearCachedApps(); | |
| 37 | |
| 38 EXPECT_FALSE(registry->GetExtensionById(inactive_app_id, | |
| 39 ExtensionRegistry::EVERYTHING)); | |
| 40 EXPECT_FALSE(registry->GetExtensionById(running_app_id, | |
| 41 ExtensionRegistry::EVERYTHING)); | |
| 42 | |
| 43 int new_extension_count = registry->GenerateInstalledExtensionsSet()->size(); | |
| 44 EXPECT_EQ(2, extension_count - new_extension_count); | |
| 45 } | |
| OLD | NEW |