Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Side by Side Diff: chrome/browser/apps/app_browsertest.cc

Issue 462533002: Make runtime.reload() work with component extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix segfault in test... I think. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
1084
1054 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Messaging) { 1085 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, Messaging) {
1055 ExtensionApiTest::ResultCatcher result_catcher; 1086 ExtensionApiTest::ResultCatcher result_catcher;
1056 LoadAndLaunchPlatformApp("messaging/app2", "Ready"); 1087 LoadAndLaunchPlatformApp("messaging/app2", "Ready");
1057 LoadAndLaunchPlatformApp("messaging/app1", "Launched"); 1088 LoadAndLaunchPlatformApp("messaging/app1", "Launched");
1058 EXPECT_TRUE(result_catcher.GetNextResult()); 1089 EXPECT_TRUE(result_catcher.GetNextResult());
1059 } 1090 }
1060 1091
1061 // TODO(linux_aura) http://crbug.com/163931 1092 // TODO(linux_aura) http://crbug.com/163931
1062 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) 1093 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA)
1063 #define MAYBE_WebContentsHasFocus DISABLED_WebContentsHasFocus 1094 #define MAYBE_WebContentsHasFocus DISABLED_WebContentsHasFocus
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1284 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched"); 1315 LoadAndLaunchPlatformApp("reinstall_data_cleanup", "Launched");
1285 ASSERT_TRUE(extension); 1316 ASSERT_TRUE(extension);
1286 ASSERT_EQ(extension_id, extension->id()); 1317 ASSERT_EQ(extension_id, extension->id());
1287 1318
1288 ExtensionApiTest::ResultCatcher result_catcher; 1319 ExtensionApiTest::ResultCatcher result_catcher;
1289 EXPECT_TRUE(result_catcher.GetNextResult()); 1320 EXPECT_TRUE(result_catcher.GetNextResult());
1290 } 1321 }
1291 } 1322 }
1292 1323
1293 } // namespace extensions 1324 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_service.cc » ('j') | chrome/browser/extensions/extension_service.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698