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

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, 7 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
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 "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 "frame_doc.getElementById('password_field').value = 'random';" 370 "frame_doc.getElementById('password_field').value = 'random';"
371 "frame_doc.getElementById('input_submit_button').click();"; 371 "frame_doc.getElementById('input_submit_button').click();";
372 372
373 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame)); 373 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), navigate_frame));
374 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); 374 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
375 observer.Wait(); 375 observer.Wait();
376 EXPECT_TRUE(observer.infobar_shown()); 376 EXPECT_TRUE(observer.infobar_shown());
377 } 377 }
378 378
379 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, 379 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
380 NoPromptForFailedLoginWithIrrelevantFramePresent) {
381 NavigateToFile("/password/multi_frames.html");
382
383 // Verify that we do not show password prompt when login failed from one
vabr (Chromium) 2014/05/23 12:18:36 Sorry, I have troubles understanding the test from
384 // iframe with a different iframe being present in the same page.
385 NavigationObserver observer(WebContents());
386 std::string fill_and_submit =
387 "var first_frame = document.getElementById('first_frame');"
388 "var frame_doc = first_frame.contentDocument;"
389 "frame_doc.getElementById('username_failed').value = 'temp';"
390 "frame_doc.getElementById('password_failed').value = 'random';"
391 "frame_doc.getElementById('submit_failed').click();";
392 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
393 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(),
394 "window.location.href = 'failed.html';"));
vabr (Chromium) 2014/05/23 12:18:36 Why do you navigate the main frame to failed.html
395 observer.Wait();
396 EXPECT_FALSE(observer.infobar_shown());
397 }
398
399 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
380 PromptForXHRSubmit) { 400 PromptForXHRSubmit) {
381 #if defined(OS_WIN) && defined(USE_ASH) 401 #if defined(OS_WIN) && defined(USE_ASH)
382 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 402 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
383 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 403 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
384 return; 404 return;
385 #endif 405 #endif
386 NavigateToFile("/password/password_xhr_submit.html"); 406 NavigateToFile("/password/password_xhr_submit.html");
387 407
388 // Verify that we show the save password prompt if a form returns false 408 // Verify that we show the save password prompt if a form returns false
389 // in its onsubmit handler but instead logs in/navigates via XHR. 409 // in its onsubmit handler but instead logs in/navigates via XHR.
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill)); 767 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill));
748 768
749 NavigationObserver observer(WebContents()); 769 NavigationObserver observer(WebContents());
750 GURL url = embedded_test_server()->GetURL("/password/password_form.html"); 770 GURL url = embedded_test_server()->GetURL("/password/password_form.html");
751 chrome::NavigateParams params(browser(), url, 771 chrome::NavigateParams params(browser(), url,
752 content::PAGE_TRANSITION_RELOAD); 772 content::PAGE_TRANSITION_RELOAD);
753 ui_test_utils::NavigateToURL(&params); 773 ui_test_utils::NavigateToURL(&params);
754 observer.Wait(); 774 observer.Wait();
755 EXPECT_FALSE(observer.infobar_shown()); 775 EXPECT_FALSE(observer.infobar_shown());
756 } 776 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698