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

Side by Side Diff: chrome/browser/ui/views/avatar_menu_button_browsertest.cc

Issue 18615010: Refactor utility methods out of the ProfileManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unbreak rebase and added new static fn from trunk Created 7 years, 5 months 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 unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/profiles/avatar_menu_model.h" 11 #include "chrome/browser/profiles/avatar_menu_model.h"
12 #include "chrome/browser/profiles/profile_manager.h" 12 #include "chrome/browser/profiles/profile_manager.h"
13 #include "chrome/browser/profiles/profiles_state.h"
13 #include "chrome/browser/ui/browser_list.h" 14 #include "chrome/browser/ui/browser_list.h"
14 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h" 15 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h"
15 #include "chrome/browser/ui/views/frame/browser_view.h" 16 #include "chrome/browser/ui/views/frame/browser_view.h"
16 #include "chrome/browser/ui/views/profile_chooser_view.h" 17 #include "chrome/browser/ui/views/profile_chooser_view.h"
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
19 #include "chrome/test/base/in_process_browser_test.h" 20 #include "chrome/test/base/in_process_browser_test.h"
20 #include "chrome/test/base/testing_browser_process.h" 21 #include "chrome/test/base/testing_browser_process.h"
21 #include "content/public/test/test_utils.h" 22 #include "content/public/test/test_utils.h"
22 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 96
96 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( 97 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked(
97 NULL, gfx::Point()); 98 NULL, gfx::Point());
98 base::MessageLoop::current()->RunUntilIdle(); 99 base::MessageLoop::current()->RunUntilIdle();
99 EXPECT_NE(AvatarMenuBubbleView::IsShowing(), 100 EXPECT_NE(AvatarMenuBubbleView::IsShowing(),
100 ProfileChooserView::IsShowing()); 101 ProfileChooserView::IsShowing());
101 } 102 }
102 103
103 104
104 IN_PROC_BROWSER_TEST_P(AvatarMenuButtonTest, HideOnSecondClick) { 105 IN_PROC_BROWSER_TEST_P(AvatarMenuButtonTest, HideOnSecondClick) {
105 if (!ProfileManager::IsMultipleProfilesEnabled() || 106 if (!profiles::IsMultipleProfilesEnabled() ||
106 UsingNewProfileChooser()) { 107 UsingNewProfileChooser()) {
107 return; 108 return;
108 } 109 }
109 110
110 CreateTestingProfile(); 111 CreateTestingProfile();
111 StartAvatarMenu(); 112 StartAvatarMenu();
112 113
113 // Verify that clicking again doesn't reshow it. 114 // Verify that clicking again doesn't reshow it.
114 AvatarMenuButton* button = GetAvatarMenuButton(); 115 AvatarMenuButton* button = GetAvatarMenuButton();
115 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked( 116 static_cast<views::MenuButtonListener*>(button)->OnMenuButtonClicked(
116 NULL, gfx::Point()); 117 NULL, gfx::Point());
117 // Hide the bubble manually. In the browser this would normally happen during 118 // Hide the bubble manually. In the browser this would normally happen during
118 // the event processing. 119 // the event processing.
119 AvatarMenuBubbleView::Hide(); 120 AvatarMenuBubbleView::Hide();
120 base::MessageLoop::current()->RunUntilIdle(); 121 base::MessageLoop::current()->RunUntilIdle();
121 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing()); 122 EXPECT_FALSE(AvatarMenuBubbleView::IsShowing());
122 EXPECT_FALSE(ProfileChooserView::IsShowing()); 123 EXPECT_FALSE(ProfileChooserView::IsShowing());
123 } 124 }
124 125
125 126
126 IN_PROC_BROWSER_TEST_P(AvatarMenuButtonTest, NewSignOut) { 127 IN_PROC_BROWSER_TEST_P(AvatarMenuButtonTest, NewSignOut) {
127 if (!ProfileManager::IsMultipleProfilesEnabled() || 128 if (!profiles::IsMultipleProfilesEnabled() ||
128 !UsingNewProfileChooser()) { 129 !UsingNewProfileChooser()) {
129 return; 130 return;
130 } 131 }
131 132
132 CreateTestingProfile(); 133 CreateTestingProfile();
133 StartAvatarMenu(); 134 StartAvatarMenu();
134 135
135 BrowserList* browser_list = 136 BrowserList* browser_list =
136 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE); 137 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE);
137 EXPECT_EQ(1U, browser_list->size()); 138 EXPECT_EQ(1U, browser_list->size());
(...skipping 16 matching lines...) Expand all
154 155
155 EXPECT_TRUE(model->GetItemAt(model->GetActiveProfileIndex()).signin_required); 156 EXPECT_TRUE(model->GetItemAt(model->GetActiveProfileIndex()).signin_required);
156 157
157 window_close_observer.Wait(); // Rely on test timeout for failure indication. 158 window_close_observer.Wait(); // Rely on test timeout for failure indication.
158 EXPECT_TRUE(browser_list->empty()); 159 EXPECT_TRUE(browser_list->empty());
159 } 160 }
160 161
161 162
162 INSTANTIATE_TEST_CASE_P(Old, AvatarMenuButtonTest, testing::Values(false)); 163 INSTANTIATE_TEST_CASE_P(Old, AvatarMenuButtonTest, testing::Values(false));
163 INSTANTIATE_TEST_CASE_P(New, AvatarMenuButtonTest, testing::Values(true)); 164 INSTANTIATE_TEST_CASE_P(New, AvatarMenuButtonTest, testing::Values(true));
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_button.cc ('k') | chrome/browser/ui/webui/options/browser_options_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698