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

Side by Side Diff: chrome/browser/profiles/profile_list_desktop_browsertest.cc

Issue 271533004: Turning on MultiProfile by default for ChromeOS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/profiles/avatar_menu.h" 8 #include "chrome/browser/profiles/avatar_menu.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/profiles/profile_window.h" 10 #include "chrome/browser/profiles/profile_window.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 base::FilePath path_profile1 = current_profile->GetPath(); 112 base::FilePath path_profile1 = current_profile->GetPath();
113 base::FilePath user_dir = cache.GetUserDataDir(); 113 base::FilePath user_dir = cache.GetUserDataDir();
114 114
115 // Create an additional profile. 115 // Create an additional profile.
116 base::FilePath path_profile2 = user_dir.Append( 116 base::FilePath path_profile2 = user_dir.Append(
117 FILE_PATH_LITERAL("New Profile 2")); 117 FILE_PATH_LITERAL("New Profile 2"));
118 profile_manager->CreateProfileAsync(path_profile2, 118 profile_manager->CreateProfileAsync(path_profile2,
119 base::Bind(&OnUnblockOnProfileCreation), 119 base::Bind(&OnUnblockOnProfileCreation),
120 base::string16(), base::string16(), 120 base::string16(), base::string16(),
121 std::string()); 121 std::string());
122
123 // Spin to allow profile creation to take place, loop is terminated 122 // Spin to allow profile creation to take place, loop is terminated
124 // by OnUnblockOnProfileCreation when the profile is created. 123 // by OnUnblockOnProfileCreation when the profile is created.
125 content::RunMessageLoop(); 124 content::RunMessageLoop();
125
126 ASSERT_EQ(cache.GetNumberOfProfiles(), 2U); 126 ASSERT_EQ(cache.GetNumberOfProfiles(), 2U);
127 127
128 AvatarMenu* menu = GetAvatarMenu(&cache); 128 AvatarMenu* menu = GetAvatarMenu(&cache);
129 menu->RebuildMenu(); 129 menu->RebuildMenu();
130 BrowserList* browser_list = 130 BrowserList* browser_list =
131 BrowserList::GetInstance(chrome::GetActiveDesktop()); 131 BrowserList::GetInstance(chrome::GetActiveDesktop());
132 EXPECT_EQ(1U, browser_list->size()); 132 EXPECT_EQ(1U, browser_list->size());
133 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); 133 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath());
134 134
135 EXPECT_EQ(1U, browser_list->size());
sky 2014/05/14 13:52:57 This is the same as on 132. Do you really need it
135 // Open a browser window for the first profile. 136 // Open a browser window for the first profile.
136 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1), 137 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1),
137 false, ProfileMetrics::SWITCH_PROFILE_ICON); 138 false, ProfileMetrics::SWITCH_PROFILE_ICON);
138 EXPECT_EQ(1U, browser_list->size()); 139 EXPECT_EQ(1U, browser_list->size());
139 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); 140 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath());
140 141
141 // Open a browser window for the second profile. 142 // Open a browser window for the second profile.
142 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile2), 143 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile2),
143 false, ProfileMetrics::SWITCH_PROFILE_ICON); 144 false, ProfileMetrics::SWITCH_PROFILE_ICON);
144 EXPECT_EQ(2U, browser_list->size()); 145 EXPECT_EQ(2U, browser_list->size());
145 146
146 // Switch to the first profile without opening a new window. 147 // Switch to the first profile without opening a new window.
147 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1), 148 menu->SwitchToProfile(cache.GetIndexOfProfileWithPath(path_profile1),
148 false, ProfileMetrics::SWITCH_PROFILE_ICON); 149 false, ProfileMetrics::SWITCH_PROFILE_ICON);
149 EXPECT_EQ(2U, browser_list->size()); 150 EXPECT_EQ(2U, browser_list->size());
150 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath()); 151 EXPECT_EQ(path_profile1, browser_list->get(0)->profile()->GetPath());
151 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath()); 152 EXPECT_EQ(path_profile2, browser_list->get(1)->profile()->GetPath());
152 } 153 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698