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

Unified Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc

Issue 1016003002: Show the password bubble even if the browser window has no focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed the comments from sky@ Created 5 years, 9 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/passwords/manage_passwords_bubble_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/passwords/manage_passwords_bubble_view_browsertest.cc
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
index a7e80b3d0faed6ab49ab4df88e60aa4adc5a2e7d..049b679f44007a129d99f3f963c882fe794e2ca9 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
@@ -296,6 +296,26 @@ IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, ChooseCredential) {
ManagePasswordsBubbleView::CloseBubble();
}
+IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, ChooseCredentialNoFocus) {
+ GURL origin("https://example.com");
+ ScopedVector<autofill::PasswordForm> local_credentials;
+ test_form()->origin = origin;
+ test_form()->display_name = base::ASCIIToUTF16("Peter");
+ test_form()->username_value = base::ASCIIToUTF16("pet12@gmail.com");
+ local_credentials.push_back(new autofill::PasswordForm(*test_form()));
+ ScopedVector<autofill::PasswordForm> federated_credentials;
+
+ // Open another window with focus.
+ Browser* focused_window = CreateBrowser(browser()->profile());
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(focused_window));
+ content::RunAllPendingInMessageLoop();
+
+ EXPECT_FALSE(browser()->window()->IsActive());
+ SetupChooseCredentials(local_credentials.Pass(), federated_credentials.Pass(),
+ origin);
+ EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
+}
+
IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, AutoSignin) {
// The switch enables the new UI.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
@@ -334,3 +354,29 @@ IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, AutoSignin) {
ManagePasswordsBubble::USER_ACTION);
EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
}
+
+IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, AutoSigninNoFocus) {
+ ScopedVector<autofill::PasswordForm> local_credentials;
+ test_form()->origin = GURL("https://example.com");;
+ test_form()->display_name = base::ASCIIToUTF16("Peter");
+ test_form()->username_value = base::ASCIIToUTF16("pet12@gmail.com");
+ local_credentials.push_back(new autofill::PasswordForm(*test_form()));
+
+ // Open another window with focus.
+ Browser* focused_window = CreateBrowser(browser()->profile());
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(focused_window));
+ content::RunAllPendingInMessageLoop();
+
+ EXPECT_FALSE(browser()->window()->IsActive());
+ ManagePasswordsBubbleView::set_auto_signin_toast_timeout(0);
+ SetupAutoSignin(local_credentials.Pass());
+ content::RunAllPendingInMessageLoop();
+ EXPECT_TRUE(ManagePasswordsBubbleView::IsShowing());
+
+ // Bring the first window back. The toast closes by timeout.
+ focused_window->window()->Close();
+ browser()->window()->Activate();
+ content::RunAllPendingInMessageLoop();
+ EXPECT_TRUE(browser()->window()->IsActive());
+ EXPECT_FALSE(ManagePasswordsBubbleView::IsShowing());
+}
« no previous file with comments | « chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698