Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm

Issue 1473543002: Implement newly designed sign-in related histograms for desktop platorms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN]);
99 [controller_ showWindow:nil]; 100 [controller_ showWindow:nil];
100 } 101 }
101 102
102 void AssertRightClickTutorialShown() { 103 void AssertRightClickTutorialShown() {
103 NSArray* subviews = [[[controller() window] contentView] subviews]; 104 NSArray* subviews = [[[controller() window] contentView] subviews];
104 ASSERT_EQ(2U, [subviews count]); 105 ASSERT_EQ(2U, [subviews count]);
105 subviews = [[subviews objectAtIndex:0] subviews]; 106 subviews = [[subviews objectAtIndex:0] subviews];
106 107
107 // There should be 4 views: the tutorial, the active profile card, a 108 // There should be 4 views: the tutorial, the active profile card, a
108 // separator and the options view. 109 // separator and the options view.
(...skipping 18 matching lines...) Expand all
127 } 128 }
128 129
129 void StartFastUserSwitcher() { 130 void StartFastUserSwitcher() {
130 NSRect frame = [test_window() frame]; 131 NSRect frame = [test_window() frame];
131 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); 132 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame));
132 controller_.reset([[ProfileChooserController alloc] 133 controller_.reset([[ProfileChooserController alloc]
133 initWithBrowser:browser() 134 initWithBrowser:browser()
134 anchoredAt:point 135 anchoredAt:point
135 viewMode:profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER 136 viewMode:profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER
136 tutorialMode:profiles::TUTORIAL_MODE_NONE 137 tutorialMode:profiles::TUTORIAL_MODE_NONE
137 serviceType:signin::GAIA_SERVICE_TYPE_NONE]); 138 serviceType:signin::GAIA_SERVICE_TYPE_NONE
139 accessPoint:signin_metrics::ACCESS_POINT_AVATAR_BUBBLE_SIGN_IN]);
138 [controller_ showWindow:nil]; 140 [controller_ showWindow:nil];
139 } 141 }
140 142
141 ProfileChooserController* controller() { return controller_; } 143 ProfileChooserController* controller() { return controller_; }
142 AvatarMenu* menu() { return menu_; } 144 AvatarMenu* menu() { return menu_; }
143 145
144 private: 146 private:
145 base::scoped_nsobject<ProfileChooserController> controller_; 147 base::scoped_nsobject<ProfileChooserController> controller_;
146 148
147 // Weak; owned by |controller_|. 149 // Weak; owned by |controller_|.
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 ASSERT_EQ(5U, [buttonSubviews count]); 549 ASSERT_EQ(5U, [buttonSubviews count]);
548 550
549 // There should be a lock button. 551 // There should be a lock button.
550 NSButton* lockButton = 552 NSButton* lockButton =
551 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]); 553 base::mac::ObjCCast<NSButton>([buttonSubviews objectAtIndex:0]);
552 ASSERT_TRUE(lockButton); 554 ASSERT_TRUE(lockButton);
553 EXPECT_EQ(@selector(lockProfile:), [lockButton action]); 555 EXPECT_EQ(@selector(lockProfile:), [lockButton action]);
554 EXPECT_EQ(controller(), [lockButton target]); 556 EXPECT_EQ(controller(), [lockButton target]);
555 EXPECT_TRUE([lockButton isEnabled]); 557 EXPECT_TRUE([lockButton isEnabled]);
556 } 558 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698