| 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 "chrome/browser/apps/ephemeral_app_browsertest.h" | 5 #include "chrome/browser/apps/ephemeral_app_browsertest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "apps/saved_files_service.h" | 9 #include "apps/saved_files_service.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "content/public/test/browser_test.h" | 24 #include "content/public/test/browser_test.h" |
| 25 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 26 #include "extensions/browser/app_sorting.h" | 26 #include "extensions/browser/app_sorting.h" |
| 27 #include "extensions/browser/event_router.h" | 27 #include "extensions/browser/event_router.h" |
| 28 #include "extensions/browser/extension_prefs.h" | 28 #include "extensions/browser/extension_prefs.h" |
| 29 #include "extensions/browser/extension_registry.h" | 29 #include "extensions/browser/extension_registry.h" |
| 30 #include "extensions/browser/extension_registry_observer.h" | 30 #include "extensions/browser/extension_registry_observer.h" |
| 31 #include "extensions/browser/extension_system.h" | 31 #include "extensions/browser/extension_system.h" |
| 32 #include "extensions/browser/extension_util.h" | 32 #include "extensions/browser/extension_util.h" |
| 33 #include "extensions/browser/process_manager.h" | 33 #include "extensions/browser/process_manager.h" |
| 34 #include "extensions/browser/uninstall_reason.h" |
| 34 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
| 35 #include "extensions/common/switches.h" | 36 #include "extensions/common/switches.h" |
| 36 #include "sync/api/fake_sync_change_processor.h" | 37 #include "sync/api/fake_sync_change_processor.h" |
| 37 #include "sync/api/sync_change_processor_wrapper_for_test.h" | 38 #include "sync/api/sync_change_processor_wrapper_for_test.h" |
| 38 #include "sync/api/sync_error_factory_mock.h" | 39 #include "sync/api/sync_error_factory_mock.h" |
| 39 #include "ui/message_center/message_center.h" | 40 #include "ui/message_center/message_center.h" |
| 40 #include "ui/message_center/notifier_settings.h" | 41 #include "ui/message_center/notifier_settings.h" |
| 41 | 42 |
| 42 using extensions::AppSyncData; | 43 using extensions::AppSyncData; |
| 43 using extensions::Event; | 44 using extensions::Event; |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 // Uninstall the app, which is what happens when ephemeral apps get evicted | 238 // Uninstall the app, which is what happens when ephemeral apps get evicted |
| 238 // from the cache. | 239 // from the cache. |
| 239 content::WindowedNotificationObserver uninstalled_signal( | 240 content::WindowedNotificationObserver uninstalled_signal( |
| 240 chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, | 241 chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, |
| 241 content::Source<Profile>(profile())); | 242 content::Source<Profile>(profile())); |
| 242 | 243 |
| 243 ExtensionService* service = | 244 ExtensionService* service = |
| 244 ExtensionSystem::Get(profile())->extension_service(); | 245 ExtensionSystem::Get(profile())->extension_service(); |
| 245 ASSERT_TRUE(service); | 246 ASSERT_TRUE(service); |
| 246 service->UninstallExtension( | 247 service->UninstallExtension( |
| 247 app_id, | 248 app_id, extensions::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION, NULL); |
| 248 ExtensionService::UNINSTALL_REASON_ORPHANED_EPHEMERAL_EXTENSION, | |
| 249 NULL); | |
| 250 | 249 |
| 251 uninstalled_signal.Wait(); | 250 uninstalled_signal.Wait(); |
| 252 } | 251 } |
| 253 | 252 |
| 254 // EphemeralAppBrowserTest: | 253 // EphemeralAppBrowserTest: |
| 255 | 254 |
| 256 class EphemeralAppBrowserTest : public EphemeralAppTestBase { | 255 class EphemeralAppBrowserTest : public EphemeralAppTestBase { |
| 257 protected: | 256 protected: |
| 258 bool LaunchAppAndRunTest(const Extension* app, const char* test_name) { | 257 bool LaunchAppAndRunTest(const Extension* app, const char* test_name) { |
| 259 ExtensionTestMessageListener launched_listener("launched", true); | 258 ExtensionTestMessageListener launched_listener("launched", true); |
| (...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 | 703 |
| 705 // Ensure that when the app is promoted to an installed app, the bit in the | 704 // Ensure that when the app is promoted to an installed app, the bit in the |
| 706 // creation flags is cleared. | 705 // creation flags is cleared. |
| 707 PromoteEphemeralApp(app); | 706 PromoteEphemeralApp(app); |
| 708 EXPECT_FALSE(extensions::util::IsEphemeralApp(app->id(), profile())); | 707 EXPECT_FALSE(extensions::util::IsEphemeralApp(app->id(), profile())); |
| 709 | 708 |
| 710 int creation_flags = | 709 int creation_flags = |
| 711 ExtensionPrefs::Get(profile())->GetCreationFlags(app->id()); | 710 ExtensionPrefs::Get(profile())->GetCreationFlags(app->id()); |
| 712 EXPECT_EQ(0, creation_flags & Extension::IS_EPHEMERAL); | 711 EXPECT_EQ(0, creation_flags & Extension::IS_EPHEMERAL); |
| 713 } | 712 } |
| OLD | NEW |