| 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/app_restore_service.h" | 9 #include "apps/app_restore_service.h" |
| 10 #include "apps/saved_files_service.h" | 10 #include "apps/saved_files_service.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
| 12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "base/stl_util.h" | 13 #include "base/stl_util.h" |
| 14 #include "chrome/browser/apps/app_browsertest_util.h" | 14 #include "chrome/browser/apps/app_browsertest_util.h" |
| 15 #include "chrome/browser/apps/ephemeral_app_service.h" | 15 #include "chrome/browser/apps/ephemeral_app_service.h" |
| 16 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 16 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 17 #include "chrome/browser/extensions/app_sync_data.h" | 17 #include "chrome/browser/extensions/app_sync_data.h" |
| 18 #include "chrome/browser/extensions/extension_service.h" | 18 #include "chrome/browser/extensions/extension_service.h" |
| 19 #include "chrome/browser/extensions/extension_sync_service.h" | 19 #include "chrome/browser/extensions/extension_sync_service.h" |
| 20 #include "chrome/browser/extensions/extension_util.h" | 20 #include "chrome/browser/extensions/extension_util.h" |
| 21 #include "chrome/browser/notifications/desktop_notification_service.h" | 21 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 22 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 22 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 23 #include "chrome/common/extensions/api/alarms.h" | |
| 24 #include "content/public/browser/power_save_blocker.h" | 23 #include "content/public/browser/power_save_blocker.h" |
| 25 #include "content/public/test/browser_test.h" | 24 #include "content/public/test/browser_test.h" |
| 26 #include "content/public/test/test_utils.h" | 25 #include "content/public/test/test_utils.h" |
| 27 #include "extensions/browser/api/power/power_api_manager.h" | 26 #include "extensions/browser/api/power/power_api_manager.h" |
| 28 #include "extensions/browser/app_sorting.h" | 27 #include "extensions/browser/app_sorting.h" |
| 29 #include "extensions/browser/event_router.h" | 28 #include "extensions/browser/event_router.h" |
| 30 #include "extensions/browser/extension_prefs.h" | 29 #include "extensions/browser/extension_prefs.h" |
| 31 #include "extensions/browser/extension_registry.h" | 30 #include "extensions/browser/extension_registry.h" |
| 32 #include "extensions/browser/extension_registry_observer.h" | 31 #include "extensions/browser/extension_registry_observer.h" |
| 33 #include "extensions/browser/extension_system.h" | 32 #include "extensions/browser/extension_system.h" |
| 34 #include "extensions/browser/extension_util.h" | 33 #include "extensions/browser/extension_util.h" |
| 35 #include "extensions/browser/notification_types.h" | 34 #include "extensions/browser/notification_types.h" |
| 36 #include "extensions/browser/process_manager.h" | 35 #include "extensions/browser/process_manager.h" |
| 37 #include "extensions/browser/uninstall_reason.h" | 36 #include "extensions/browser/uninstall_reason.h" |
| 37 #include "extensions/common/api/alarms.h" |
| 38 #include "extensions/common/extension.h" | 38 #include "extensions/common/extension.h" |
| 39 #include "extensions/test/extension_test_message_listener.h" | 39 #include "extensions/test/extension_test_message_listener.h" |
| 40 #include "extensions/test/result_catcher.h" | 40 #include "extensions/test/result_catcher.h" |
| 41 #include "sync/api/fake_sync_change_processor.h" | 41 #include "sync/api/fake_sync_change_processor.h" |
| 42 #include "sync/api/sync_change_processor_wrapper_for_test.h" | 42 #include "sync/api/sync_change_processor_wrapper_for_test.h" |
| 43 #include "sync/api/sync_error_factory_mock.h" | 43 #include "sync/api/sync_error_factory_mock.h" |
| 44 #include "ui/app_list/app_list_switches.h" | 44 #include "ui/app_list/app_list_switches.h" |
| 45 #include "ui/message_center/message_center.h" | 45 #include "ui/message_center/message_center.h" |
| 46 #include "ui/message_center/notifier_settings.h" | 46 #include "ui/message_center/notifier_settings.h" |
| 47 | 47 |
| 48 using extensions::AppSyncData; | 48 using extensions::AppSyncData; |
| 49 using extensions::Event; | 49 using extensions::Event; |
| 50 using extensions::EventRouter; | 50 using extensions::EventRouter; |
| 51 using extensions::Extension; | 51 using extensions::Extension; |
| 52 using extensions::ExtensionPrefs; | 52 using extensions::ExtensionPrefs; |
| 53 using extensions::ExtensionRegistry; | 53 using extensions::ExtensionRegistry; |
| 54 using extensions::ExtensionRegistryObserver; | 54 using extensions::ExtensionRegistryObserver; |
| 55 using extensions::ExtensionSystem; | 55 using extensions::ExtensionSystem; |
| 56 using extensions::Manifest; | 56 using extensions::Manifest; |
| 57 using extensions::ResultCatcher; | 57 using extensions::ResultCatcher; |
| 58 | 58 |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 namespace alarms = extensions::api::alarms; | 61 namespace alarms = extensions::core_api::alarms; |
| 62 | 62 |
| 63 const char kPowerTestApp[] = "ephemeral_apps/power"; | 63 const char kPowerTestApp[] = "ephemeral_apps/power"; |
| 64 | 64 |
| 65 // Enabling sync causes these tests to be flaky on Windows. Disable sync so that | 65 // Enabling sync causes these tests to be flaky on Windows. Disable sync so that |
| 66 // everything else can be tested. See crbug.com/401028 | 66 // everything else can be tested. See crbug.com/401028 |
| 67 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
| 68 const bool kEnableSync = false; | 68 const bool kEnableSync = false; |
| 69 #else | 69 #else |
| 70 const bool kEnableSync = true; | 70 const bool kEnableSync = true; |
| 71 #endif | 71 #endif |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); | 1032 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); |
| 1033 | 1033 |
| 1034 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); | 1034 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); |
| 1035 ASSERT_TRUE(app); | 1035 ASSERT_TRUE(app); |
| 1036 EXPECT_EQ(1, power_settings.keep_awake_count()); | 1036 EXPECT_EQ(1, power_settings.keep_awake_count()); |
| 1037 | 1037 |
| 1038 CloseAppWaitForUnload(app->id()); | 1038 CloseAppWaitForUnload(app->id()); |
| 1039 | 1039 |
| 1040 EXPECT_EQ(0, power_settings.keep_awake_count()); | 1040 EXPECT_EQ(0, power_settings.keep_awake_count()); |
| 1041 } | 1041 } |
| OLD | NEW |