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

Side by Side Diff: chrome/browser/extensions/platform_app_browsertest_util.cc

Issue 21344002: Move native_app_window code to apps areas (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase to after mac app shim fix Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/platform_app_browsertest_util.h" 5 #include "chrome/browser/extensions/platform_app_browsertest_util.h"
6 6
7 #include "apps/app_window_contents.h" 7 #include "apps/app_window_contents.h"
8 #include "apps/native_app_window.h"
8 #include "base/command_line.h" 9 #include "base/command_line.h"
9 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 11 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
11 #include "chrome/browser/extensions/extension_function_test_utils.h" 12 #include "chrome/browser/extensions/extension_function_test_utils.h"
12 #include "chrome/browser/extensions/shell_window_registry.h" 13 #include "chrome/browser/extensions/shell_window_registry.h"
13 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" 14 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h"
14 #include "chrome/browser/ui/browser.h" 15 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/extensions/application_launch.h" 16 #include "chrome/browser/ui/extensions/application_launch.h"
16 #include "chrome/browser/ui/extensions/native_app_window.h"
17 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
18 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
19 #include "content/public/test/test_utils.h" 19 #include "content/public/test/test_utils.h"
20 #include "extensions/common/switches.h" 20 #include "extensions/common/switches.h"
21 21
22 using apps::ShellWindow; 22 using apps::ShellWindow;
23 using content::WebContents; 23 using content::WebContents;
24 24
25 namespace utils = extension_function_test_utils; 25 namespace utils = extension_function_test_utils;
26 26
27 namespace extensions { 27 namespace extensions {
28 28
29 PlatformAppBrowserTest::PlatformAppBrowserTest() { 29 PlatformAppBrowserTest::PlatformAppBrowserTest() {
30 chrome::ChromeShellWindowDelegate::DisableExternalOpenForTesting(); 30 ChromeShellWindowDelegate::DisableExternalOpenForTesting();
31 } 31 }
32 32
33 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { 33 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) {
34 // Skips ExtensionApiTest::SetUpCommandLine. 34 // Skips ExtensionApiTest::SetUpCommandLine.
35 ExtensionBrowserTest::SetUpCommandLine(command_line); 35 ExtensionBrowserTest::SetUpCommandLine(command_line);
36 36
37 // Make event pages get suspended quicker. 37 // Make event pages get suspended quicker.
38 command_line->AppendSwitchASCII(::switches::kEventPageIdleTime, "1"); 38 command_line->AppendSwitchASCII(::switches::kEventPageIdleTime, "1");
39 command_line->AppendSwitchASCII(::switches::kEventPageSuspendingTime, "1"); 39 command_line->AppendSwitchASCII(::switches::kEventPageSuspendingTime, "1");
40 } 40 }
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 command_line->AppendArgPath(test_doc); 146 command_line->AppendArgPath(test_doc);
147 } 147 }
148 148
149 ShellWindow* PlatformAppBrowserTest::CreateShellWindow( 149 ShellWindow* PlatformAppBrowserTest::CreateShellWindow(
150 const Extension* extension) { 150 const Extension* extension) {
151 return CreateShellWindowFromParams(extension, ShellWindow::CreateParams()); 151 return CreateShellWindowFromParams(extension, ShellWindow::CreateParams());
152 } 152 }
153 153
154 ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams( 154 ShellWindow* PlatformAppBrowserTest::CreateShellWindowFromParams(
155 const Extension* extension, const ShellWindow::CreateParams& params) { 155 const Extension* extension, const ShellWindow::CreateParams& params) {
156 ShellWindow* window = new ShellWindow( 156 ShellWindow* window = new ShellWindow(browser()->profile(),
157 browser()->profile(), 157 new ChromeShellWindowDelegate(),
158 new chrome::ChromeShellWindowDelegate(), 158 extension);
159 extension);
160 window->Init(GURL(std::string()), 159 window->Init(GURL(std::string()),
161 new apps::AppWindowContents(window), 160 new apps::AppWindowContents(window),
162 params); 161 params);
163 return window; 162 return window;
164 } 163 }
165 164
166 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { 165 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) {
167 content::WindowedNotificationObserver destroyed_observer( 166 content::WindowedNotificationObserver destroyed_observer(
168 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 167 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
169 content::NotificationService::AllSources()); 168 content::NotificationService::AllSources());
(...skipping 15 matching lines...) Expand all
185 bounds); 184 bounds);
186 } 185 }
187 186
188 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( 187 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine(
189 CommandLine* command_line) { 188 CommandLine* command_line) {
190 PlatformAppBrowserTest::SetUpCommandLine(command_line); 189 PlatformAppBrowserTest::SetUpCommandLine(command_line);
191 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); 190 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis);
192 } 191 }
193 192
194 } // namespace extensions 193 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_browsertest.cc ('k') | chrome/browser/extensions/shell_window_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698