| 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" |
| 11 #include "base/strings/sys_string_conversions.h" | 11 #include "base/strings/sys_string_conversions.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "chrome/browser/prefs/pref_service_syncable.h" | 13 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 14 #include "chrome/browser/profiles/avatar_menu.h" | 14 #include "chrome/browser/profiles/avatar_menu.h" |
| 15 #include "chrome/browser/profiles/profile_info_cache.h" | 15 #include "chrome/browser/profiles/profile_info_cache.h" |
| 16 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" |
| 17 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 16 #include "chrome/browser/signin/account_tracker_service_factory.h" | 18 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 17 #include "chrome/browser/signin/fake_account_tracker_service.h" | 19 #include "chrome/browser/signin/fake_account_tracker_service.h" |
| 18 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 20 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 19 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 21 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 21 #include "chrome/browser/signin/signin_header_helper.h" | 23 #include "chrome/browser/signin/signin_header_helper.h" |
| 22 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
| 23 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 24 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 26 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 25 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 public: | 38 public: |
| 37 ProfileChooserControllerTest() { | 39 ProfileChooserControllerTest() { |
| 38 } | 40 } |
| 39 | 41 |
| 40 virtual void SetUp() override { | 42 virtual void SetUp() override { |
| 41 CocoaProfileTest::SetUp(); | 43 CocoaProfileTest::SetUp(); |
| 42 ASSERT_TRUE(browser()->profile()); | 44 ASSERT_TRUE(browser()->profile()); |
| 43 | 45 |
| 44 AccountTrackerServiceFactory::GetInstance()->SetTestingFactory( | 46 AccountTrackerServiceFactory::GetInstance()->SetTestingFactory( |
| 45 browser()->profile(), FakeAccountTrackerService::Build); | 47 browser()->profile(), FakeAccountTrackerService::Build); |
| 48 gcm::GCMProfileServiceFactory::GetInstance()->SetTestingFactory( |
| 49 browser()->profile(), gcm::FakeGCMProfileService::Build); |
| 46 | 50 |
| 47 TestingProfile::TestingFactories factories; | 51 TestingProfile::TestingFactories factories; |
| 48 factories.push_back( | 52 factories.push_back( |
| 49 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), | 53 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 50 BuildFakeProfileOAuth2TokenService)); | 54 BuildFakeProfileOAuth2TokenService)); |
| 51 factories.push_back( | 55 factories.push_back( |
| 52 std::make_pair(AccountTrackerServiceFactory::GetInstance(), | 56 std::make_pair(AccountTrackerServiceFactory::GetInstance(), |
| 53 FakeAccountTrackerService::Build)); | 57 FakeAccountTrackerService::Build)); |
| 54 testing_profile_manager()-> | 58 testing_profile_manager()-> |
| 55 CreateTestingProfile("test1", scoped_ptr<PrefServiceSyncable>(), | 59 CreateTestingProfile("test1", scoped_ptr<PrefServiceSyncable>(), |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 ASSERT_EQ(5U, [buttonSubviews count]); | 510 ASSERT_EQ(5U, [buttonSubviews count]); |
| 507 | 511 |
| 508 // There should be a lock button. | 512 // There should be a lock button. |
| 509 NSButton* lockButton = | 513 NSButton* lockButton = |
| 510 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); | 514 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); |
| 511 ASSERT_TRUE(lockButton); | 515 ASSERT_TRUE(lockButton); |
| 512 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); | 516 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); |
| 513 EXPECT_EQ(controller(), [lockButton target]); | 517 EXPECT_EQ(controller(), [lockButton target]); |
| 514 EXPECT_TRUE([lockButton isEnabled]); | 518 EXPECT_TRUE([lockButton isEnabled]); |
| 515 } | 519 } |
| OLD | NEW |