| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 } | 128 } |
| 129 | 129 |
| 130 void OpenProfileChooserView(Browser* browser) { | 130 void OpenProfileChooserView(Browser* browser) { |
| 131 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 131 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 132 views::View* button = browser_view->frame()->GetNewAvatarMenuButton(); | 132 views::View* button = browser_view->frame()->GetNewAvatarMenuButton(); |
| 133 if (!button) | 133 if (!button) |
| 134 NOTREACHED() << "NewAvatarButton not found."; | 134 NOTREACHED() << "NewAvatarButton not found."; |
| 135 | 135 |
| 136 ProfileChooserView::close_on_deactivate_for_testing_ = false; | 136 ProfileChooserView::close_on_deactivate_for_testing_ = false; |
| 137 | 137 |
| 138 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 138 ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), |
| 139 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); | 139 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); |
| 140 button->OnMouseReleased(e); | 140 button->OnMousePressed(e); |
| 141 base::RunLoop().RunUntilIdle(); | 141 base::RunLoop().RunUntilIdle(); |
| 142 EXPECT_TRUE(ProfileChooserView::IsShowing()); | 142 EXPECT_TRUE(ProfileChooserView::IsShowing()); |
| 143 | 143 |
| 144 // Create this observer before lock is pressed to avoid a race condition. | 144 // Create this observer before lock is pressed to avoid a race condition. |
| 145 window_close_observer_.reset(new content::WindowedNotificationObserver( | 145 window_close_observer_.reset(new content::WindowedNotificationObserver( |
| 146 chrome::NOTIFICATION_BROWSER_CLOSED, | 146 chrome::NOTIFICATION_BROWSER_CLOSED, |
| 147 content::Source<Browser>(browser))); | 147 content::Source<Browser>(browser))); |
| 148 } | 148 } |
| 149 | 149 |
| 150 AvatarMenu* GetProfileChooserViewAvatarMenu() { | 150 AvatarMenu* GetProfileChooserViewAvatarMenu() { |
| 151 return ProfileChooserView::profile_bubble_->avatar_menu_.get(); | 151 return ProfileChooserView::profile_bubble_->avatar_menu_.get(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 void ClickProfileChooserViewLockButton() { | 154 void ClickProfileChooserViewLockButton() { |
| 155 ui::MouseEvent e(ui::ET_MOUSE_RELEASED, gfx::Point(), gfx::Point(), | 155 ui::MouseEvent e(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), |
| 156 ui::EventTimeForNow(), 0, 0); | 156 ui::EventTimeForNow(), 0, 0); |
| 157 ProfileChooserView::profile_bubble_->ButtonPressed( | 157 ProfileChooserView::profile_bubble_->ButtonPressed( |
| 158 ProfileChooserView::profile_bubble_->lock_button_, e); | 158 ProfileChooserView::profile_bubble_->lock_button_, e); |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Access the registry that has been prepared with at least one extension. | 161 // Access the registry that has been prepared with at least one extension. |
| 162 extensions::ExtensionRegistry* GetPreparedRegistry(Profile* signed_in) { | 162 extensions::ExtensionRegistry* GetPreparedRegistry(Profile* signed_in) { |
| 163 extensions::ExtensionRegistry* registry = | 163 extensions::ExtensionRegistry* registry = |
| 164 extensions::ExtensionRegistry::Get(signed_in); | 164 extensions::ExtensionRegistry::Get(signed_in); |
| 165 const size_t initial_num_extensions = registry->enabled_extensions().size(); | 165 const size_t initial_num_extensions = registry->enabled_extensions().size(); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 // Wait until the user manager is shown. | 334 // Wait until the user manager is shown. |
| 335 runner->Run(); | 335 runner->Run(); |
| 336 | 336 |
| 337 // Assert that the first profile's extensions are not blocked. | 337 // Assert that the first profile's extensions are not blocked. |
| 338 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); | 338 ASSERT_EQ(total_enabled_extensions, registry->enabled_extensions().size()); |
| 339 ASSERT_EQ(0U, registry->blocked_extensions().size()); | 339 ASSERT_EQ(0U, registry->blocked_extensions().size()); |
| 340 | 340 |
| 341 // We need to hide the User Manager or else the process can't die. | 341 // We need to hide the User Manager or else the process can't die. |
| 342 UserManager::Hide(); | 342 UserManager::Hide(); |
| 343 } | 343 } |
| OLD | NEW |