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

Unified Diff: chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm

Issue 2552423002: [Mac] Fix for avatar button active state (Closed)
Patch Set: Removed the Fast Chooser Profile Menu code in cocoa Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
index 19ab0a4ba0a696cf3b19b721a9ec016411e8461a..b0b0fd395bd0e1759114f2906d176d3a4b6b0871 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
@@ -29,31 +29,6 @@
- (void)setErrorStatus:(BOOL)hasError;
@end
-// Subclassing AvatarButtonController to be able to control the state of
-// keyboard modifierFlags.
-@interface AvatarButtonControllerForTesting : AvatarButtonController {
- @private
- bool isCtrlPressed_;
-}
-@end
-
-@interface AvatarButtonControllerForTesting (ExposedForTesting)
-- (void)setIsCtrlPressed:(BOOL)isPressed;
-- (BOOL)isCtrlPressed;
-@end
-
-@implementation AvatarButtonControllerForTesting
-- (void)setIsCtrlPressed:(BOOL)isPressed {
- isCtrlPressed_ = isPressed;
-}
-
-- (BOOL)isCtrlPressed {
- // Always report that Cmd is not pressed since that's the case we're testing
- // and otherwise running the test while holding the Cmd key makes it fail.
- return isCtrlPressed_;
-}
-@end
-
class AvatarButtonControllerTest : public CocoaProfileTest {
public:
void SetUp() override {
@@ -63,8 +38,7 @@ class AvatarButtonControllerTest : public CocoaProfileTest {
ASSERT_TRUE(browser());
controller_.reset(
- [[AvatarButtonControllerForTesting alloc] initWithBrowser:browser()]);
- [controller_ setIsCtrlPressed:false];
+ [[AvatarButtonController alloc] initWithBrowser:browser()]);
}
void TearDown() override {
@@ -76,10 +50,10 @@ class AvatarButtonControllerTest : public CocoaProfileTest {
NSView* view() { return [controller_ view]; }
- AvatarButtonControllerForTesting* controller() { return controller_.get(); }
+ AvatarButtonController* controller() { return controller_.get(); }
private:
- base::scoped_nsobject<AvatarButtonControllerForTesting> controller_;
+ base::scoped_nsobject<AvatarButtonController> controller_;
};
TEST_F(AvatarButtonControllerTest, GenericButtonShown) {
@@ -130,32 +104,3 @@ TEST_F(AvatarButtonControllerTest, DoubleOpen) {
[menu close];
EXPECT_FALSE([controller() menuController]);
}
-
-TEST_F(AvatarButtonControllerTest, DontOpenFastSwitcherWithoutTarget) {
- EXPECT_FALSE([controller() menuController]);
-
- [controller() setIsCtrlPressed:YES];
- [button() performClick:button()];
-
- // If there's only one profile and the fast user switcher is requested,
- // nothing should happen.
- EXPECT_FALSE([controller() menuController]);
-}
-
-TEST_F(AvatarButtonControllerTest, OpenFastUserSwitcherWithTarget) {
- testing_profile_manager()->CreateTestingProfile("batman");
- EXPECT_FALSE([controller() menuController]);
-
- [controller() setIsCtrlPressed:YES];
- [button() performClick:button()];
-
- BaseBubbleController* menu = [controller() menuController];
- EXPECT_TRUE(menu);
- EXPECT_TRUE([menu isKindOfClass:[ProfileChooserController class]]);
-
- // Do not animate out because that is hard to test around.
- static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations =
- info_bubble::kAnimateNone;
- [menu close];
- EXPECT_FALSE([controller() menuController]);
-}
« no previous file with comments | « chrome/browser/ui/cocoa/profiles/avatar_button_controller.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698