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

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

Issue 816893002: Added HostedAppLaunch for testing hosted app shims on Mac. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 "chrome/browser/apps/app_browsertest_util.h" 5 #include "chrome/browser/apps/app_browsertest_util.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/apps/scoped_keep_alive.h" 9 #include "chrome/browser/apps/scoped_keep_alive.h"
10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 10 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 91
92 const Extension* PlatformAppBrowserTest::InstallPlatformApp( 92 const Extension* PlatformAppBrowserTest::InstallPlatformApp(
93 const char* name) { 93 const char* name) {
94 const Extension* extension = InstallExtension( 94 const Extension* extension = InstallExtension(
95 test_data_dir_.AppendASCII("platform_apps").AppendASCII(name), 1); 95 test_data_dir_.AppendASCII("platform_apps").AppendASCII(name), 1);
96 EXPECT_TRUE(extension); 96 EXPECT_TRUE(extension);
97 97
98 return extension; 98 return extension;
99 } 99 }
100 100
101 const Extension* PlatformAppBrowserTest::InstallHostedApp() {
102 const Extension* extension =
103 InstallExtension(test_data_dir_.AppendASCII("hosted_app"), 1);
104 EXPECT_TRUE(extension);
105
106 return extension;
107 }
108
101 const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp( 109 const Extension* PlatformAppBrowserTest::InstallAndLaunchPlatformApp(
102 const char* name) { 110 const char* name) {
103 content::WindowedNotificationObserver app_loaded_observer( 111 content::WindowedNotificationObserver app_loaded_observer(
104 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, 112 content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME,
105 content::NotificationService::AllSources()); 113 content::NotificationService::AllSources());
106 114
107 const Extension* extension = InstallPlatformApp(name); 115 const Extension* extension = InstallPlatformApp(name);
108 116
109 LaunchPlatformApp(extension); 117 LaunchPlatformApp(extension);
110 118
111 app_loaded_observer.Wait(); 119 app_loaded_observer.Wait();
112 120
113 return extension; 121 return extension;
114 } 122 }
115 123
116 void PlatformAppBrowserTest::LaunchPlatformApp(const Extension* extension) { 124 void PlatformAppBrowserTest::LaunchPlatformApp(const Extension* extension) {
117 OpenApplication(AppLaunchParams(browser()->profile(), extension, 125 OpenApplication(AppLaunchParams(browser()->profile(), extension,
118 LAUNCH_CONTAINER_NONE, NEW_WINDOW, 126 LAUNCH_CONTAINER_NONE, NEW_WINDOW,
119 extensions::SOURCE_UNTRACKED)); 127 extensions::SOURCE_UNTRACKED));
120 } 128 }
121 129
130 void PlatformAppBrowserTest::LaunchHostedApp(const Extension* extension) {
131 AppLaunchParams launch_params(browser()->profile(), extension,
132 NEW_FOREGROUND_TAB,
133 extensions::SOURCE_COMMAND_LINE);
134 OpenApplication(launch_params);
135 }
136
122 WebContents* PlatformAppBrowserTest::GetFirstAppWindowWebContents() { 137 WebContents* PlatformAppBrowserTest::GetFirstAppWindowWebContents() {
123 AppWindow* window = GetFirstAppWindow(); 138 AppWindow* window = GetFirstAppWindow();
124 if (window) 139 if (window)
125 return window->web_contents(); 140 return window->web_contents();
126 141
127 return NULL; 142 return NULL;
128 } 143 }
129 144
130 AppWindow* PlatformAppBrowserTest::GetFirstAppWindow() { 145 AppWindow* PlatformAppBrowserTest::GetFirstAppWindow() {
131 return GetFirstAppWindowForBrowser(browser()); 146 return GetFirstAppWindowForBrowser(browser());
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 return app_window; 270 return app_window;
256 } 271 }
257 272
258 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( 273 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine(
259 CommandLine* command_line) { 274 CommandLine* command_line) {
260 PlatformAppBrowserTest::SetUpCommandLine(command_line); 275 PlatformAppBrowserTest::SetUpCommandLine(command_line);
261 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 276 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
262 } 277 }
263 278
264 } // namespace extensions 279 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698