| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 const std::string kEmail = "user@gmail.com"; | 31 const std::string kEmail = "user@gmail.com"; |
| 32 const std::string kSecondaryEmail = "user2@gmail.com"; | 32 const std::string kSecondaryEmail = "user2@gmail.com"; |
| 33 const std::string kLoginToken = "oauth2_login_token"; | 33 const std::string kLoginToken = "oauth2_login_token"; |
| 34 | 34 |
| 35 class ProfileChooserControllerTest : public CocoaProfileTest { | 35 class ProfileChooserControllerTest : public CocoaProfileTest { |
| 36 public: | 36 public: |
| 37 ProfileChooserControllerTest() { | 37 ProfileChooserControllerTest() { |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual void SetUp() OVERRIDE { | 40 virtual void SetUp() override { |
| 41 CocoaProfileTest::SetUp(); | 41 CocoaProfileTest::SetUp(); |
| 42 ASSERT_TRUE(browser()->profile()); | 42 ASSERT_TRUE(browser()->profile()); |
| 43 | 43 |
| 44 AccountTrackerServiceFactory::GetInstance()->SetTestingFactory( | 44 AccountTrackerServiceFactory::GetInstance()->SetTestingFactory( |
| 45 browser()->profile(), FakeAccountTrackerService::Build); | 45 browser()->profile(), FakeAccountTrackerService::Build); |
| 46 | 46 |
| 47 TestingProfile::TestingFactories factories; | 47 TestingProfile::TestingFactories factories; |
| 48 factories.push_back( | 48 factories.push_back( |
| 49 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), | 49 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 50 BuildFakeProfileOAuth2TokenService)); | 50 BuildFakeProfileOAuth2TokenService)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 61 TestingProfile::TestingFactories()); | 61 TestingProfile::TestingFactories()); |
| 62 | 62 |
| 63 menu_ = new AvatarMenu(testing_profile_manager()->profile_info_cache(), | 63 menu_ = new AvatarMenu(testing_profile_manager()->profile_info_cache(), |
| 64 NULL, NULL); | 64 NULL, NULL); |
| 65 menu_->RebuildMenu(); | 65 menu_->RebuildMenu(); |
| 66 | 66 |
| 67 // There should be the default profile + two profiles we created. | 67 // There should be the default profile + two profiles we created. |
| 68 EXPECT_EQ(3U, menu_->GetNumberOfItems()); | 68 EXPECT_EQ(3U, menu_->GetNumberOfItems()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual void TearDown() OVERRIDE { | 71 virtual void TearDown() override { |
| 72 [controller() close]; | 72 [controller() close]; |
| 73 controller_.reset(); | 73 controller_.reset(); |
| 74 CocoaProfileTest::TearDown(); | 74 CocoaProfileTest::TearDown(); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void StartProfileChooserController() { | 77 void StartProfileChooserController() { |
| 78 NSRect frame = [test_window() frame]; | 78 NSRect frame = [test_window() frame]; |
| 79 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); | 79 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); |
| 80 controller_.reset([[ProfileChooserController alloc] | 80 controller_.reset([[ProfileChooserController alloc] |
| 81 initWithBrowser:browser() | 81 initWithBrowser:browser() |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 ASSERT_EQ(5U, [buttonSubviews count]); | 506 ASSERT_EQ(5U, [buttonSubviews count]); |
| 507 | 507 |
| 508 // There should be a lock button. | 508 // There should be a lock button. |
| 509 NSButton* lockButton = | 509 NSButton* lockButton = |
| 510 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); | 510 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); |
| 511 ASSERT_TRUE(lockButton); | 511 ASSERT_TRUE(lockButton); |
| 512 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); | 512 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); |
| 513 EXPECT_EQ(controller(), [lockButton target]); | 513 EXPECT_EQ(controller(), [lockButton target]); |
| 514 EXPECT_TRUE([lockButton isEnabled]); | 514 EXPECT_TRUE([lockButton isEnabled]); |
| 515 } | 515 } |
| OLD | NEW |