Chromium Code Reviews| 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 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1838 NavigateToFile("/password/login_signup_form.html"); | 1838 NavigateToFile("/password/login_signup_form.html"); |
| 1839 | 1839 |
| 1840 // Let the user interact with the page, so that DOM gets modification events, | 1840 // Let the user interact with the page, so that DOM gets modification events, |
| 1841 // needed for autofilling fields. | 1841 // needed for autofilling fields. |
| 1842 content::SimulateMouseClickAt( | 1842 content::SimulateMouseClickAt( |
| 1843 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); | 1843 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); |
| 1844 | 1844 |
| 1845 // Wait until that interaction causes the password value to be revealed. | 1845 // Wait until that interaction causes the password value to be revealed. |
| 1846 WaitForElementValue("password", "mypassword"); | 1846 WaitForElementValue("password", "mypassword"); |
| 1847 } | 1847 } |
| 1848 | |
| 1849 // Check that we can fill in cases where <base href> is set and the action of | |
| 1850 // the form is empty. Regression test for https://crbug.com/360230. | |
|
engedy
2015/04/01 19:06:24
We should mention the form not having an action at
Garrett Casto
2015/04/01 23:59:29
Yeah, that wording is confusing. I meant the same
| |
| 1851 IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTest, BaseTagWithEmptyActionTest) { | |
| 1852 password_manager::TestPasswordStore* password_store = | |
| 1853 static_cast<password_manager::TestPasswordStore*>( | |
| 1854 PasswordStoreFactory::GetForProfile( | |
| 1855 browser()->profile(), ServiceAccessType::IMPLICIT_ACCESS).get()); | |
| 1856 | |
| 1857 EXPECT_TRUE(password_store->IsEmpty()); | |
| 1858 | |
| 1859 NavigateToFile("/password/password_xhr_submit.html"); | |
| 1860 | |
| 1861 NavigationObserver observer(WebContents()); | |
| 1862 scoped_ptr<PromptObserver> prompt_observer( | |
| 1863 PromptObserver::Create(WebContents())); | |
| 1864 std::string submit = | |
| 1865 "document.getElementById('username_field').value = 'myusername';" | |
| 1866 "document.getElementById('password_field').value = 'mypassword';" | |
| 1867 "document.getElementById('submit_button').click();"; | |
| 1868 ASSERT_TRUE(content::ExecuteScript(RenderViewHost(), submit)); | |
| 1869 observer.Wait(); | |
| 1870 | |
| 1871 prompt_observer->Accept(); | |
| 1872 | |
| 1873 // Spin the message loop to make sure the password store had a chance to save | |
| 1874 // the password. | |
| 1875 base::RunLoop run_loop; | |
|
engedy
2015/04/01 19:06:24
nit: Although the current solution is consistent w
Garrett Casto
2015/04/01 23:59:29
Sounds good.
| |
| 1876 run_loop.RunUntilIdle(); | |
| 1877 EXPECT_FALSE(password_store->IsEmpty()); | |
| 1878 | |
| 1879 NavigateToFile("/password/password_xhr_submit.html"); | |
| 1880 | |
| 1881 // Let the user interact with the page, so that DOM gets modification events, | |
| 1882 // needed for autofilling fields. | |
| 1883 content::SimulateMouseClickAt( | |
| 1884 WebContents(), 0, blink::WebMouseEvent::ButtonLeft, gfx::Point(1, 1)); | |
| 1885 | |
| 1886 // Wait until that interaction causes the password value to be revealed. | |
| 1887 WaitForElementValue("password_field", "mypassword"); | |
| 1888 } | |
| OLD | NEW |