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 <objbase.h> | 5 #include <objbase.h> |
6 #include <shlobj.h> // Must be before propkey. | 6 #include <shlobj.h> // Must be before propkey. |
7 #include <propkey.h> | 7 #include <propkey.h> |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/strings/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "base/win/scoped_comptr.h" | 18 #include "base/win/scoped_comptr.h" |
19 #include "base/win/scoped_propvariant.h" | 19 #include "base/win/scoped_propvariant.h" |
20 #include "base/win/windows_version.h" | |
21 #include "chrome/browser/browser_process.h" | 20 #include "chrome/browser/browser_process.h" |
22 #include "chrome/browser/extensions/extension_browsertest.h" | 21 #include "chrome/browser/extensions/extension_browsertest.h" |
23 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/profiles/profile_attributes_entry.h" | 23 #include "chrome/browser/profiles/profile_attributes_entry.h" |
25 #include "chrome/browser/profiles/profile_attributes_storage.h" | 24 #include "chrome/browser/profiles/profile_attributes_storage.h" |
26 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
27 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" | 26 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
28 #include "chrome/browser/profiles/profiles_state.h" | 27 #include "chrome/browser/profiles/profiles_state.h" |
29 #include "chrome/browser/ui/browser.h" | 28 #include "chrome/browser/ui/browser.h" |
30 #include "chrome/browser/ui/browser_finder.h" | 29 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 175 } |
177 | 176 |
178 private: | 177 private: |
179 DISALLOW_COPY_AND_ASSIGN(BrowserTestWithProfileShortcutManager); | 178 DISALLOW_COPY_AND_ASSIGN(BrowserTestWithProfileShortcutManager); |
180 }; | 179 }; |
181 | 180 |
182 // Check that the window properties on Windows are properly set. | 181 // Check that the window properties on Windows are properly set. |
183 // http://crbug.com/396344 | 182 // http://crbug.com/396344 |
184 IN_PROC_BROWSER_TEST_F(BrowserTestWithProfileShortcutManager, | 183 IN_PROC_BROWSER_TEST_F(BrowserTestWithProfileShortcutManager, |
185 DISABLED_WindowProperties) { | 184 DISABLED_WindowProperties) { |
186 // This test checks HWND properties that are only available on Win7+. | |
187 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
188 return; | |
189 | |
190 // Single profile case. The profile name should not be shown. | 185 // Single profile case. The profile name should not be shown. |
191 WaitAndValidateBrowserWindowProperties(base::Bind( | 186 WaitAndValidateBrowserWindowProperties(base::Bind( |
192 &ValidateBrowserWindowProperties, browser(), base::string16())); | 187 &ValidateBrowserWindowProperties, browser(), base::string16())); |
193 | 188 |
194 // If multiprofile mode is not enabled, we can't test the behavior when there | 189 // If multiprofile mode is not enabled, we can't test the behavior when there |
195 // are multiple profiles. | 190 // are multiple profiles. |
196 if (!profiles::IsMultipleProfilesEnabled()) | 191 if (!profiles::IsMultipleProfilesEnabled()) |
197 return; | 192 return; |
198 | 193 |
199 // Two profile case. Both profile names should be shown. | 194 // Two profile case. Both profile names should be shown. |
(...skipping 23 matching lines...) Expand all Loading... |
223 ASSERT_TRUE(profile_manager->GetProfileAttributesStorage(). | 218 ASSERT_TRUE(profile_manager->GetProfileAttributesStorage(). |
224 GetProfileAttributesWithPath(path_profile2, &entry)); | 219 GetProfileAttributesWithPath(path_profile2, &entry)); |
225 WaitAndValidateBrowserWindowProperties( | 220 WaitAndValidateBrowserWindowProperties( |
226 base::Bind(&ValidateBrowserWindowProperties, | 221 base::Bind(&ValidateBrowserWindowProperties, |
227 profile2_browser, | 222 profile2_browser, |
228 entry->GetName())); | 223 entry->GetName())); |
229 } | 224 } |
230 | 225 |
231 // http://crbug.com/396344 | 226 // http://crbug.com/396344 |
232 IN_PROC_BROWSER_TEST_F(BrowserWindowPropertyManagerTest, DISABLED_HostedApp) { | 227 IN_PROC_BROWSER_TEST_F(BrowserWindowPropertyManagerTest, DISABLED_HostedApp) { |
233 // This test checks HWND properties that are only available on Win7+. | |
234 if (base::win::GetVersion() < base::win::VERSION_WIN7) | |
235 return; | |
236 | |
237 // Load an app. | 228 // Load an app. |
238 const extensions::Extension* extension = | 229 const extensions::Extension* extension = |
239 LoadExtension(test_data_dir_.AppendASCII("app/")); | 230 LoadExtension(test_data_dir_.AppendASCII("app/")); |
240 EXPECT_TRUE(extension); | 231 EXPECT_TRUE(extension); |
241 | 232 |
242 OpenApplication(AppLaunchParams( | 233 OpenApplication(AppLaunchParams( |
243 browser()->profile(), extension, extensions::LAUNCH_CONTAINER_WINDOW, | 234 browser()->profile(), extension, extensions::LAUNCH_CONTAINER_WINDOW, |
244 WindowOpenDisposition::NEW_FOREGROUND_TAB, extensions::SOURCE_TEST)); | 235 WindowOpenDisposition::NEW_FOREGROUND_TAB, extensions::SOURCE_TEST)); |
245 | 236 |
246 // Check that the new browser has an app name. | 237 // Check that the new browser has an app name. |
247 // The launch should have created a new browser. | 238 // The launch should have created a new browser. |
248 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); | 239 ASSERT_EQ(2u, chrome::GetBrowserCount(browser()->profile())); |
249 | 240 |
250 // Find the new browser. | 241 // Find the new browser. |
251 Browser* app_browser = nullptr; | 242 Browser* app_browser = nullptr; |
252 for (auto* b : *BrowserList::GetInstance()) { | 243 for (auto* b : *BrowserList::GetInstance()) { |
253 if (b != browser()) | 244 if (b != browser()) |
254 app_browser = b; | 245 app_browser = b; |
255 } | 246 } |
256 ASSERT_TRUE(app_browser); | 247 ASSERT_TRUE(app_browser); |
257 ASSERT_TRUE(app_browser != browser()); | 248 ASSERT_TRUE(app_browser != browser()); |
258 | 249 |
259 WaitAndValidateBrowserWindowProperties( | 250 WaitAndValidateBrowserWindowProperties( |
260 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension)); | 251 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension)); |
261 } | 252 } |
OLD | NEW |