Chromium Code Reviews| 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool LaunchAppAndRunTest(const Extension* app, const char* test_name) { | 123 bool LaunchAppAndRunTest(const Extension* app, const char* test_name) { |
| 124 ExtensionTestMessageListener launched_listener("launched", true); | 124 ExtensionTestMessageListener launched_listener("launched", true); |
| 125 LaunchPlatformApp(app); | 125 LaunchPlatformApp(app); |
| 126 if (!launched_listener.WaitUntilSatisfied()) { | 126 if (!launched_listener.WaitUntilSatisfied()) { |
| 127 message_ = "Failed to receive launched message from test"; | 127 message_ = "Failed to receive launched message from test"; |
| 128 return false; | 128 return false; |
| 129 } | 129 } |
| 130 | 130 |
| 131 ResultCatcher catcher; | |
| 131 launched_listener.Reply(test_name); | 132 launched_listener.Reply(test_name); |
| 132 | 133 |
| 133 ResultCatcher catcher; | 134 bool result = catcher.GetNextResult(); |
| 134 if (!catcher.GetNextResult()) { | 135 if (!result) |
|
tapted
2014/05/14 01:54:58
nit: this `if` probably isn't needed (i.e. do `mes
| |
| 135 message_ = catcher.message(); | 136 message_ = catcher.message(); |
| 136 return false; | |
| 137 } | |
| 138 | 137 |
| 139 CloseApp(app->id()); | 138 CloseApp(app->id()); |
| 140 return true; | 139 return result; |
| 141 } | 140 } |
| 142 | 141 |
| 143 void CloseApp(const std::string& app_id) { | 142 void CloseApp(const std::string& app_id) { |
| 144 content::WindowedNotificationObserver event_page_destroyed_signal( | 143 content::WindowedNotificationObserver event_page_destroyed_signal( |
| 145 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, | 144 chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| 146 content::Source<Profile>(browser()->profile())); | 145 content::Source<Profile>(browser()->profile())); |
| 147 | 146 |
| 148 EXPECT_EQ(1U, GetAppWindowCountForApp(app_id)); | 147 EXPECT_EQ(1U, GetAppWindowCountForApp(app_id)); |
| 149 apps::AppWindow* app_window = GetFirstAppWindowForApp(app_id); | 148 apps::AppWindow* app_window = GetFirstAppWindowForApp(app_id); |
| 150 ASSERT_TRUE(app_window); | 149 ASSERT_TRUE(app_window); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 | 501 |
| 503 // The garbage collected app should no longer be in the preferences. | 502 // The garbage collected app should no longer be in the preferences. |
| 504 extensions_info = prefs->GetEvictedEphemeralAppsInfo(); | 503 extensions_info = prefs->GetEvictedEphemeralAppsInfo(); |
| 505 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id)); | 504 EXPECT_TRUE(IsAppInExtensionsInfo(*extensions_info, retain_app_id)); |
| 506 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id)); | 505 ASSERT_FALSE(IsAppInExtensionsInfo(*extensions_info, evict_app_id)); |
| 507 | 506 |
| 508 // Reinstall the app and verify that all data has been reset. | 507 // Reinstall the app and verify that all data has been reset. |
| 509 evict_app = InstallEphemeralApp(kRetainDataApp); | 508 evict_app = InstallEphemeralApp(kRetainDataApp); |
| 510 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_; | 509 ASSERT_TRUE(LaunchAppAndRunTest(evict_app, "DataReset")) << message_; |
| 511 } | 510 } |
| OLD | NEW |