OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_window.h" | 5 #include "apps/app_window.h" |
6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
7 #include "apps/launcher.h" | 7 #include "apps/launcher.h" |
8 #include "apps/ui/native_app_window.h" | 8 #include "apps/ui/native_app_window.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1044 app_loaded_observer.Wait(); | 1044 app_loaded_observer.Wait(); |
1045 ASSERT_TRUE(should_install.seen()); | 1045 ASSERT_TRUE(should_install.seen()); |
1046 | 1046 |
1047 ExtensionTestMessageListener launched_listener("Launched", false); | 1047 ExtensionTestMessageListener launched_listener("Launched", false); |
1048 OpenApplication(AppLaunchParams( | 1048 OpenApplication(AppLaunchParams( |
1049 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); | 1049 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); |
1050 | 1050 |
1051 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 1051 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
1052 } | 1052 } |
1053 | 1053 |
| 1054 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, |
| 1055 ComponentExtensionRuntimeReload) { |
| 1056 // Ensure that we wait until the background page is run (to register the |
| 1057 // OnLaunched listener) before trying to open the application. This is similar |
| 1058 // to LoadAndLaunchPlatformApp, but we want to load as a component extension. |
| 1059 content::WindowedNotificationObserver app_loaded_observer( |
| 1060 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, |
| 1061 content::NotificationService::AllSources()); |
| 1062 |
| 1063 const Extension* extension = LoadExtensionAsComponent( |
| 1064 test_data_dir_.AppendASCII("platform_apps").AppendASCII("component")); |
| 1065 ASSERT_TRUE(extension); |
| 1066 |
| 1067 app_loaded_observer.Wait(); |
| 1068 |
| 1069 { |
| 1070 ExtensionTestMessageListener launched_listener("Launched", false); |
| 1071 OpenApplication(AppLaunchParams( |
| 1072 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); |
| 1073 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 1074 } |
| 1075 |
| 1076 { |
| 1077 ASSERT_TRUE(ExecuteScriptInBackgroundPageNoWait( |
| 1078 extension->id(), "chrome.runtime.reload();")); |
| 1079 ExtensionTestMessageListener launched_listener("Launched", false); |
| 1080 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 1081 } |
| 1082 } |
| 1083 |
1054 // Fails on Win7. http://crbug.com/171450 | 1084 // Fails on Win7. http://crbug.com/171450 |
1055 #if defined(OS_WIN) | 1085 #if defined(OS_WIN) |
1056 #define MAYBE_Messaging DISABLED_Messaging | 1086 #define MAYBE_Messaging DISABLED_Messaging |
1057 #else | 1087 #else |
1058 #define MAYBE_Messaging Messaging | 1088 #define MAYBE_Messaging Messaging |
1059 #endif | 1089 #endif |
1060 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_Messaging) { | 1090 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_Messaging) { |
1061 ExtensionApiTest::ResultCatcher result_catcher; | 1091 ExtensionApiTest::ResultCatcher result_catcher; |
1062 LoadAndLaunchPlatformApp("messaging/app2", "Ready"); | 1092 LoadAndLaunchPlatformApp("messaging/app2", "Ready"); |
1063 LoadAndLaunchPlatformApp("messaging/app1", "Launched"); | 1093 LoadAndLaunchPlatformApp("messaging/app1", "Launched"); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1290 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); | 1320 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); |
1291 ASSERT_TRUE(extension); | 1321 ASSERT_TRUE(extension); |
1292 ASSERT_EQ(extension_id, extension->id()); | 1322 ASSERT_EQ(extension_id, extension->id()); |
1293 | 1323 |
1294 ExtensionApiTest::ResultCatcher result_catcher; | 1324 ExtensionApiTest::ResultCatcher result_catcher; |
1295 EXPECT_TRUE(result_catcher.GetNextResult()); | 1325 EXPECT_TRUE(result_catcher.GetNextResult()); |
1296 } | 1326 } |
1297 } | 1327 } |
1298 | 1328 |
1299 } // namespace extensions | 1329 } // namespace extensions |
OLD | NEW |