OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/views/profiles/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_VIEW, 1); | 246 ProfileMetrics::PROFILE_AVATAR_MENU_UPGRADE_VIEW, 1); |
247 } | 247 } |
248 | 248 |
249 // Flaky: http://crbug.com/450221 | 249 // Flaky: http://crbug.com/450221 |
250 // WaitForUserManager()'s RunUntilIdle isn't always sufficient for the | 250 // WaitForUserManager()'s RunUntilIdle isn't always sufficient for the |
251 // UserManager to be showing. | 251 // UserManager to be showing. |
252 IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest, DISABLED_LockProfile) { | 252 IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest, DISABLED_LockProfile) { |
253 ASSERT_TRUE(profiles::IsMultipleProfilesEnabled()); | 253 ASSERT_TRUE(profiles::IsMultipleProfilesEnabled()); |
254 | 254 |
255 SetupProfilesForLock(browser()->profile()); | 255 SetupProfilesForLock(browser()->profile()); |
256 EXPECT_EQ(1U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size()); | 256 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); |
257 | 257 |
258 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView(browser())); | 258 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView(browser())); |
259 AvatarMenu* menu = GetProfileChooserViewAvatarMenu(); | 259 AvatarMenu* menu = GetProfileChooserViewAvatarMenu(); |
260 EXPECT_FALSE(menu->GetItemAt(menu->GetActiveProfileIndex()).signin_required); | 260 EXPECT_FALSE(menu->GetItemAt(menu->GetActiveProfileIndex()).signin_required); |
261 | 261 |
262 ClickProfileChooserViewLockButton(); | 262 ClickProfileChooserViewLockButton(); |
263 EXPECT_TRUE(menu->GetItemAt(menu->GetActiveProfileIndex()).signin_required); | 263 EXPECT_TRUE(menu->GetItemAt(menu->GetActiveProfileIndex()).signin_required); |
264 | 264 |
265 window_close_observer()->Wait(); | 265 window_close_observer()->Wait(); |
266 EXPECT_TRUE(BrowserList::GetInstance(chrome::GetActiveDesktop())->empty()); | 266 EXPECT_TRUE(BrowserList::GetInstance()->empty()); |
267 | 267 |
268 WaitForUserManager(); | 268 WaitForUserManager(); |
269 // We need to hide the User Manager or else the process can't die. | 269 // We need to hide the User Manager or else the process can't die. |
270 UserManager::Hide(); | 270 UserManager::Hide(); |
271 } | 271 } |
272 | 272 |
273 // Flaky: http://crbug.com/450221 | 273 // Flaky: http://crbug.com/450221 |
274 // WaitForUserManager()'s RunUntilIdle isn't always sufficient for the | 274 // WaitForUserManager()'s RunUntilIdle isn't always sufficient for the |
275 // UserManager to be showing. | 275 // UserManager to be showing. |
276 IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest, | 276 IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest, |
(...skipping 25 matching lines...) Expand all Loading... |
302 // Make sure we have at least one enabled extension. | 302 // Make sure we have at least one enabled extension. |
303 extensions::ExtensionRegistry* registry = | 303 extensions::ExtensionRegistry* registry = |
304 GetPreparedRegistry(browser()->profile()); | 304 GetPreparedRegistry(browser()->profile()); |
305 const size_t total_enabled_extensions = registry->enabled_extensions().size(); | 305 const size_t total_enabled_extensions = registry->enabled_extensions().size(); |
306 | 306 |
307 // Create a different profile and then lock it. | 307 // Create a different profile and then lock it. |
308 Profile *signed_in = CreateTestingProfile("signed_in"); | 308 Profile *signed_in = CreateTestingProfile("signed_in"); |
309 SetupProfilesForLock(signed_in); | 309 SetupProfilesForLock(signed_in); |
310 extensions::ExtensionSystem::Get(signed_in)->InitForRegularProfile(true); | 310 extensions::ExtensionSystem::Get(signed_in)->InitForRegularProfile(true); |
311 Browser* browser_to_lock = CreateBrowser(signed_in); | 311 Browser* browser_to_lock = CreateBrowser(signed_in); |
312 EXPECT_EQ(2U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size()); | 312 EXPECT_EQ(2U, BrowserList::GetInstance()->size()); |
313 | 313 |
314 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView(browser_to_lock)); | 314 ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView(browser_to_lock)); |
315 ClickProfileChooserViewLockButton(); | 315 ClickProfileChooserViewLockButton(); |
316 window_close_observer()->Wait(); | 316 window_close_observer()->Wait(); |
317 EXPECT_EQ(1U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size()); | 317 EXPECT_EQ(1U, BrowserList::GetInstance()->size()); |
318 | 318 |
319 WaitForUserManager(); | 319 WaitForUserManager(); |
320 // Assert that the first profile's extensions are not blocked. | 320 // Assert that the first profile's extensions are not blocked. |
321 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); | 321 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); |
322 ASSERT_EQ(0U, registry->blocked_extensions().size()); | 322 ASSERT_EQ(0U, registry->blocked_extensions().size()); |
323 | 323 |
324 // We need to hide the User Manager or else the process can't die. | 324 // We need to hide the User Manager or else the process can't die. |
325 UserManager::Hide(); | 325 UserManager::Hide(); |
326 } | 326 } |
OLD | NEW |