| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 // Check that the suggestion was filled. | 1823 // Check that the suggestion was filled. |
| 1824 std::string value; | 1824 std::string value; |
| 1825 ASSERT_TRUE(content::ExecuteScriptAndExtractString( | 1825 ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
| 1826 cross_frame, | 1826 cross_frame, |
| 1827 "window.domAutomationController.send(" | 1827 "window.domAutomationController.send(" |
| 1828 " document.getElementById('NAME_FIRST').value);", | 1828 " document.getElementById('NAME_FIRST').value);", |
| 1829 &value)); | 1829 &value)); |
| 1830 EXPECT_EQ("Milton", value); | 1830 EXPECT_EQ("Milton", value); |
| 1831 } | 1831 } |
| 1832 | 1832 |
| 1833 // This test verifies that credit card (payment card list) popup works when the |
| 1834 // form is inside an OOPIF. |
| 1835 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, CrossSitePaymentForms) { |
| 1836 // Ensure that |embedded_test_server()| serves both domains used below. |
| 1837 host_resolver()->AddRule("*", "127.0.0.1"); |
| 1838 |
| 1839 // Main frame is on a.com, iframe is on b.com. |
| 1840 GURL url = embedded_test_server()->GetURL( |
| 1841 "a.com", "/autofill/cross_origin_iframe.html"); |
| 1842 ui_test_utils::NavigateToURL(browser(), url); |
| 1843 GURL iframe_url = embedded_test_server()->GetURL( |
| 1844 "b.com", "/autofill/autofill_creditcard_form.html"); |
| 1845 EXPECT_TRUE( |
| 1846 content::NavigateIframeToURL(GetWebContents(), "crossFrame", iframe_url)); |
| 1847 |
| 1848 // Let |test_delegate()| also observe autofill events in the iframe. |
| 1849 content::RenderFrameHost* cross_frame = |
| 1850 RenderFrameHostForName(GetWebContents(), "crossFrame"); |
| 1851 ASSERT_TRUE(cross_frame); |
| 1852 ContentAutofillDriver* cross_driver = |
| 1853 ContentAutofillDriverFactory::FromWebContents(GetWebContents()) |
| 1854 ->DriverForFrame(cross_frame); |
| 1855 ASSERT_TRUE(cross_driver); |
| 1856 cross_driver->autofill_manager()->SetTestDelegate(test_delegate()); |
| 1857 |
| 1858 // Focus the form in the iframe and simulate choosing a suggestion via |
| 1859 // keyboard. |
| 1860 std::string script_focus( |
| 1861 "window.focus();" |
| 1862 "document.getElementById('CREDIT_CARD_NUMBER').focus();"); |
| 1863 ASSERT_TRUE(content::ExecuteScript(cross_frame, script_focus)); |
| 1864 |
| 1865 // Send an arrow dow keypress in order to trigger the autofill popup. |
| 1866 SendKeyToPageAndWait(ui::DomKey::ARROW_DOWN); |
| 1867 } |
| 1868 |
| 1833 } // namespace autofill | 1869 } // namespace autofill |
| OLD | NEW |