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

Side by Side Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 293093002: Don't show "Save password" prompt for a failed login (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/renderer/autofill/password_autofill_agent_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/metrics/histogram_samples.h" 8 #include "base/metrics/histogram_samples.h"
9 #include "base/metrics/statistics_recorder.h" 9 #include "base/metrics/statistics_recorder.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame)); 480 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame));
481 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); 481 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
482 observer.Wait(); 482 observer.Wait();
483 if (ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) { 483 if (ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) {
484 EXPECT_TRUE(controller()->PasswordPendingUserDecision()); 484 EXPECT_TRUE(controller()->PasswordPendingUserDecision());
485 } else { 485 } else {
486 EXPECT_TRUE(observer.infobar_shown()); 486 EXPECT_TRUE(observer.infobar_shown());
487 } 487 }
488 } 488 }
489 489
490 IN_PROC_BROWSER_TEST_F(
491 PasswordManagerBrowserTest,
492 NoPromptForFailedLoginFromMainFrameWithMultiFramesInPage) {
493 NavigateToFile("/password/multi_frames.html");
494
495 // Make sure that we don't prompt to save the password for a failed login
496 // from the main frame with multiple frames in the same page.
497 NavigationObserver observer(WebContents());
498 std::string fill_and_submit =
499 "document.getElementById('username_failed').value = 'temp';"
500 "document.getElementById('password_failed').value = 'random';"
501 "document.getElementById('submit_failed').click();";
502
503 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
504 observer.Wait();
505 EXPECT_FALSE(observer.infobar_shown());
506 }
507
508 IN_PROC_BROWSER_TEST_F(
509 PasswordManagerBrowserTest,
510 NoPromptForFailedLoginFromSubFrameWithMultiFramesInPage) {
511 NavigateToFile("/password/multi_frames.html");
512
513 // Make sure that we don't prompt to save the password for a failed login
514 // from a sub-frame with multiple frames in the same page.
515 NavigationObserver observer(WebContents());
516 std::string fill_and_submit =
517 "var first_frame = document.getElementById('first_frame');"
518 "var frame_doc = first_frame.contentDocument;"
519 "frame_doc.getElementById('username_failed').value = 'temp';"
520 "frame_doc.getElementById('password_failed').value = 'random';"
521 "frame_doc.getElementById('submit_failed').click();"
522 "window.parent.location.href = 'multi_frames.html';";
523
524 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
525 observer.Wait();
526 EXPECT_FALSE(observer.infobar_shown());
527 }
528
490 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, 529 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
491 PromptForXHRSubmit) { 530 PromptForXHRSubmit) {
492 #if defined(OS_WIN) && defined(USE_ASH) 531 #if defined(OS_WIN) && defined(USE_ASH)
493 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 532 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
494 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 533 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
495 return; 534 return;
496 #endif 535 #endif
497 NavigateToFile("/password/password_xhr_submit.html"); 536 NavigateToFile("/password/password_xhr_submit.html");
498 537
499 // Verify that we show the save password prompt if a form returns false 538 // Verify that we show the save password prompt if a form returns false
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
940 "document.getElementById('submit-button').click();"; 979 "document.getElementById('submit-button').click();";
941 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit)); 980 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit));
942 observer.Wait(); 981 observer.Wait();
943 982
944 if (ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) { 983 if (ChromePasswordManagerClient::IsTheHotNewBubbleUIEnabled()) {
945 EXPECT_TRUE(controller()->PasswordPendingUserDecision()); 984 EXPECT_TRUE(controller()->PasswordPendingUserDecision());
946 } else { 985 } else {
947 EXPECT_TRUE(observer.infobar_shown()); 986 EXPECT_TRUE(observer.infobar_shown());
948 } 987 }
949 } 988 }
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/autofill/password_autofill_agent_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698