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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail)); | 363 cache->SetUserNameOfProfileAtIndex(0, base::ASCIIToUTF16(kEmail)); |
364 | 364 |
365 // Mark that we are using the profile name on purpose, so that we don't | 365 // Mark that we are using the profile name on purpose, so that we don't |
366 // fallback to testing the algorithm that chooses which default name | 366 // fallback to testing the algorithm that chooses which default name |
367 // should be used. | 367 // should be used. |
368 cache->SetProfileIsUsingDefaultNameAtIndex(0, false); | 368 cache->SetProfileIsUsingDefaultNameAtIndex(0, false); |
369 | 369 |
370 // Set up the signin manager and the OAuth2Tokens. | 370 // Set up the signin manager and the OAuth2Tokens. |
371 Profile* profile = browser()->profile(); | 371 Profile* profile = browser()->profile(); |
372 SigninManagerFactory::GetForProfile(profile)-> | 372 SigninManagerFactory::GetForProfile(profile)-> |
373 SetAuthenticatedUsername(kEmail); | 373 SetAuthenticatedAccountInfo(kEmail, kEmail); |
374 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> | 374 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
375 UpdateCredentials(kEmail, kLoginToken); | 375 UpdateCredentials(kEmail, kLoginToken); |
376 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> | 376 ProfileOAuth2TokenServiceFactory::GetForProfile(profile)-> |
377 UpdateCredentials(kSecondaryEmail, kLoginToken); | 377 UpdateCredentials(kSecondaryEmail, kLoginToken); |
378 | 378 |
379 StartProfileChooserController(); | 379 StartProfileChooserController(); |
380 [controller() initMenuContentsWithView: | 380 [controller() initMenuContentsWithView: |
381 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; | 381 profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT]; |
382 | 382 |
383 NSArray* subviews = [[[controller() window] contentView] subviews]; | 383 NSArray* subviews = [[[controller() window] contentView] subviews]; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 ASSERT_EQ(5U, [buttonSubviews count]); | 517 ASSERT_EQ(5U, [buttonSubviews count]); |
518 | 518 |
519 // There should be a lock button. | 519 // There should be a lock button. |
520 NSButton* lockButton = | 520 NSButton* lockButton = |
521 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); | 521 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); |
522 ASSERT_TRUE(lockButton); | 522 ASSERT_TRUE(lockButton); |
523 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); | 523 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); |
524 EXPECT_EQ(controller(), [lockButton target]); | 524 EXPECT_EQ(controller(), [lockButton target]); |
525 EXPECT_TRUE([lockButton isEnabled]); | 525 EXPECT_TRUE([lockButton isEnabled]); |
526 } | 526 } |
OLD | NEW |