| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 - (BOOL)isCtrlPressed { | 50 - (BOOL)isCtrlPressed { |
| 51 // Always report that Cmd is not pressed since that's the case we're testing | 51 // Always report that Cmd is not pressed since that's the case we're testing |
| 52 // and otherwise running the test while holding the Cmd key makes it fail. | 52 // and otherwise running the test while holding the Cmd key makes it fail. |
| 53 return isCtrlPressed_; | 53 return isCtrlPressed_; |
| 54 } | 54 } |
| 55 @end | 55 @end |
| 56 | 56 |
| 57 class AvatarButtonControllerTest : public CocoaProfileTest { | 57 class AvatarButtonControllerTest : public CocoaProfileTest { |
| 58 public: | 58 public: |
| 59 void SetUp() override { | 59 void SetUp() override { |
| 60 switches::EnableNewAvatarMenuForTesting( | |
| 61 base::CommandLine::ForCurrentProcess()); | |
| 62 DCHECK(profiles::IsMultipleProfilesEnabled()); | 60 DCHECK(profiles::IsMultipleProfilesEnabled()); |
| 63 | 61 |
| 64 CocoaProfileTest::SetUp(); | 62 CocoaProfileTest::SetUp(); |
| 65 ASSERT_TRUE(browser()); | 63 ASSERT_TRUE(browser()); |
| 66 | 64 |
| 67 controller_.reset( | 65 controller_.reset( |
| 68 [[AvatarButtonControllerForTesting alloc] initWithBrowser:browser()]); | 66 [[AvatarButtonControllerForTesting alloc] initWithBrowser:browser()]); |
| 69 [controller_ setIsCtrlPressed:false]; | 67 [controller_ setIsCtrlPressed:false]; |
| 70 } | 68 } |
| 71 | 69 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 BaseBubbleController* menu = [controller() menuController]; | 153 BaseBubbleController* menu = [controller() menuController]; |
| 156 EXPECT_TRUE(menu); | 154 EXPECT_TRUE(menu); |
| 157 EXPECT_TRUE([menu isKindOfClass:[ProfileChooserController class]]); | 155 EXPECT_TRUE([menu isKindOfClass:[ProfileChooserController class]]); |
| 158 | 156 |
| 159 // Do not animate out because that is hard to test around. | 157 // Do not animate out because that is hard to test around. |
| 160 static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations = | 158 static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations = |
| 161 info_bubble::kAnimateNone; | 159 info_bubble::kAnimateNone; |
| 162 [menu close]; | 160 [menu close]; |
| 163 EXPECT_FALSE([controller() menuController]); | 161 EXPECT_FALSE([controller() menuController]); |
| 164 } | 162 } |
| OLD | NEW |