| 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 base::FilePath()); | 270 base::FilePath()); |
| 271 ASSERT_FALSE(app_v2_path.empty()); | 271 ASSERT_FALSE(app_v2_path.empty()); |
| 272 | 272 |
| 273 // Update the ephemeral app and wait for the update to finish. | 273 // Update the ephemeral app and wait for the update to finish. |
| 274 extensions::CrxInstaller* crx_installer = NULL; | 274 extensions::CrxInstaller* crx_installer = NULL; |
| 275 content::WindowedNotificationObserver windowed_observer( | 275 content::WindowedNotificationObserver windowed_observer( |
| 276 chrome::NOTIFICATION_CRX_INSTALLER_DONE, | 276 chrome::NOTIFICATION_CRX_INSTALLER_DONE, |
| 277 content::Source<extensions::CrxInstaller>(crx_installer)); | 277 content::Source<extensions::CrxInstaller>(crx_installer)); |
| 278 ExtensionService* service = | 278 ExtensionService* service = |
| 279 ExtensionSystem::Get(browser()->profile())->extension_service(); | 279 ExtensionSystem::Get(browser()->profile())->extension_service(); |
| 280 EXPECT_TRUE(service->UpdateExtension(app_id, app_v2_path, true, GURL(), | 280 EXPECT_TRUE(service->UpdateExtension(app_id, app_v2_path, true, |
| 281 &crx_installer)); | 281 &crx_installer)); |
| 282 windowed_observer.Wait(); | 282 windowed_observer.Wait(); |
| 283 | 283 |
| 284 const Extension* app_v2 = service->GetExtensionById(app_id, false); | 284 const Extension* app_v2 = service->GetExtensionById(app_id, false); |
| 285 ASSERT_TRUE(app_v2); | 285 ASSERT_TRUE(app_v2); |
| 286 EXPECT_TRUE(app_v2->version()->CompareTo(app_original_version) > 0); | 286 EXPECT_TRUE(app_v2->version()->CompareTo(app_original_version) > 0); |
| 287 EXPECT_TRUE(app_v2->is_ephemeral()); | 287 EXPECT_TRUE(app_v2->is_ephemeral()); |
| 288 } | 288 } |
| 289 | 289 |
| 290 // Verify that if notifications have been disabled for an ephemeral app, it will | 290 // Verify that if notifications have been disabled for an ephemeral app, it will |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 502 |
| 503 // The garbage collected app should no longer be in the preferences. | 503 // The garbage collected app should no longer be in the preferences. |
| 504 extensions_info = prefs->GetEvictedEphemeralAppsInfo(); | 504 extensions_info = prefs->GetEvictedEphemeralAppsInfo(); |
| 505 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id)); | 505 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id)); |
| 506 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id)); | 506 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id)); |
| 507 | 507 |
| 508 // Reinstall the app and verify that all data has been reset. | 508 // Reinstall the app and verify that all data has been reset. |
| 509 evict_app = InstallEphemeralApp(kRetainDataApp); | 509 evict_app = InstallEphemeralApp(kRetainDataApp); |
| 510 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_; | 510 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_; |
| 511 } | 511 } |
| OLD | NEW |