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