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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); | 247 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); |
248 autofill_manager->SetTestDelegate(&test_delegate_); | 248 autofill_manager->SetTestDelegate(&test_delegate_); |
249 | 249 |
250 // If the mouse happened to be over where the suggestions are shown, then | 250 // If the mouse happened to be over where the suggestions are shown, then |
251 // the preview will show up and will fail the tests. We need to give it a | 251 // the preview will show up and will fail the tests. We need to give it a |
252 // point that's within the browser frame, or else the method hangs. | 252 // point that's within the browser frame, or else the method hangs. |
253 gfx::Point reset_mouse(GetWebContents()->GetContainerBounds().origin()); | 253 gfx::Point reset_mouse(GetWebContents()->GetContainerBounds().origin()); |
254 reset_mouse = gfx::Point(reset_mouse.x() + 5, reset_mouse.y() + 5); | 254 reset_mouse = gfx::Point(reset_mouse.x() + 5, reset_mouse.y() + 5); |
255 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(reset_mouse)); | 255 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(reset_mouse)); |
256 | 256 |
| 257 // Ensure that |embedded_test_server()| serves both domains used below. |
| 258 host_resolver()->AddRule("*", "127.0.0.1"); |
257 ASSERT_TRUE(embedded_test_server()->Start()); | 259 ASSERT_TRUE(embedded_test_server()->Start()); |
258 InProcessBrowserTest::SetUpOnMainThread(); | |
259 } | 260 } |
260 | 261 |
261 void TearDownOnMainThread() override { | 262 void TearDownOnMainThread() override { |
262 // Make sure to close any showing popups prior to tearing down the UI. | 263 // Make sure to close any showing popups prior to tearing down the UI. |
263 content::WebContents* web_contents = GetWebContents(); | 264 content::WebContents* web_contents = GetWebContents(); |
264 AutofillManager* autofill_manager = | 265 AutofillManager* autofill_manager = |
265 ContentAutofillDriverFactory::FromWebContents(web_contents) | 266 ContentAutofillDriverFactory::FromWebContents(web_contents) |
266 ->DriverForFrame(web_contents->GetMainFrame()) | 267 ->DriverForFrame(web_contents->GetMainFrame()) |
267 ->autofill_manager(); | 268 ->autofill_manager(); |
268 autofill_manager->client()->HideAutofillPopup(); | 269 autofill_manager->client()->HideAutofillPopup(); |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1779 }; | 1780 }; |
1780 | 1781 |
1781 #if defined(OS_WIN) | 1782 #if defined(OS_WIN) |
1782 // Flaky on Windows 7 in debug build. http://crbug.com/710436 | 1783 // Flaky on Windows 7 in debug build. http://crbug.com/710436 |
1783 #define MAYBE_SimpleCrossSiteFill DISABLED_SimpleCrossSiteFill | 1784 #define MAYBE_SimpleCrossSiteFill DISABLED_SimpleCrossSiteFill |
1784 #else | 1785 #else |
1785 #define MAYBE_SimpleCrossSiteFill SimpleCrossSiteFill | 1786 #define MAYBE_SimpleCrossSiteFill SimpleCrossSiteFill |
1786 #endif | 1787 #endif |
1787 IN_PROC_BROWSER_TEST_F(AutofillInteractiveIsolationTest, | 1788 IN_PROC_BROWSER_TEST_F(AutofillInteractiveIsolationTest, |
1788 MAYBE_SimpleCrossSiteFill) { | 1789 MAYBE_SimpleCrossSiteFill) { |
1789 // Ensure that |embedded_test_server()| serves both domains used below. | |
1790 host_resolver()->AddRule("*", "127.0.0.1"); | |
1791 | 1790 |
1792 CreateTestProfile(); | 1791 CreateTestProfile(); |
1793 | 1792 |
1794 // Main frame is on a.com, iframe is on b.com. | 1793 // Main frame is on a.com, iframe is on b.com. |
1795 GURL url = embedded_test_server()->GetURL( | 1794 GURL url = embedded_test_server()->GetURL( |
1796 "a.com", "/autofill/cross_origin_iframe.html"); | 1795 "a.com", "/autofill/cross_origin_iframe.html"); |
1797 ui_test_utils::NavigateToURL(browser(), url); | 1796 ui_test_utils::NavigateToURL(browser(), url); |
1798 GURL iframe_url = embedded_test_server()->GetURL( | 1797 GURL iframe_url = embedded_test_server()->GetURL( |
1799 "b.com", "/autofill/autofill_test_form.html"); | 1798 "b.com", "/autofill/autofill_test_form.html"); |
1800 EXPECT_TRUE( | 1799 EXPECT_TRUE( |
(...skipping 25 matching lines...) Expand all Loading... |
1826 cross_frame, | 1825 cross_frame, |
1827 "window.domAutomationController.send(" | 1826 "window.domAutomationController.send(" |
1828 " document.getElementById('NAME_FIRST').value);", | 1827 " document.getElementById('NAME_FIRST').value);", |
1829 &value)); | 1828 &value)); |
1830 EXPECT_EQ("Milton", value); | 1829 EXPECT_EQ("Milton", value); |
1831 } | 1830 } |
1832 | 1831 |
1833 // This test verifies that credit card (payment card list) popup works when the | 1832 // This test verifies that credit card (payment card list) popup works when the |
1834 // form is inside an OOPIF. | 1833 // form is inside an OOPIF. |
1835 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, CrossSitePaymentForms) { | 1834 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 | 1835 |
1839 // Main frame is on a.com, iframe is on b.com. | 1836 // Main frame is on a.com, iframe is on b.com. |
1840 GURL url = embedded_test_server()->GetURL( | 1837 GURL url = embedded_test_server()->GetURL( |
1841 "a.com", "/autofill/cross_origin_iframe.html"); | 1838 "a.com", "/autofill/cross_origin_iframe.html"); |
1842 ui_test_utils::NavigateToURL(browser(), url); | 1839 ui_test_utils::NavigateToURL(browser(), url); |
1843 GURL iframe_url = embedded_test_server()->GetURL( | 1840 GURL iframe_url = embedded_test_server()->GetURL( |
1844 "b.com", "/autofill/autofill_creditcard_form.html"); | 1841 "b.com", "/autofill/autofill_creditcard_form.html"); |
1845 EXPECT_TRUE( | 1842 EXPECT_TRUE( |
1846 content::NavigateIframeToURL(GetWebContents(), "crossFrame", iframe_url)); | 1843 content::NavigateIframeToURL(GetWebContents(), "crossFrame", iframe_url)); |
1847 | 1844 |
(...skipping 12 matching lines...) Expand all Loading... |
1860 std::string script_focus( | 1857 std::string script_focus( |
1861 "window.focus();" | 1858 "window.focus();" |
1862 "document.getElementById('CREDIT_CARD_NUMBER').focus();"); | 1859 "document.getElementById('CREDIT_CARD_NUMBER').focus();"); |
1863 ASSERT_TRUE(content::ExecuteScript(cross_frame, script_focus)); | 1860 ASSERT_TRUE(content::ExecuteScript(cross_frame, script_focus)); |
1864 | 1861 |
1865 // Send an arrow dow keypress in order to trigger the autofill popup. | 1862 // Send an arrow dow keypress in order to trigger the autofill popup. |
1866 SendKeyToPageAndWait(ui::DomKey::ARROW_DOWN); | 1863 SendKeyToPageAndWait(ui::DomKey::ARROW_DOWN); |
1867 } | 1864 } |
1868 | 1865 |
1869 } // namespace autofill | 1866 } // namespace autofill |
OLD | NEW |