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