| 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/profile_chooser_view.h" | 5 #include "chrome/browser/ui/views/profiles/profile_chooser_view.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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 void OpenProfileChooserView(Browser* browser){ | 107 void OpenProfileChooserView(Browser* browser){ |
| 108 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 108 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 109 NewAvatarButton* button = browser_view->frame()->GetNewAvatarMenuButton(); | 109 NewAvatarButton* button = browser_view->frame()->GetNewAvatarMenuButton(); |
| 110 if (!button) | 110 if (!button) |
| 111 NOTREACHED() << "NewAvatarButton not found."; | 111 NOTREACHED() << "NewAvatarButton not found."; |
| 112 if (browser_view->frame()->GetAvatarMenuButton()) | 112 if (browser_view->frame()->GetAvatarMenuButton()) |
| 113 NOTREACHED() << "Old Avatar Menu Button found."; | 113 NOTREACHED() << "Old Avatar Menu Button found."; |
| 114 | 114 |
| 115 ProfileChooserView::close_on_deactivate_for_testing_ = false; | 115 ProfileChooserView::close_on_deactivate_for_testing_ = false; |
| 116 | 116 |
| 117 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 117 ui::MouseEvent e( |
| 118 ui::EventTimeForNow(), 0, 0); | 118 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), |
| 119 ui::EventTimeForNow(), 0, 0, |
| 120 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 119 button->NotifyClick(e); | 121 button->NotifyClick(e); |
| 120 base::MessageLoop::current()->RunUntilIdle(); | 122 base::MessageLoop::current()->RunUntilIdle(); |
| 121 EXPECT_TRUE(ProfileChooserView::IsShowing()); | 123 EXPECT_TRUE(ProfileChooserView::IsShowing()); |
| 122 | 124 |
| 123 // Create this observer before lock is pressed to avoid a race condition. | 125 // Create this observer before lock is pressed to avoid a race condition. |
| 124 window_close_observer_.reset(new content::WindowedNotificationObserver( | 126 window_close_observer_.reset(new content::WindowedNotificationObserver( |
| 125 chrome::NOTIFICATION_BROWSER_CLOSED, | 127 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 126 content::Source<Browser>(browser))); | 128 content::Source<Browser>(browser))); |
| 127 } | 129 } |
| 128 | 130 |
| 129 AvatarMenu* GetProfileChooserViewAvatarMenu() { | 131 AvatarMenu* GetProfileChooserViewAvatarMenu() { |
| 130 return ProfileChooserView::profile_bubble_->avatar_menu_.get(); | 132 return ProfileChooserView::profile_bubble_->avatar_menu_.get(); |
| 131 } | 133 } |
| 132 | 134 |
| 133 void ClickProfileChooserViewLockButton() { | 135 void ClickProfileChooserViewLockButton() { |
| 134 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 136 ui::MouseEvent e( |
| 135 ui::EventTimeForNow(), 0, 0); | 137 ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), |
| 138 ui::EventTimeForNow(), 0, 0, |
| 139 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 136 ProfileChooserView::profile_bubble_->ButtonPressed( | 140 ProfileChooserView::profile_bubble_->ButtonPressed( |
| 137 ProfileChooserView::profile_bubble_->lock_button_, e); | 141 ProfileChooserView::profile_bubble_->lock_button_, e); |
| 138 } | 142 } |
| 139 | 143 |
| 140 // Access the registry that has been prepared with at least one extension. | 144 // Access the registry that has been prepared with at least one extension. |
| 141 extensions::ExtensionRegistry* GetPreparedRegistry(Profile* signed_in) { | 145 extensions::ExtensionRegistry* GetPreparedRegistry(Profile* signed_in) { |
| 142 extensions::ExtensionRegistry* registry = | 146 extensions::ExtensionRegistry* registry = |
| 143 extensions::ExtensionRegistry::Get(signed_in); | 147 extensions::ExtensionRegistry::Get(signed_in); |
| 144 const size_t initial_num_extensions = registry->enabled_extensions().size(); | 148 const size_t initial_num_extensions = registry->enabled_extensions().size(); |
| 145 const extensions::Extension* ext = LoadExtension( | 149 const extensions::Extension* ext = LoadExtension( |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 WaitForUserManager(); | 297 WaitForUserManager(); |
| 294 // Assert that the first profile's extensions are not blocked. | 298 // Assert that the first profile's extensions are not blocked. |
| 295 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); | 299 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); |
| 296 ASSERT_EQ(0U, registry->blocked_extensions().size()); | 300 ASSERT_EQ(0U, registry->blocked_extensions().size()); |
| 297 | 301 |
| 298 // We need to hide the User Manager or else the process can't die. | 302 // We need to hide the User Manager or else the process can't die. |
| 299 UserManager::Hide(); | 303 UserManager::Hide(); |
| 300 } | 304 } |
| 301 | 305 |
| 302 #endif | 306 #endif |
| OLD | NEW |