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 <string> | 5 #include <string> |
6 | 6 |
7 #include <shlobj.h> // Must be before propkey. | 7 #include <shlobj.h> // Must be before propkey. |
8 #include <propkey.h> | 8 #include <propkey.h> |
9 #include <shellapi.h> | 9 #include <shellapi.h> |
10 | 10 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/win/scoped_comptr.h" | 14 #include "base/win/scoped_comptr.h" |
15 #include "base/win/scoped_propvariant.h" | 15 #include "base/win/scoped_propvariant.h" |
16 #include "base/win/windows_version.h" | 16 #include "base/win/windows_version.h" |
17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
18 #include "chrome/browser/extensions/extension_browsertest.h" | 18 #include "chrome/browser/extensions/extension_browsertest.h" |
19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/profiles/profile_info_cache.h" | 20 #include "chrome/browser/profiles/profile_info_cache.h" |
21 #include "chrome/browser/profiles/profile_manager.h" | 21 #include "chrome/browser/profiles/profile_manager.h" |
22 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" | 22 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
23 #include "chrome/browser/profiles/profiles_state.h" | 23 #include "chrome/browser/profiles/profiles_state.h" |
24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_finder.h" | 25 #include "chrome/browser/ui/browser_finder.h" |
26 #include "chrome/browser/ui/browser_iterator.h" | 26 #include "chrome/browser/ui/browser_iterator.h" |
27 #include "chrome/browser/ui/browser_window.h" | 27 #include "chrome/browser/ui/browser_window.h" |
| 28 #include "chrome/browser/ui/extensions/app_launch_params.h" |
28 #include "chrome/browser/ui/extensions/application_launch.h" | 29 #include "chrome/browser/ui/extensions/application_launch.h" |
29 #include "chrome/browser/web_applications/web_app.h" | 30 #include "chrome/browser/web_applications/web_app.h" |
30 #include "chrome/browser/web_applications/web_app_win.h" | 31 #include "chrome/browser/web_applications/web_app_win.h" |
31 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
32 #include "chrome/common/extensions/extension_constants.h" | 33 #include "chrome/common/extensions/extension_constants.h" |
33 #include "chrome/installer/util/browser_distribution.h" | 34 #include "chrome/installer/util/browser_distribution.h" |
34 #include "chrome/test/base/in_process_browser_test.h" | 35 #include "chrome/test/base/in_process_browser_test.h" |
35 #include "chrome/test/base/test_switches.h" | 36 #include "chrome/test/base/test_switches.h" |
36 #include "content/public/test/test_utils.h" | 37 #include "content/public/test/test_utils.h" |
| 38 #include "extensions/common/constants.h" |
37 #include "extensions/common/extension.h" | 39 #include "extensions/common/extension.h" |
38 #include "ui/views/win/hwnd_util.h" | 40 #include "ui/views/win/hwnd_util.h" |
39 | 41 |
40 typedef ExtensionBrowserTest BrowserWindowPropertyManagerTest; | 42 typedef ExtensionBrowserTest BrowserWindowPropertyManagerTest; |
41 | 43 |
42 namespace { | 44 namespace { |
43 | 45 |
44 // An observer that resumes test code after a new profile is initialized by | 46 // An observer that resumes test code after a new profile is initialized by |
45 // quitting the message loop it's blocked on. | 47 // quitting the message loop it's blocked on. |
46 void UnblockOnProfileCreation(Profile* profile, | 48 void UnblockOnProfileCreation(Profile* profile, |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 237 |
236 // This test checks HWND properties that are only available on Win7+. | 238 // This test checks HWND properties that are only available on Win7+. |
237 if (base::win::GetVersion() < base::win::VERSION_WIN7) | 239 if (base::win::GetVersion() < base::win::VERSION_WIN7) |
238 return; | 240 return; |
239 | 241 |
240 // Load an app. | 242 // Load an app. |
241 const extensions::Extension* extension = | 243 const extensions::Extension* extension = |
242 LoadExtension(test_data_dir_.AppendASCII("app/")); | 244 LoadExtension(test_data_dir_.AppendASCII("app/")); |
243 EXPECT_TRUE(extension); | 245 EXPECT_TRUE(extension); |
244 | 246 |
245 OpenApplication(AppLaunchParams(browser()->profile(), | 247 OpenApplication(AppLaunchParams( |
246 extension, | 248 browser()->profile(), extension, extensions::LAUNCH_CONTAINER_WINDOW, |
247 extensions::LAUNCH_CONTAINER_WINDOW, | 249 NEW_FOREGROUND_TAB, extensions::SOURCE_UNTRACKED)); |
248 NEW_FOREGROUND_TAB)); | |
249 | 250 |
250 // Check that the new browser has an app name. | 251 // Check that the new browser has an app name. |
251 // The launch should have created a new browser. | 252 // The launch should have created a new browser. |
252 ASSERT_EQ(2u, | 253 ASSERT_EQ(2u, |
253 chrome::GetBrowserCount(browser()->profile(), | 254 chrome::GetBrowserCount(browser()->profile(), |
254 browser()->host_desktop_type())); | 255 browser()->host_desktop_type())); |
255 | 256 |
256 // Find the new browser. | 257 // Find the new browser. |
257 Browser* app_browser = nullptr; | 258 Browser* app_browser = nullptr; |
258 for (chrome::BrowserIterator it; !it.done() && !app_browser; it.Next()) { | 259 for (chrome::BrowserIterator it; !it.done() && !app_browser; it.Next()) { |
259 if (*it != browser()) | 260 if (*it != browser()) |
260 app_browser = *it; | 261 app_browser = *it; |
261 } | 262 } |
262 ASSERT_TRUE(app_browser); | 263 ASSERT_TRUE(app_browser); |
263 ASSERT_TRUE(app_browser != browser()); | 264 ASSERT_TRUE(app_browser != browser()); |
264 | 265 |
265 WaitAndValidateBrowserWindowProperties( | 266 WaitAndValidateBrowserWindowProperties( |
266 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension)); | 267 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension)); |
267 } | 268 } |
OLD | NEW |