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

Side by Side Diff: chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc

Issue 1608843002: Start untangling the avatar switcher from BrowserNonClientFrameView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20160119-MacViewsBrowser-Compile
Patch Set: rename, enum class Created 4 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/profiles/new_avatar_button.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/profile_chooser_view.h" 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/prefs/pref_service.h" 12 #include "base/prefs/pref_service.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/test/histogram_tester.h" 14 #include "base/test/histogram_tester.h"
15 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/extensions/extension_browsertest.h" 17 #include "chrome/browser/extensions/extension_browsertest.h"
18 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/browser/profiles/profile_metrics.h" 19 #include "chrome/browser/profiles/profile_metrics.h"
20 #include "chrome/browser/profiles/profiles_state.h" 20 #include "chrome/browser/profiles/profiles_state.h"
21 #include "chrome/browser/ui/browser_list.h" 21 #include "chrome/browser/ui/browser_list.h"
22 #include "chrome/browser/ui/user_manager.h" 22 #include "chrome/browser/ui/user_manager.h"
23 #include "chrome/browser/ui/views/frame/browser_view.h" 23 #include "chrome/browser/ui/views/frame/browser_view.h"
24 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h" 24 #include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
25 #include "chrome/browser/ui/views/profiles/new_avatar_button.h"
26 #include "chrome/browser/ui/views/profiles/user_manager_view.h" 25 #include "chrome/browser/ui/views/profiles/user_manager_view.h"
27 #include "chrome/common/chrome_paths.h" 26 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
30 #include "components/signin/core/common/profile_management_switches.h" 29 #include "components/signin/core/common/profile_management_switches.h"
31 #include "components/signin/core/common/signin_pref_names.h" 30 #include "components/signin/core/common/signin_pref_names.h"
32 #include "content/public/test/test_utils.h" 31 #include "content/public/test/test_utils.h"
33 #include "extensions/browser/extension_registry.h" 32 #include "extensions/browser/extension_registry.h"
34 #include "ui/events/event_utils.h" 33 #include "ui/events/event_utils.h"
35 #include "ui/views/controls/webview/webview.h" 34 #include "ui/views/controls/webview/webview.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 DCHECK(switches::IsNewProfileManagement()); 110 DCHECK(switches::IsNewProfileManagement());
112 } 111 }
113 112
114 void SetUpCommandLine(base::CommandLine* command_line) override { 113 void SetUpCommandLine(base::CommandLine* command_line) override {
115 ExtensionBrowserTest::SetUpCommandLine(command_line); 114 ExtensionBrowserTest::SetUpCommandLine(command_line);
116 switches::EnableNewProfileManagementForTesting(command_line); 115 switches::EnableNewProfileManagementForTesting(command_line);
117 } 116 }
118 117
119 void OpenProfileChooserView(Browser* browser){ 118 void OpenProfileChooserView(Browser* browser){
120 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); 119 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
121 NewAvatarButton* button = browser_view->frame()->GetNewAvatarMenuButton(); 120 views::View* button = browser_view->frame()->GetNewAvatarMenuButton();
122 if (!button) 121 if (!button)
123 NOTREACHED() << "NewAvatarButton not found."; 122 NOTREACHED() << "NewAvatarButton not found.";
124 if (browser_view->frame()->GetAvatarMenuButton()) 123 if (browser_view->frame()->GetAvatarMenuButton())
125 NOTREACHED() << "Old Avatar Menu Button found."; 124 NOTREACHED() << "Old Avatar Menu Button found.";
126 125
127 ProfileChooserView::close_on_deactivate_for_testing_ = false; 126 ProfileChooserView::close_on_deactivate_for_testing_ = false;
128 127
129 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), 128 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(),
130 ui::EventTimeForNow(), 0, 0); 129 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
131 button->NotifyClick(e); 130 button->OnMouseReleased(e);
132 base::MessageLoop::current()->RunUntilIdle(); 131 base::MessageLoop::current()->RunUntilIdle();
133 EXPECT_TRUE(ProfileChooserView::IsShowing()); 132 EXPECT_TRUE(ProfileChooserView::IsShowing());
134 133
135 // Create this observer before lock is pressed to avoid a race condition. 134 // Create this observer before lock is pressed to avoid a race condition.
136 window_close_observer_.reset(new content::WindowedNotificationObserver( 135 window_close_observer_.reset(new content::WindowedNotificationObserver(
137 chrome::NOTIFICATION_BROWSER_CLOSED, 136 chrome::NOTIFICATION_BROWSER_CLOSED,
138 content::Source<Browser>(browser))); 137 content::Source<Browser>(browser)));
139 } 138 }
140 139
141 AvatarMenu* GetProfileChooserViewAvatarMenu() { 140 AvatarMenu* GetProfileChooserViewAvatarMenu() {
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 EXPECT_EQ(1U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size()); 317 EXPECT_EQ(1U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size());
319 318
320 WaitForUserManager(); 319 WaitForUserManager();
321 // Assert that the first profile's extensions are not blocked. 320 // Assert that the first profile's extensions are not blocked.
322 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); 321 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size());
323 ASSERT_EQ(0U, registry->blocked_extensions().size()); 322 ASSERT_EQ(0U, registry->blocked_extensions().size());
324 323
325 // We need to hide the User Manager or else the process can't die. 324 // We need to hide the User Manager or else the process can't die.
326 UserManager::Hide(); 325 UserManager::Hide();
327 } 326 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/profiles/new_avatar_button.cc ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698