OLD | NEW |
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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 // Make sure that we don't prompt to save the password for a failed login | 663 // Make sure that we don't prompt to save the password for a failed login |
664 // from a sub-frame with multiple frames in the same page. | 664 // from a sub-frame with multiple frames in the same page. |
665 NavigationObserver observer(WebContents()); | 665 NavigationObserver observer(WebContents()); |
666 scoped_ptr<PromptObserver> prompt_observer( | 666 scoped_ptr<PromptObserver> prompt_observer( |
667 PromptObserver::Create(WebContents())); | 667 PromptObserver::Create(WebContents())); |
668 std::string fill_and_submit = | 668 std::string fill_and_submit = |
669 "var first_frame = document.getElementById('first_frame');" | 669 "var first_frame = document.getElementById('first_frame');" |
670 "var frame_doc = first_frame.contentDocument;" | 670 "var frame_doc = first_frame.contentDocument;" |
671 "frame_doc.getElementById('username_failed').value = 'temp';" | 671 "frame_doc.getElementById('username_failed').value = 'temp';" |
672 "frame_doc.getElementById('password_failed').value = 'random';" | 672 "frame_doc.getElementById('password_failed').value = 'random';" |
673 "frame_doc.getElementById('submit_failed').click();" | 673 "frame_doc.getElementById('submit_failed').click();"; |
674 "window.parent.location.href = 'multi_frames.html';"; | |
675 | 674 |
676 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); | 675 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), fill_and_submit)); |
| 676 observer.SetPathToWaitFor("/password/failed.html"); |
677 observer.Wait(); | 677 observer.Wait(); |
678 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); | 678 EXPECT_FALSE(prompt_observer->IsShowingPrompt()); |
679 } | 679 } |
680 | 680 |
681 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForXHRSubmit) { | 681 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, PromptForXHRSubmit) { |
682 #if defined(OS_WIN) && defined(USE_ASH) | 682 #if defined(OS_WIN) && defined(USE_ASH) |
683 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 683 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
684 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 684 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
685 switches::kAshBrowserTests)) | 685 switches::kAshBrowserTests)) |
686 return; | 686 return; |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 NavigateToFile("/password/password_xhr_submit.html"); | 1879 NavigateToFile("/password/password_xhr_submit.html"); |
1880 | 1880 |
1881 // Let the user interact with the page, so that DOM gets modification events, | 1881 // Let the user interact with the page, so that DOM gets modification events, |
1882 // needed for autofilling fields. | 1882 // needed for autofilling fields. |
1883 content::SimulateMouseClickAt( | 1883 content::SimulateMouseClickAt( |
1884 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); | 1884 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); |
1885 | 1885 |
1886 // Wait until that interaction causes the password value to be revealed. | 1886 // Wait until that interaction causes the password value to be revealed. |
1887 WaitForElementValue("password_field", "mypassword"); | 1887 WaitForElementValue("password_field", "mypassword"); |
1888 } | 1888 } |
OLD | NEW |