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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #import "base/mac/foundation_util.h" | 10 #import "base/mac/foundation_util.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 initWithBrowser:browser() | 100 initWithBrowser:browser() |
101 anchoredAt:point | 101 anchoredAt:point |
102 viewMode:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER | 102 viewMode:profiles::BUBBLE_VIEW_MODE_PROFILE_CHOOSER |
103 tutorialMode:mode | 103 tutorialMode:mode |
104 serviceType:signin::GAIA_SERVICE_TYPE_NONE | 104 serviceType:signin::GAIA_SERVICE_TYPE_NONE |
105 accessPoint:signin_metrics::AccessPoint:: | 105 accessPoint:signin_metrics::AccessPoint:: |
106 ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN]); | 106 ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN]); |
107 [controller_ showWindow:nil]; | 107 [controller_ showWindow:nil]; |
108 } | 108 } |
109 | 109 |
110 void StartFastUserSwitcher() { | |
111 NSRect frame = [test_window() frame]; | |
112 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); | |
113 controller_.reset([[ProfileChooserController alloc] | |
114 initWithBrowser:browser() | |
115 anchoredAt:point | |
116 viewMode:profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER | |
117 tutorialMode:profiles::TUTORIAL_MODE_NONE | |
118 serviceType:signin::GAIA_SERVICE_TYPE_NONE | |
119 accessPoint:signin_metrics::AccessPoint:: | |
120 ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN]); | |
121 [controller_ showWindow:nil]; | |
122 } | |
123 | |
124 void SignInFirstProfile() { | 110 void SignInFirstProfile() { |
125 std::vector<ProfileAttributesEntry*> entries = testing_profile_manager()-> | 111 std::vector<ProfileAttributesEntry*> entries = testing_profile_manager()-> |
126 profile_attributes_storage()->GetAllProfilesAttributes(); | 112 profile_attributes_storage()->GetAllProfilesAttributes(); |
127 ASSERT_LE(1U, entries.size()); | 113 ASSERT_LE(1U, entries.size()); |
128 ProfileAttributesEntry* entry = entries.front(); | 114 ProfileAttributesEntry* entry = entries.front(); |
129 entry->SetAuthInfo(kGaiaId, base::ASCIIToUTF16(kEmail)); | 115 entry->SetAuthInfo(kGaiaId, base::ASCIIToUTF16(kEmail)); |
130 } | 116 } |
131 | 117 |
132 ProfileChooserController* controller() { return controller_; } | 118 ProfileChooserController* controller() { return controller_; } |
133 AvatarMenu* menu() { return menu_; } | 119 AvatarMenu* menu() { return menu_; } |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 ASSERT_EQ(3U, [buttonSubviews count]); | 467 ASSERT_EQ(3U, [buttonSubviews count]); |
482 | 468 |
483 // There should be a lock button. | 469 // There should be a lock button. |
484 NSButton* lockButton = | 470 NSButton* lockButton = |
485 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); | 471 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); |
486 ASSERT_TRUE(lockButton); | 472 ASSERT_TRUE(lockButton); |
487 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); | 473 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); |
488 EXPECT_EQ(controller(), [lockButton target]); | 474 EXPECT_EQ(controller(), [lockButton target]); |
489 EXPECT_TRUE([lockButton isEnabled]); | 475 EXPECT_TRUE([lockButton isEnabled]); |
490 } | 476 } |
OLD | NEW |