| 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 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" | 5 #include "chrome/browser/ui/views/profiles/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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 // This test doesn't make sense for ChromeOS since it has a different | 77 // This test doesn't make sense for ChromeOS since it has a different |
| 78 // multi-profiles menu in the system tray instead. | 78 // multi-profiles menu in the system tray instead. |
| 79 #define MAYBE_HideOnSecondClick DISABLED_HideOnSecondClick | 79 #define MAYBE_HideOnSecondClick DISABLED_HideOnSecondClick |
| 80 #else | 80 #else |
| 81 #define MAYBE_HideOnSecondClick HideOnSecondClick | 81 #define MAYBE_HideOnSecondClick HideOnSecondClick |
| 82 #endif | 82 #endif |
| 83 | 83 |
| 84 IN_PROC_BROWSER_TEST_F(AvatarMenuButtonTest, MAYBE_HideOnSecondClick) { | 84 IN_PROC_BROWSER_TEST_F(AvatarMenuButtonTest, MAYBE_HideOnSecondClick) { |
| 85 #if defined(OS_WIN) && defined(USE_ASH) | 85 #if defined(OS_WIN) && defined(USE_ASH) |
| 86 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 86 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 87 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 87 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 88 switches::kAshBrowserTests)) |
| 88 return; | 89 return; |
| 89 #endif | 90 #endif |
| 90 | 91 |
| 91 // If multiprofile mode is not enabled, you can't switch between profiles. | 92 // If multiprofile mode is not enabled, you can't switch between profiles. |
| 92 if (!profiles::IsMultipleProfilesEnabled()) | 93 if (!profiles::IsMultipleProfilesEnabled()) |
| 93 return; | 94 return; |
| 94 | 95 |
| 95 CreateTestingProfile(); | 96 CreateTestingProfile(); |
| 96 ASSERT_NO_FATAL_FAILURE(StartAvatarMenu()); | 97 ASSERT_NO_FATAL_FAILURE(StartAvatarMenu()); |
| 97 | 98 |
| 98 // Verify that clicking again doesn't reshow it. | 99 // Verify that clicking again doesn't reshow it. |
| 99 AvatarMenuButton* button = GetAvatarMenuButton(); | 100 AvatarMenuButton* button = GetAvatarMenuButton(); |
| 100 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( | 101 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( |
| 101 NULL, gfx::Point()); | 102 NULL, gfx::Point()); |
| 102 // Hide the bubble manually. In the browser this would normally happen during | 103 // Hide the bubble manually. In the browser this would normally happen during |
| 103 // the event processing. | 104 // the event processing. |
| 104 AvatarMenuBubbleView::Hide(); | 105 AvatarMenuBubbleView::Hide(); |
| 105 base::MessageLoop::current()->RunUntilIdle(); | 106 base::MessageLoop::current()->RunUntilIdle(); |
| 106 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); | 107 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); |
| 107 } | 108 } |
| OLD | NEW |