| 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/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 AvatarMenuButton* AvatarMenuButtonTest::GetAvatarMenuButton() { | 89 AvatarMenuButton* AvatarMenuButtonTest::GetAvatarMenuButton() { |
| 90 BrowserView* browser_view = reinterpret_cast<BrowserView*>( | 90 BrowserView* browser_view = reinterpret_cast<BrowserView*>( |
| 91 browser()->window()); | 91 browser()->window()); |
| 92 return browser_view->frame()->GetAvatarMenuButton(); | 92 return browser_view->frame()->GetAvatarMenuButton(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void AvatarMenuButtonTest::StartAvatarMenu() { | 95 void AvatarMenuButtonTest::StartAvatarMenu() { |
| 96 AvatarMenuButton* button = GetAvatarMenuButton(); | 96 AvatarMenuButton* button = GetAvatarMenuButton(); |
| 97 ASSERT_TRUE(button); | 97 ASSERT_TRUE(button); |
| 98 | 98 |
| 99 AvatarMenuBubbleView::set_close_on_deactiavte(false); |
| 100 ProfileChooserView::set_close_on_deactiavte(false); |
| 99 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( | 101 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( |
| 100 NULL, gfx::Point()); | 102 NULL, gfx::Point()); |
| 101 base::MessageLoop::current()->RunUntilIdle(); | 103 base::MessageLoop::current()->RunUntilIdle(); |
| 102 EXPECT_NE(AvatarMenuBubbleView::IsShowing(), | 104 EXPECT_NE(AvatarMenuBubbleView::IsShowing(), |
| 103 ProfileChooserView::IsShowing()); | 105 ProfileChooserView::IsShowing()); |
| 104 } | 106 } |
| 105 | 107 |
| 106 IN_PROC_BROWSER_TEST_P(AvatarMenuButtonTest, HideOnSecondClick) { | 108 IN_PROC_BROWSER_TEST_P(AvatarMenuButtonTest, HideOnSecondClick) { |
| 107 if (!profiles::IsMultipleProfilesEnabled() || | 109 if (!profiles::IsMultipleProfilesEnabled() || |
| 108 UsingNewProfileChooser()) { | 110 UsingNewProfileChooser()) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 int final_tab_count = browser()->tab_strip_model()->count(); | 185 int final_tab_count = browser()->tab_strip_model()->count(); |
| 184 EXPECT_EQ(1U, browser_list->size()); | 186 EXPECT_EQ(1U, browser_list->size()); |
| 185 EXPECT_EQ(starting_tab_count + 1, final_tab_count); | 187 EXPECT_EQ(starting_tab_count + 1, final_tab_count); |
| 186 | 188 |
| 187 GURL tab_url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); | 189 GURL tab_url = browser()->tab_strip_model()->GetActiveWebContents()->GetURL(); |
| 188 EXPECT_EQ(std::string(chrome::kChromeUIUserChooserURL), tab_url.spec()); | 190 EXPECT_EQ(std::string(chrome::kChromeUIUserChooserURL), tab_url.spec()); |
| 189 } | 191 } |
| 190 | 192 |
| 191 INSTANTIATE_TEST_CASE_P(Old, AvatarMenuButtonTest, testing::Values(false)); | 193 INSTANTIATE_TEST_CASE_P(Old, AvatarMenuButtonTest, testing::Values(false)); |
| 192 INSTANTIATE_TEST_CASE_P(New, AvatarMenuButtonTest, testing::Values(true)); | 194 INSTANTIATE_TEST_CASE_P(New, AvatarMenuButtonTest, testing::Values(true)); |
| OLD | NEW |