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/avatar_button_controller.h" | 5 #import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.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 13 matching lines...) Expand all Loading... |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
26 | 26 |
27 // Defined in the AvatarButtonController implementation. | 27 // Defined in the AvatarButtonController implementation. |
28 @interface AvatarButtonController (ExposedForTesting) | 28 @interface AvatarButtonController (ExposedForTesting) |
29 - (void)updateErrorStatus:(BOOL)hasError; | 29 - (void)updateErrorStatus:(BOOL)hasError; |
30 @end | 30 @end |
31 | 31 |
32 class AvatarButtonControllerTest : public CocoaProfileTest { | 32 class AvatarButtonControllerTest : public CocoaProfileTest { |
33 public: | 33 public: |
34 virtual void SetUp() OVERRIDE { | 34 virtual void SetUp() override { |
35 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); | 35 switches::EnableNewAvatarMenuForTesting(CommandLine::ForCurrentProcess()); |
36 DCHECK(profiles::IsMultipleProfilesEnabled()); | 36 DCHECK(profiles::IsMultipleProfilesEnabled()); |
37 | 37 |
38 CocoaProfileTest::SetUp(); | 38 CocoaProfileTest::SetUp(); |
39 ASSERT_TRUE(browser()); | 39 ASSERT_TRUE(browser()); |
40 | 40 |
41 controller_.reset( | 41 controller_.reset( |
42 [[AvatarButtonController alloc] initWithBrowser:browser()]); | 42 [[AvatarButtonController alloc] initWithBrowser:browser()]); |
43 } | 43 } |
44 | 44 |
45 virtual void TearDown() OVERRIDE { | 45 virtual void TearDown() override { |
46 browser()->window()->Close(); | 46 browser()->window()->Close(); |
47 CocoaProfileTest::TearDown(); | 47 CocoaProfileTest::TearDown(); |
48 } | 48 } |
49 | 49 |
50 NSButton* button() { return [controller_ buttonView]; } | 50 NSButton* button() { return [controller_ buttonView]; } |
51 | 51 |
52 NSView* view() { return [controller_ view]; } | 52 NSView* view() { return [controller_ view]; } |
53 | 53 |
54 AvatarButtonController* controller() { return controller_.get(); } | 54 AvatarButtonController* controller() { return controller_.get(); } |
55 | 55 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 [button() performClick:button()]; | 100 [button() performClick:button()]; |
101 EXPECT_EQ(menu, [controller() menuController]); | 101 EXPECT_EQ(menu, [controller() menuController]); |
102 | 102 |
103 // Do not animate out because that is hard to test around. | 103 // Do not animate out because that is hard to test around. |
104 static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations = | 104 static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations = |
105 info_bubble::kAnimateNone; | 105 info_bubble::kAnimateNone; |
106 [menu close]; | 106 [menu close]; |
107 EXPECT_FALSE([controller() menuController]); | 107 EXPECT_FALSE([controller() menuController]); |
108 } | 108 } |
OLD | NEW |