OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/profile_chooser_controller.h" | 5 #import "chrome/browser/ui/cocoa/browser/profile_chooser_controller.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 virtual void TearDown() OVERRIDE { | 57 virtual void TearDown() OVERRIDE { |
58 [controller() close]; | 58 [controller() close]; |
59 controller_.reset(); | 59 controller_.reset(); |
60 CocoaProfileTest::TearDown(); | 60 CocoaProfileTest::TearDown(); |
61 } | 61 } |
62 | 62 |
63 void StartProfileChooserController() { | 63 void StartProfileChooserController() { |
64 NSRect frame = [test_window() frame]; | 64 NSRect frame = [test_window() frame]; |
65 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); | 65 NSPoint point = NSMakePoint(NSMidX(frame), NSMidY(frame)); |
66 controller_.reset( | 66 controller_.reset([[ProfileChooserController alloc] |
67 [[ProfileChooserController alloc] initWithBrowser:browser() | 67 initWithBrowser:browser() |
68 anchoredAt:point]); | 68 anchoredAt:point |
| 69 viewMode:PROFILE_CHOOSER_VIEW]); |
69 [controller_ showWindow:nil]; | 70 [controller_ showWindow:nil]; |
70 } | 71 } |
71 | 72 |
72 ProfileChooserController* controller() { return controller_; } | 73 ProfileChooserController* controller() { return controller_; } |
73 AvatarMenu* menu() { return menu_; } | 74 AvatarMenu* menu() { return menu_; } |
74 | 75 |
75 private: | 76 private: |
76 base::scoped_nsobject<ProfileChooserController> controller_; | 77 base::scoped_nsobject<ProfileChooserController> controller_; |
77 | 78 |
78 // Weak; owned by |controller_|. | 79 // Weak; owned by |controller_|. |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 EXPECT_EQ(2U, [activeCardSubviews count]); | 273 EXPECT_EQ(2U, [activeCardSubviews count]); |
273 | 274 |
274 NSView* activeProfileImage = [activeCardSubviews objectAtIndex:0]; | 275 NSView* activeProfileImage = [activeCardSubviews objectAtIndex:0]; |
275 EXPECT_TRUE([activeProfileImage isKindOfClass:[NSImageView class]]); | 276 EXPECT_TRUE([activeProfileImage isKindOfClass:[NSImageView class]]); |
276 | 277 |
277 NSView* activeProfileName = [activeCardSubviews objectAtIndex:1]; | 278 NSView* activeProfileName = [activeCardSubviews objectAtIndex:1]; |
278 EXPECT_TRUE([activeProfileName isKindOfClass:[NSButton class]]); | 279 EXPECT_TRUE([activeProfileName isKindOfClass:[NSButton class]]); |
279 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16( | 280 EXPECT_EQ(menu()->GetItemAt(0).name, base::SysNSStringToUTF16( |
280 [static_cast<NSButton*>(activeProfileName) title])); | 281 [static_cast<NSButton*>(activeProfileName) title])); |
281 } | 282 } |
OLD | NEW |