Chromium Code Reviews| Index: chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc |
| diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc |
| index baf77e464a363b98007cd15762b9b3e08a82fd7e..2d6448017a54deda49e1654a9b7909abdcba9918 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc |
| @@ -69,6 +69,23 @@ void SetupProfilesForLock(Profile* signed_in) { |
| EXPECT_TRUE(profiles::IsLockAvailable(signed_in)); |
| } |
| +views::View* FindWebView(views::View* view) { |
| + std::queue<views::View*> queue; |
| + queue.push(view); |
| + while (!queue.empty()) { |
| + views::View* current = queue.front(); |
| + queue.pop(); |
| + if (std::string(current->GetClassName()).find("WebView") != |
|
Nico
2015/07/02 20:07:22
Can you introduce WebView::kViewClassName and comp
wjmaclean
2015/07/02 20:47:18
Done.
|
| + std::string::npos) { |
| + return current; |
| + } |
| + |
| + for (int i = 0; i < current->child_count(); ++i) |
| + queue.push(current->child_at(i)); |
| + } |
| + return nullptr; |
| +} |
| + |
| } // namespace |
| class ProfileChooserViewExtensionsTest : public ExtensionBrowserTest { |
| @@ -148,12 +165,39 @@ class ProfileChooserViewExtensionsTest : public ExtensionBrowserTest { |
| return window_close_observer_.get(); |
| } |
| + ProfileChooserView* current_profile_bubble() { |
| + return ProfileChooserView::profile_bubble_; |
| + } |
| + |
| + void ShowSigninView() { |
| + DCHECK(current_profile_bubble()); |
| + DCHECK(current_profile_bubble()->avatar_menu_); |
| + current_profile_bubble()->ShowView( |
| + profiles::BUBBLE_VIEW_MODE_GAIA_SIGNIN, |
| + current_profile_bubble()->avatar_menu_.get()); |
| + base::MessageLoop::current()->RunUntilIdle(); |
| + } |
| + |
| private: |
| scoped_ptr<content::WindowedNotificationObserver> window_close_observer_; |
| DISALLOW_COPY_AND_ASSIGN(ProfileChooserViewExtensionsTest); |
| }; |
| +// crbug.com/502370 |
| +IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest, ContentAreaHasFocus) { |
| + ASSERT_TRUE(profiles::IsMultipleProfilesEnabled()); |
| + |
| + ASSERT_NO_FATAL_FAILURE(OpenProfileChooserView(browser())); |
| + |
| + ShowSigninView(); |
| + |
| + ASSERT_TRUE(current_profile_bubble()); |
| + views::View* web_view = FindWebView(current_profile_bubble()); |
| + ASSERT_TRUE(web_view); |
| + EXPECT_TRUE(web_view->HasFocus()); |
| +} |
| + |
| IN_PROC_BROWSER_TEST_F(ProfileChooserViewExtensionsTest, ViewProfileUMA) { |
| ASSERT_TRUE(profiles::IsMultipleProfilesEnabled()); |