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 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/profile_chooser_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #import "base/mac/foundation_util.h" | 8 #import "base/mac/foundation_util.h" |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 EXPECT_FALSE([emailButton isEnabled]); | 345 EXPECT_FALSE([emailButton isEnabled]); |
346 } | 346 } |
347 | 347 |
348 TEST_F(ProfileChooserControllerTest, AccountManagementLayout) { | 348 TEST_F(ProfileChooserControllerTest, AccountManagementLayout) { |
349 switches::EnableAccountConsistencyForTesting( | 349 switches::EnableAccountConsistencyForTesting( |
350 CommandLine::ForCurrentProcess()); | 350 CommandLine::ForCurrentProcess()); |
351 // Sign in the first profile. | 351 // Sign in the first profile. |
352 ProfileInfoCache* cache = testing_profile_manager()->profile_info_cache(); | 352 ProfileInfoCache* cache = testing_profile_manager()->profile_info_cache(); |
353 cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail)); | 353 cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail)); |
354 | 354 |
| 355 // Mark that we are using the profile name on purpose, so that we don't |
| 356 // fallback to testing the algorithm that chooses which default name |
| 357 // should be used. |
| 358 cache->SetProfileIsUsingDefaultNameAtIndex(0, false); |
| 359 |
355 // Set up the signin manager and the OAuth2Tokens. | 360 // Set up the signin manager and the OAuth2Tokens. |
356 Profile* profile = browser()->profile(); | 361 Profile* profile = browser()->profile(); |
357 SigninManagerFactory::GetForProfile(profile)-> | 362 SigninManagerFactory::GetForProfile(profile)-> |
358 SetAuthenticatedUsername(kEmail); | 363 SetAuthenticatedUsername(kEmail); |
359 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> | 364 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
360 UpdateCredentials(kEmail, kLoginToken); | 365 UpdateCredentials(kEmail, kLoginToken); |
361 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> | 366 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
362 UpdateCredentials(kSecondaryEmail, kLoginToken); | 367 UpdateCredentials(kSecondaryEmail, kLoginToken); |
363 | 368 |
364 StartProfileChooserController(); | 369 StartProfileChooserController(); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 [base::mac::ObjCCast<NSButton>(activeProfileName) title])); | 457 [base::mac::ObjCCast<NSButton>(activeProfileName) title])); |
453 | 458 |
454 // Profile links. This is a local profile, so there should be a signin button. | 459 // Profile links. This is a local profile, so there should be a signin button. |
455 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews]; | 460 NSArray* linksSubviews = [[activeCardSubviews objectAtIndex:0] subviews]; |
456 ASSERT_EQ(1U, [linksSubviews count]); | 461 ASSERT_EQ(1U, [linksSubviews count]); |
457 NSButton* link = base::mac::ObjCCast<NSButton>( | 462 NSButton* link = base::mac::ObjCCast<NSButton>( |
458 [linksSubviews objectAtIndex:0]); | 463 [linksSubviews objectAtIndex:0]); |
459 EXPECT_EQ(@selector(hideAccountManagement:), [link action]); | 464 EXPECT_EQ(@selector(hideAccountManagement:), [link action]); |
460 EXPECT_EQ(controller(), [link target]); | 465 EXPECT_EQ(controller(), [link target]); |
461 } | 466 } |
OLD | NEW |