OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/views/avatar_menu_button.h" | 5 #include "chrome/browser/ui/views/avatar_menu_button.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 AvatarMenuButton* AvatarMenuButtonTest::GetAvatarMenuButton() { | 57 AvatarMenuButton* AvatarMenuButtonTest::GetAvatarMenuButton() { |
58 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 58 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
59 browser()->window()); | 59 browser()->window()); |
60 return browser_view->frame()->GetAvatarMenuButton(); | 60 return browser_view->frame()->GetAvatarMenuButton(); |
61 } | 61 } |
62 | 62 |
63 void AvatarMenuButtonTest::StartAvatarMenu() { | 63 void AvatarMenuButtonTest::StartAvatarMenu() { |
64 AvatarMenuButton* button = GetAvatarMenuButton(); | 64 AvatarMenuButton* button = GetAvatarMenuButton(); |
65 ASSERT_TRUE(button); | 65 ASSERT_TRUE(button); |
66 | 66 |
67 AvatarMenuBubbleView::set_close_on_deactivate(false); | 67 AvatarMenuBubbleView::clear_close_on_deactivate_for_testing(); |
68 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( | 68 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( |
69 NULL, gfx::Point()); | 69 NULL, gfx::Point()); |
70 base::MessageLoop::current()->RunUntilIdle(); | 70 base::MessageLoop::current()->RunUntilIdle(); |
71 EXPECT_TRUE(AvatarMenuBubbleView::IsShowing()); | 71 EXPECT_TRUE(AvatarMenuBubbleView::IsShowing()); |
72 } | 72 } |
73 | 73 |
74 IN_PROC_BROWSER_TEST_F(AvatarMenuButtonTest, HideOnSecondClick) { | 74 IN_PROC_BROWSER_TEST_F(AvatarMenuButtonTest, HideOnSecondClick) { |
75 #if defined(OS_WIN) && defined(USE_ASH) | 75 #if defined(OS_WIN) && defined(USE_ASH) |
76 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 76 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
77 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 77 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
(...skipping 10 matching lines...) Expand all Loading... |
88 // Verify that clicking again doesn't reshow it. | 88 // Verify that clicking again doesn't reshow it. |
89 AvatarMenuButton* button = GetAvatarMenuButton(); | 89 AvatarMenuButton* button = GetAvatarMenuButton(); |
90 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( | 90 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( |
91 NULL, gfx::Point()); | 91 NULL, gfx::Point()); |
92 // Hide the bubble manually. In the browser this would normally happen during | 92 // Hide the bubble manually. In the browser this would normally happen during |
93 // the event processing. | 93 // the event processing. |
94 AvatarMenuBubbleView::Hide(); | 94 AvatarMenuBubbleView::Hide(); |
95 base::MessageLoop::current()->RunUntilIdle(); | 95 base::MessageLoop::current()->RunUntilIdle(); |
96 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); | 96 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); |
97 } | 97 } |
OLD | NEW |