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

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

Issue 733953002: Do not save passwords if the landing page has HTTP status 5xx or 4xx (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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 "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 PromptObserver::Create(WebContents())); 864 PromptObserver::Create(WebContents()));
865 std::string fill_and_submit = 865 std::string fill_and_submit =
866 "document.getElementById('username_field').value = 'temp';" 866 "document.getElementById('username_field').value = 'temp';"
867 "document.getElementById('password_field').value = 'random';" 867 "document.getElementById('password_field').value = 'random';"
868 "document.getElementById('input_submit_button').click();"; 868 "document.getElementById('input_submit_button').click();";
869 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); 869 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
870 observer.Wait(); 870 observer.Wait();
871 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); 871 EXPECT_FALSE(prompt_observer->IsShowingPrompt());
872 } 872 }
873 873
874 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest,
875 NoPromptForLandingPageWithHTTPErrorStatusCode) {
876 // Check that no prompt is shown for forms where the landing page has
877 // HTTP status 404.
878 NavigateToFile("/password/password_form.html");
879
880 NavigationObserver observer(WebContents());
881 scoped_ptr<PromptObserver> prompt_observer(
882 PromptObserver::Create(WebContents()));
883 std::string fill_and_submit =
884 "document.getElementById('username_field_http_error').value = 'temp';"
885 "document.getElementById('password_field_http_error').value = 'random';"
886 "document.getElementById('input_submit_button_http_error').click()";
887 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit));
888 observer.Wait();
889 EXPECT_FALSE(prompt_observer->IsShowingPrompt());
890 }
891
874 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DeleteFrameBeforeSubmit) { 892 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, DeleteFrameBeforeSubmit) {
875 NavigateToFile("/password/multi_frames.html"); 893 NavigateToFile("/password/multi_frames.html");
876 894
877 NavigationObserver observer(WebContents()); 895 NavigationObserver observer(WebContents());
878 // Make sure we save some password info from an iframe and then destroy it. 896 // Make sure we save some password info from an iframe and then destroy it.
879 std::string save_and_remove = 897 std::string save_and_remove =
880 "var first_frame = document.getElementById('first_frame');" 898 "var first_frame = document.getElementById('first_frame');"
881 "var frame_doc = first_frame.contentDocument;" 899 "var frame_doc = first_frame.contentDocument;"
882 "frame_doc.getElementById('username_field').value = 'temp';" 900 "frame_doc.getElementById('username_field').value = 'temp';"
883 "frame_doc.getElementById('password_field').value = 'random';" 901 "frame_doc.getElementById('password_field').value = 'random';"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 NavigateToFile("/password/form_with_only_password_field.html"); 1308 NavigateToFile("/password/form_with_only_password_field.html");
1291 1309
1292 // Let the user interact with the page, so that DOM gets modification events, 1310 // Let the user interact with the page, so that DOM gets modification events,
1293 // needed for autofilling fields. 1311 // needed for autofilling fields.
1294 content::SimulateMouseClickAt( 1312 content::SimulateMouseClickAt(
1295 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); 1313 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1));
1296 1314
1297 // Wait until that interaction causes the password value to be revealed. 1315 // Wait until that interaction causes the password value to be revealed.
1298 WaitForElementValue("password", "mypassword"); 1316 WaitForElementValue("password", "mypassword");
1299 } 1317 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698