OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "apps/saved_files_service.h" | 5 #include "apps/saved_files_service.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "chrome/browser/apps/app_browsertest_util.h" | 8 #include "chrome/browser/apps/app_browsertest_util.h" |
9 #include "chrome/browser/apps/ephemeral_app_service.h" | 9 #include "chrome/browser/apps/ephemeral_app_service.h" |
10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 10 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 void EvictApp(const std::string& app_id) { | 156 void EvictApp(const std::string& app_id) { |
157 // Uninstall the app, which is what happens when ephemeral apps get evicted | 157 // Uninstall the app, which is what happens when ephemeral apps get evicted |
158 // from the cache. | 158 // from the cache. |
159 content::WindowedNotificationObserver uninstalled_signal( | 159 content::WindowedNotificationObserver uninstalled_signal( |
160 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, | 160 chrome::NOTIFICATION_EXTENSION_UNINSTALLED, |
161 content::Source<Profile>(browser()->profile())); | 161 content::Source<Profile>(browser()->profile())); |
162 | 162 |
163 ExtensionService* service = | 163 ExtensionService* service = |
164 ExtensionSystem::Get(browser()->profile())->extension_service(); | 164 ExtensionSystem::Get(browser()->profile())->extension_service(); |
165 ASSERT_TRUE(service); | 165 ASSERT_TRUE(service); |
166 service->UninstallExtension(app_id, false, NULL); | 166 service->UninstallExtension( |
| 167 app_id, |
| 168 ExtensionService::kUninstallReasonOrphanedEphemeralExtension, |
| 169 NULL); |
167 | 170 |
168 uninstalled_signal.Wait(); | 171 uninstalled_signal.Wait(); |
169 } | 172 } |
170 | 173 |
171 void VerifyAppNotLoaded(const std::string& app_id) { | 174 void VerifyAppNotLoaded(const std::string& app_id) { |
172 EXPECT_FALSE(ExtensionSystem::Get(browser()->profile())-> | 175 EXPECT_FALSE(ExtensionSystem::Get(browser()->profile())-> |
173 process_manager()->GetBackgroundHostForExtension(app_id)); | 176 process_manager()->GetBackgroundHostForExtension(app_id)); |
174 } | 177 } |
175 | 178 |
176 void DispatchAlarmEvent(EventRouter* event_router, | 179 void DispatchAlarmEvent(EventRouter* event_router, |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 505 |
503 // The garbage collected app should no longer be in the preferences. | 506 // The garbage collected app should no longer be in the preferences. |
504 extensions_info = prefs->GetEvictedEphemeralAppsInfo(); | 507 extensions_info = prefs->GetEvictedEphemeralAppsInfo(); |
505 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id)); | 508 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id)); |
506 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id)); | 509 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id)); |
507 | 510 |
508 // Reinstall the app and verify that all data has been reset. | 511 // Reinstall the app and verify that all data has been reset. |
509 evict_app = InstallEphemeralApp(kRetainDataApp); | 512 evict_app = InstallEphemeralApp(kRetainDataApp); |
510 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_; | 513 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_; |
511 } | 514 } |
OLD | NEW |