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

Side by Side Diff: chrome/browser/ui/views/frame/browser_window_property_manager_browsertest_win.cc

Issue 1701563002: Refactor ProfileInfoCache in c/b/ui/views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments Created 4 years, 10 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
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 <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 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/win/scoped_comptr.h" 16 #include "base/win/scoped_comptr.h"
17 #include "base/win/scoped_propvariant.h" 17 #include "base/win/scoped_propvariant.h"
18 #include "base/win/windows_version.h" 18 #include "base/win/windows_version.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/extensions/extension_browsertest.h" 20 #include "chrome/browser/extensions/extension_browsertest.h"
21 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
22 #include "chrome/browser/profiles/profile_info_cache.h" 22 #include "chrome/browser/profiles/profile_attributes_entry.h"
23 #include "chrome/browser/profiles/profile_attributes_storage.h"
23 #include "chrome/browser/profiles/profile_manager.h" 24 #include "chrome/browser/profiles/profile_manager.h"
24 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" 25 #include "chrome/browser/profiles/profile_shortcut_manager_win.h"
25 #include "chrome/browser/profiles/profiles_state.h" 26 #include "chrome/browser/profiles/profiles_state.h"
26 #include "chrome/browser/ui/browser.h" 27 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_finder.h" 28 #include "chrome/browser/ui/browser_finder.h"
28 #include "chrome/browser/ui/browser_list.h" 29 #include "chrome/browser/ui/browser_list.h"
29 #include "chrome/browser/ui/browser_window.h" 30 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/browser/ui/extensions/app_launch_params.h" 31 #include "chrome/browser/ui/extensions/app_launch_params.h"
31 #include "chrome/browser/ui/extensions/application_launch.h" 32 #include "chrome/browser/ui/extensions/application_launch.h"
32 #include "chrome/browser/web_applications/web_app.h" 33 #include "chrome/browser/web_applications/web_app.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 WaitAndValidateBrowserWindowProperties(base::Bind( 197 WaitAndValidateBrowserWindowProperties(base::Bind(
197 &ValidateBrowserWindowProperties, browser(), base::string16())); 198 &ValidateBrowserWindowProperties, browser(), base::string16()));
198 199
199 // If multiprofile mode is not enabled, we can't test the behavior when there 200 // If multiprofile mode is not enabled, we can't test the behavior when there
200 // are multiple profiles. 201 // are multiple profiles.
201 if (!profiles::IsMultipleProfilesEnabled()) 202 if (!profiles::IsMultipleProfilesEnabled())
202 return; 203 return;
203 204
204 // Two profile case. Both profile names should be shown. 205 // Two profile case. Both profile names should be shown.
205 ProfileManager* profile_manager = g_browser_process->profile_manager(); 206 ProfileManager* profile_manager = g_browser_process->profile_manager();
206 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
207 207
208 base::FilePath path_profile2 = 208 base::FilePath path_profile2 =
209 profile_manager->GenerateNextProfileDirectoryPath(); 209 profile_manager->GenerateNextProfileDirectoryPath();
210 profile_manager->CreateProfileAsync(path_profile2, 210 profile_manager->CreateProfileAsync(path_profile2,
211 base::Bind(&UnblockOnProfileCreation), 211 base::Bind(&UnblockOnProfileCreation),
212 base::string16(), std::string(), 212 base::string16(), std::string(),
213 std::string()); 213 std::string());
214 214
215 // Spin to allow profile creation to take place, loop is terminated 215 // Spin to allow profile creation to take place, loop is terminated
216 // by UnblockOnProfileCreation when the profile is created. 216 // by UnblockOnProfileCreation when the profile is created.
217 content::RunMessageLoop(); 217 content::RunMessageLoop();
218 218
219 // The default profile's name should be part of the relaunch name. 219 // The default profile's name should be part of the relaunch name.
220 WaitAndValidateBrowserWindowProperties(base::Bind( 220 WaitAndValidateBrowserWindowProperties(base::Bind(
221 &ValidateBrowserWindowProperties, 221 &ValidateBrowserWindowProperties,
222 browser(), 222 browser(),
223 base::UTF8ToUTF16(browser()->profile()->GetProfileUserName()))); 223 base::UTF8ToUTF16(browser()->profile()->GetProfileUserName())));
224 224
225 // The second profile's name should be part of the relaunch name. 225 // The second profile's name should be part of the relaunch name.
226 Browser* profile2_browser = 226 Browser* profile2_browser =
227 CreateBrowser(profile_manager->GetProfileByPath(path_profile2)); 227 CreateBrowser(profile_manager->GetProfileByPath(path_profile2));
228 size_t profile2_index = cache.GetIndexOfProfileWithPath(path_profile2); 228 ProfileAttributesEntry* entry;
229 ASSERT_TRUE(profile_manager->GetProfileAttributesStorage().
230 GetProfileAttributesWithPath(path_profile2, &entry));
229 WaitAndValidateBrowserWindowProperties( 231 WaitAndValidateBrowserWindowProperties(
230 base::Bind(&ValidateBrowserWindowProperties, 232 base::Bind(&ValidateBrowserWindowProperties,
231 profile2_browser, 233 profile2_browser,
232 cache.GetNameOfProfileAtIndex(profile2_index))); 234 entry->GetName()));
233 } 235 }
234 236
235 // http://crbug.com/396344 237 // http://crbug.com/396344
236 IN_PROC_BROWSER_TEST_F(BrowserWindowPropertyManagerTest, DISABLED_HostedApp) { 238 IN_PROC_BROWSER_TEST_F(BrowserWindowPropertyManagerTest, DISABLED_HostedApp) {
237 #if defined(USE_ASH) 239 #if defined(USE_ASH)
238 // Disable this test in Metro+Ash where Windows window properties aren't used. 240 // Disable this test in Metro+Ash where Windows window properties aren't used.
239 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 241 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
240 switches::kAshBrowserTests)) 242 switches::kAshBrowserTests))
241 return; 243 return;
242 #endif 244 #endif
(...skipping 20 matching lines...) Expand all
263 for (auto* b : *BrowserList::GetInstance()) { 265 for (auto* b : *BrowserList::GetInstance()) {
264 if (b != browser()) 266 if (b != browser())
265 app_browser = b; 267 app_browser = b;
266 } 268 }
267 ASSERT_TRUE(app_browser); 269 ASSERT_TRUE(app_browser);
268 ASSERT_TRUE(app_browser != browser()); 270 ASSERT_TRUE(app_browser != browser());
269 271
270 WaitAndValidateBrowserWindowProperties( 272 WaitAndValidateBrowserWindowProperties(
271 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension)); 273 base::Bind(&ValidateHostedAppWindowProperties, app_browser, extension));
272 } 274 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | chrome/browser/ui/views/frame/global_menu_bar_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698