| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 void StartProfileChooserControllerWithTutorialMode( | 89 void StartProfileChooserControllerWithTutorialMode( |
| 90 profiles::TutorialMode mode) { | 90 profiles::TutorialMode mode) { |
| 91 NSRect frame = [test_window() frame]; | 91 NSRect frame = [test_window() frame]; |
| 92 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); | 92 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); |
| 93 controller_.reset([[ProfileChooserController alloc] | 93 controller_.reset([[ProfileChooserController alloc] |
| 94 initWithBrowser:browser() | 94 initWithBrowser:browser() |
| 95 anchoredAt:point | 95 anchoredAt:point |
| 96 viewMode:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER | 96 viewMode:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER |
| 97 tutorialMode:mode | 97 tutorialMode:mode |
| 98 serviceType:signin::GAIA_SERVICE_TYPE_NONE]); | 98 serviceType:signin::GAIA_SERVICE_TYPE_NONE |
| 99 accessPoint:signin_metrics::AccessPoint:: |
| 100 ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN]); |
| 99 [controller_ showWindow:nil]; | 101 [controller_ showWindow:nil]; |
| 100 } | 102 } |
| 101 | 103 |
| 102 void AssertRightClickTutorialShown() { | 104 void AssertRightClickTutorialShown() { |
| 103 NSArray* subviews = [[[controller() window] contentView] subviews]; | 105 NSArray* subviews = [[[controller() window] contentView] subviews]; |
| 104 ASSERT_EQ(2U, [subviews count]); | 106 ASSERT_EQ(2U, [subviews count]); |
| 105 subviews = [[subviews objectAtIndex:0] subviews]; | 107 subviews = [[subviews objectAtIndex:0] subviews]; |
| 106 | 108 |
| 107 // There should be 4 views: the tutorial, the active profile card, a | 109 // There should be 4 views: the tutorial, the active profile card, a |
| 108 // separator and the options view. | 110 // separator and the options view. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 127 } | 129 } |
| 128 | 130 |
| 129 void StartFastUserSwitcher() { | 131 void StartFastUserSwitcher() { |
| 130 NSRect frame = [test_window() frame]; | 132 NSRect frame = [test_window() frame]; |
| 131 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); | 133 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); |
| 132 controller_.reset([[ProfileChooserController alloc] | 134 controller_.reset([[ProfileChooserController alloc] |
| 133 initWithBrowser:browser() | 135 initWithBrowser:browser() |
| 134 anchoredAt:point | 136 anchoredAt:point |
| 135 viewMode:profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER | 137 viewMode:profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER |
| 136 tutorialMode:profiles::TUTORIAL_MODE_NONE | 138 tutorialMode:profiles::TUTORIAL_MODE_NONE |
| 137 serviceType:signin::GAIA_SERVICE_TYPE_NONE]); | 139 serviceType:signin::GAIA_SERVICE_TYPE_NONE |
| 140 accessPoint:signin_metrics::AccessPoint:: |
| 141 ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN]); |
| 138 [controller_ showWindow:nil]; | 142 [controller_ showWindow:nil]; |
| 139 } | 143 } |
| 140 | 144 |
| 141 ProfileChooserController* controller() { return controller_; } | 145 ProfileChooserController* controller() { return controller_; } |
| 142 AvatarMenu* menu() { return menu_; } | 146 AvatarMenu* menu() { return menu_; } |
| 143 | 147 |
| 144 private: | 148 private: |
| 145 base::scoped_nsobject<ProfileChooserController> controller_; | 149 base::scoped_nsobject<ProfileChooserController> controller_; |
| 146 | 150 |
| 147 // Weak; owned by |controller_|. | 151 // Weak; owned by |controller_|. |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 ASSERT_EQ(5U, [buttonSubviews count]); | 551 ASSERT_EQ(5U, [buttonSubviews count]); |
| 548 | 552 |
| 549 // There should be a lock button. | 553 // There should be a lock button. |
| 550 NSButton* lockButton = | 554 NSButton* lockButton = |
| 551 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); | 555 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); |
| 552 ASSERT_TRUE(lockButton); | 556 ASSERT_TRUE(lockButton); |
| 553 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); | 557 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); |
| 554 EXPECT_EQ(controller(), [lockButton target]); | 558 EXPECT_EQ(controller(), [lockButton target]); |
| 555 EXPECT_TRUE([lockButton isEnabled]); | 559 EXPECT_TRUE([lockButton isEnabled]); |
| 556 } | 560 } |
| OLD | NEW |