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" | |
14 #include "chrome/browser/profiles/avatar_menu.h" | 13 #include "chrome/browser/profiles/avatar_menu.h" |
15 #include "chrome/browser/profiles/profile_info_cache.h" | 14 #include "chrome/browser/profiles/profile_info_cache.h" |
16 #include "chrome/browser/services/gcm/fake_gcm_profile_service.h" | 15 #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/services/gcm/gcm_profile_service_factory.h" |
18 #include "chrome/browser/signin/account_fetcher_service_factory.h" | 17 #include "chrome/browser/signin/account_fetcher_service_factory.h" |
19 #include "chrome/browser/signin/account_tracker_service_factory.h" | 18 #include "chrome/browser/signin/account_tracker_service_factory.h" |
20 #include "chrome/browser/signin/chrome_signin_helper.h" | 19 #include "chrome/browser/signin/chrome_signin_helper.h" |
21 #include "chrome/browser/signin/fake_account_fetcher_service_builder.h" | 20 #include "chrome/browser/signin/fake_account_fetcher_service_builder.h" |
22 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 21 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
24 #include "chrome/browser/signin/signin_manager_factory.h" | 23 #include "chrome/browser/signin/signin_manager_factory.h" |
25 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
26 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 25 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
27 #include "chrome/common/chrome_switches.h" | 26 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
29 #include "components/signin/core/browser/fake_account_fetcher_service.h" | 28 #include "components/signin/core/browser/fake_account_fetcher_service.h" |
30 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" | 29 #include "components/signin/core/browser/fake_profile_oauth2_token_service.h" |
31 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 30 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
32 #include "components/signin/core/browser/signin_manager.h" | 31 #include "components/signin/core/browser/signin_manager.h" |
33 #include "components/signin/core/common/profile_management_switches.h" | 32 #include "components/signin/core/common/profile_management_switches.h" |
| 33 #include "components/syncable_prefs/pref_service_syncable.h" |
34 | 34 |
35 const std::string kGaiaId = "gaiaid-user@gmail.com"; | 35 const std::string kGaiaId = "gaiaid-user@gmail.com"; |
36 const std::string kEmail = "user@gmail.com"; | 36 const std::string kEmail = "user@gmail.com"; |
37 const std::string kSecondaryEmail = "user2@gmail.com"; | 37 const std::string kSecondaryEmail = "user2@gmail.com"; |
38 const std::string kSecondaryGaiaId = "gaiaid-user2@gmail.com"; | 38 const std::string kSecondaryGaiaId = "gaiaid-user2@gmail.com"; |
39 const std::string kLoginToken = "oauth2_login_token"; | 39 const std::string kLoginToken = "oauth2_login_token"; |
40 | 40 |
41 class ProfileChooserControllerTest : public CocoaProfileTest { | 41 class ProfileChooserControllerTest : public CocoaProfileTest { |
42 public: | 42 public: |
43 ProfileChooserControllerTest() { | 43 ProfileChooserControllerTest() { |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 ASSERT_EQ(5U, [buttonSubviews count]); | 562 ASSERT_EQ(5U, [buttonSubviews count]); |
563 | 563 |
564 // There should be a lock button. | 564 // There should be a lock button. |
565 NSButton* lockButton = | 565 NSButton* lockButton = |
566 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); | 566 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); |
567 ASSERT_TRUE(lockButton); | 567 ASSERT_TRUE(lockButton); |
568 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); | 568 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); |
569 EXPECT_EQ(controller(), [lockButton target]); | 569 EXPECT_EQ(controller(), [lockButton target]); |
570 EXPECT_TRUE([lockButton isEnabled]); | 570 EXPECT_TRUE([lockButton isEnabled]); |
571 } | 571 } |
OLD | NEW |