Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7793)

Unified Diff: chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc

Issue 1212403004: Make sure content area is focused when signin-view bubble is opened. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compare strings by direct pointer comparison. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..22ec640e2c9d9449ec6fe870128824935e71355b 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,21 @@ 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 (current->GetClassName() == views::WebView::kViewClassName)
+ 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 +164,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());
« no previous file with comments | « chrome/browser/ui/views/profiles/profile_chooser_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698