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" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "extensions/browser/extension_prefs.h" | 32 #include "extensions/browser/extension_prefs.h" |
33 #include "extensions/browser/extension_registry.h" | 33 #include "extensions/browser/extension_registry.h" |
34 #include "extensions/browser/extension_registry_observer.h" | 34 #include "extensions/browser/extension_registry_observer.h" |
35 #include "extensions/browser/extension_system.h" | 35 #include "extensions/browser/extension_system.h" |
36 #include "extensions/browser/extension_util.h" | 36 #include "extensions/browser/extension_util.h" |
37 #include "extensions/browser/notification_types.h" | 37 #include "extensions/browser/notification_types.h" |
38 #include "extensions/browser/process_manager.h" | 38 #include "extensions/browser/process_manager.h" |
39 #include "extensions/browser/uninstall_reason.h" | 39 #include "extensions/browser/uninstall_reason.h" |
40 #include "extensions/common/extension.h" | 40 #include "extensions/common/extension.h" |
41 #include "extensions/common/switches.h" | 41 #include "extensions/common/switches.h" |
| 42 #include "extensions/test/result_catcher.h" |
42 #include "sync/api/fake_sync_change_processor.h" | 43 #include "sync/api/fake_sync_change_processor.h" |
43 #include "sync/api/sync_change_processor_wrapper_for_test.h" | 44 #include "sync/api/sync_change_processor_wrapper_for_test.h" |
44 #include "sync/api/sync_error_factory_mock.h" | 45 #include "sync/api/sync_error_factory_mock.h" |
45 #include "ui/message_center/message_center.h" | 46 #include "ui/message_center/message_center.h" |
46 #include "ui/message_center/notifier_settings.h" | 47 #include "ui/message_center/notifier_settings.h" |
47 | 48 |
48 using extensions::AppSyncData; | 49 using extensions::AppSyncData; |
49 using extensions::Event; | 50 using extensions::Event; |
50 using extensions::EventRouter; | 51 using extensions::EventRouter; |
51 using extensions::Extension; | 52 using extensions::Extension; |
52 using extensions::ExtensionPrefs; | 53 using extensions::ExtensionPrefs; |
53 using extensions::ExtensionRegistry; | 54 using extensions::ExtensionRegistry; |
54 using extensions::ExtensionRegistryObserver; | 55 using extensions::ExtensionRegistryObserver; |
55 using extensions::ExtensionSystem; | 56 using extensions::ExtensionSystem; |
56 using extensions::Manifest; | 57 using extensions::Manifest; |
| 58 using extensions::ResultCatcher; |
57 | 59 |
58 namespace { | 60 namespace { |
59 | 61 |
60 namespace alarms = extensions::api::alarms; | 62 namespace alarms = extensions::api::alarms; |
61 | 63 |
62 const char kPowerTestApp[] = "ephemeral_apps/power"; | 64 const char kPowerTestApp[] = "ephemeral_apps/power"; |
63 | 65 |
64 // Enabling sync causes these tests to be flaky on Windows. Disable sync so that | 66 // Enabling sync causes these tests to be flaky on Windows. Disable sync so that |
65 // everything else can be tested. See crbug.com/401028 | 67 // everything else can be tested. See crbug.com/401028 |
66 #if defined(OS_WIN) | 68 #if defined(OS_WIN) |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 | 604 |
603 // Verify that ephemeral apps will receive messages while they are running. | 605 // Verify that ephemeral apps will receive messages while they are running. |
604 // Flaky test: crbug.com/394426 | 606 // Flaky test: crbug.com/394426 |
605 IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, | 607 IN_PROC_BROWSER_TEST_F(EphemeralAppBrowserTest, |
606 DISABLED_ReceiveMessagesWhenLaunched) { | 608 DISABLED_ReceiveMessagesWhenLaunched) { |
607 const Extension* receiver = | 609 const Extension* receiver = |
608 InstallAndLaunchEphemeralApp(kMessagingReceiverApp); | 610 InstallAndLaunchEphemeralApp(kMessagingReceiverApp); |
609 ASSERT_TRUE(receiver); | 611 ASSERT_TRUE(receiver); |
610 | 612 |
611 // Verify that messages are received while the app is running. | 613 // Verify that messages are received while the app is running. |
612 ExtensionApiTest::ResultCatcher result_catcher; | 614 ResultCatcher result_catcher; |
613 LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_success", | 615 LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_success", |
614 "Launched"); | 616 "Launched"); |
615 EXPECT_TRUE(result_catcher.GetNextResult()); | 617 EXPECT_TRUE(result_catcher.GetNextResult()); |
616 | 618 |
617 CloseAppWaitForUnload(receiver->id()); | 619 CloseAppWaitForUnload(receiver->id()); |
618 | 620 |
619 // Verify that messages are not received while the app is inactive. | 621 // Verify that messages are not received while the app is inactive. |
620 LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_fail", "Launched"); | 622 LoadAndLaunchPlatformApp("ephemeral_apps/messaging_sender_fail", "Launched"); |
621 EXPECT_TRUE(result_catcher.GetNextResult()); | 623 EXPECT_TRUE(result_catcher.GetNextResult()); |
622 } | 624 } |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1033 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); | 1035 base::Bind(&PowerSaveBlockerStub::Create, &power_settings)); |
1034 | 1036 |
1035 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); | 1037 const Extension* app = InstallAndLaunchEphemeralApp(kPowerTestApp); |
1036 ASSERT_TRUE(app); | 1038 ASSERT_TRUE(app); |
1037 EXPECT_EQ(1, power_settings.keep_awake_count()); | 1039 EXPECT_EQ(1, power_settings.keep_awake_count()); |
1038 | 1040 |
1039 CloseAppWaitForUnload(app->id()); | 1041 CloseAppWaitForUnload(app->id()); |
1040 | 1042 |
1041 EXPECT_EQ(0, power_settings.keep_awake_count()); | 1043 EXPECT_EQ(0, power_settings.keep_awake_count()); |
1042 } | 1044 } |
OLD | NEW |