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