| 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 <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" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 void OpenProfileChooserView(Browser* browser) { | 118 void OpenProfileChooserView(Browser* browser) { |
| 119 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 119 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 120 views::View* button = browser_view->frame()->GetNewAvatarMenuButton(); | 120 views::View* button = browser_view->frame()->GetNewAvatarMenuButton(); |
| 121 if (!button) | 121 if (!button) |
| 122 NOTREACHED() << "NewAvatarButton not found."; | 122 NOTREACHED() << "NewAvatarButton not found."; |
| 123 | 123 |
| 124 ProfileChooserView::close_on_deactivate_for_testing_ = false; | 124 ProfileChooserView::close_on_deactivate_for_testing_ = false; |
| 125 | 125 |
| 126 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 126 ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), |
| 127 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); | 127 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); |
| 128 button->OnMouseReleased(e); | 128 button->OnMousePressed(e); |
| 129 base::RunLoop().RunUntilIdle(); | 129 base::RunLoop().RunUntilIdle(); |
| 130 EXPECT_TRUE(ProfileChooserView::IsShowing()); | 130 EXPECT_TRUE(ProfileChooserView::IsShowing()); |
| 131 | 131 |
| 132 // Create this observer before lock is pressed to avoid a race condition. | 132 // Create this observer before lock is pressed to avoid a race condition. |
| 133 window_close_observer_.reset(new content::WindowedNotificationObserver( | 133 window_close_observer_.reset(new content::WindowedNotificationObserver( |
| 134 chrome::NOTIFICATION_BROWSER_CLOSED, | 134 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 135 content::Source<Browser>(browser))); | 135 content::Source<Browser>(browser))); |
| 136 } | 136 } |
| 137 | 137 |
| 138 AvatarMenu* GetProfileChooserViewAvatarMenu() { | 138 AvatarMenu* GetProfileChooserViewAvatarMenu() { |
| 139 return ProfileChooserView::profile_bubble_->avatar_menu_.get(); | 139 return ProfileChooserView::profile_bubble_->avatar_menu_.get(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 void ClickProfileChooserViewLockButton() { | 142 void ClickProfileChooserViewLockButton() { |
| 143 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 143 ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), |
| 144 ui::EventTimeForNow(), 0, 0); | 144 ui::EventTimeForNow(), 0, 0); |
| 145 ProfileChooserView::profile_bubble_->ButtonPressed( | 145 ProfileChooserView::profile_bubble_->ButtonPressed( |
| 146 ProfileChooserView::profile_bubble_->lock_button_, e); | 146 ProfileChooserView::profile_bubble_->lock_button_, e); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Access the registry that has been prepared with at least one extension. | 149 // Access the registry that has been prepared with at least one extension. |
| 150 extensions::ExtensionRegistry* GetPreparedRegistry(Profile* signed_in) { | 150 extensions::ExtensionRegistry* GetPreparedRegistry(Profile* signed_in) { |
| 151 extensions::ExtensionRegistry* registry = | 151 extensions::ExtensionRegistry* registry = |
| 152 extensions::ExtensionRegistry::Get(signed_in); | 152 extensions::ExtensionRegistry::Get(signed_in); |
| 153 const size_t initial_num_extensions = registry->enabled_extensions().size(); | 153 const size_t initial_num_extensions = registry->enabled_extensions().size(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Wait until the user manager is shown. | 294 // Wait until the user manager is shown. |
| 295 runner->Run(); | 295 runner->Run(); |
| 296 | 296 |
| 297 // Assert that the first profile's extensions are not blocked. | 297 // Assert that the first profile's extensions are not blocked. |
| 298 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); | 298 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); |
| 299 ASSERT_EQ(0U, registry->blocked_extensions().size()); | 299 ASSERT_EQ(0U, registry->blocked_extensions().size()); |
| 300 | 300 |
| 301 // We need to hide the User Manager or else the process can't die. | 301 // We need to hide the User Manager or else the process can't die. |
| 302 UserManager::Hide(); | 302 UserManager::Hide(); |
| 303 } | 303 } |
| OLD | NEW |