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..e042e51b56c7c55ac07edb244ad2e55a15d3812d 100644 |
| --- a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc |
| +++ b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc |
| @@ -28,6 +28,7 @@ |
| #include "content/public/test/test_utils.h" |
| #include "extensions/browser/extension_registry.h" |
| #include "ui/events/event_utils.h" |
| +#include "ui/views/controls/webview/webview.h" |
| // ChromeOS and mobile platforms don't have a ProfileChooserView. |
| #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS) |
| @@ -69,6 +70,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(views::WebView::kViewClassName) != std::string::npos) { |
|
Nico
2015/07/02 20:54:57
You can just compare with == now, right?
if (cu
wjmaclean
2015/07/03 00:56:37
Done.
But I'm generally loathe to compare strings
Nico
2015/07/03 01:00:23
Thanks!
|
| + 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 +166,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()); |