| 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 class AutofillInteractiveTest : public InProcessBrowserTest { | 195 class AutofillInteractiveTest : public InProcessBrowserTest { |
| 196 protected: | 196 protected: |
| 197 AutofillInteractiveTest() : | 197 AutofillInteractiveTest() : |
| 198 key_press_event_sink_( | 198 key_press_event_sink_( |
| 199 base::Bind(&AutofillInteractiveTest::HandleKeyPressEvent, | 199 base::Bind(&AutofillInteractiveTest::HandleKeyPressEvent, |
| 200 base::Unretained(this))) {} | 200 base::Unretained(this))) {} |
| 201 virtual ~AutofillInteractiveTest() {} | 201 virtual ~AutofillInteractiveTest() {} |
| 202 | 202 |
| 203 // InProcessBrowserTest: | 203 // InProcessBrowserTest: |
| 204 virtual void SetUpOnMainThread() OVERRIDE { | 204 virtual void SetUpOnMainThread() OVERRIDE { |
| 205 TranslateService::SetUseInfobar(true); | |
| 206 | |
| 207 // Don't want Keychain coming up on Mac. | 205 // Don't want Keychain coming up on Mac. |
| 208 test::DisableSystemServices(browser()->profile()->GetPrefs()); | 206 test::DisableSystemServices(browser()->profile()->GetPrefs()); |
| 209 | 207 |
| 210 // Inject the test delegate into the AutofillManager. | 208 // Inject the test delegate into the AutofillManager. |
| 211 content::WebContents* web_contents = GetWebContents(); | 209 content::WebContents* web_contents = GetWebContents(); |
| 212 ContentAutofillDriver* autofill_driver = | 210 ContentAutofillDriver* autofill_driver = |
| 213 ContentAutofillDriver::FromWebContents(web_contents); | 211 ContentAutofillDriver::FromWebContents(web_contents); |
| 214 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); | 212 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); |
| 215 autofill_manager->SetTestDelegate(&test_delegate_); | 213 autofill_manager->SetTestDelegate(&test_delegate_); |
| 216 } | 214 } |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 // Reload the page. | 919 // Reload the page. |
| 922 content::WebContents* web_contents = GetWebContents(); | 920 content::WebContents* web_contents = GetWebContents(); |
| 923 web_contents->GetController().Reload(false); | 921 web_contents->GetController().Reload(false); |
| 924 content::WaitForLoadStop(web_contents); | 922 content::WaitForLoadStop(web_contents); |
| 925 | 923 |
| 926 // Invoke Autofill. | 924 // Invoke Autofill. |
| 927 TryBasicFormFill(); | 925 TryBasicFormFill(); |
| 928 } | 926 } |
| 929 | 927 |
| 930 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, AutofillAfterTranslate) { | 928 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, AutofillAfterTranslate) { |
| 929 // This test only applies to the infobar translate UX, not the new bubble UX. |
| 930 if (TranslateService::IsTranslateBubbleEnabled()) |
| 931 return; |
| 932 |
| 931 CreateTestProfile(); | 933 CreateTestProfile(); |
| 932 | 934 |
| 933 GURL url(std::string(kDataURIPrefix) + | 935 GURL url(std::string(kDataURIPrefix) + |
| 934 "<form action=\"http://www.example.com/\" method=\"POST\">" | 936 "<form action=\"http://www.example.com/\" method=\"POST\">" |
| 935 "<label for=\"fn\">なまえ</label>" | 937 "<label for=\"fn\">なまえ</label>" |
| 936 " <input type=\"text\" id=\"fn\"" | 938 " <input type=\"text\" id=\"fn\"" |
| 937 " onfocus=\"domAutomationController.send(true)\"" | 939 " onfocus=\"domAutomationController.send(true)\"" |
| 938 "><br>" | 940 "><br>" |
| 939 "<label for=\"ln\">みょうじ</label>" | 941 "<label for=\"ln\">みょうじ</label>" |
| 940 " <input type=\"text\" id=\"ln\"><br>" | 942 " <input type=\"text\" id=\"ln\"><br>" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 ASSERT_TRUE(content::ExecuteScript( | 1231 ASSERT_TRUE(content::ExecuteScript( |
| 1230 GetRenderViewHost(), | 1232 GetRenderViewHost(), |
| 1231 "document.querySelector('input').autocomplete = 'off';")); | 1233 "document.querySelector('input').autocomplete = 'off';")); |
| 1232 | 1234 |
| 1233 // Press the down arrow to select the suggestion and attempt to preview the | 1235 // Press the down arrow to select the suggestion and attempt to preview the |
| 1234 // autofilled form. | 1236 // autofilled form. |
| 1235 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 1237 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
| 1236 } | 1238 } |
| 1237 | 1239 |
| 1238 } // namespace autofill | 1240 } // namespace autofill |
| OLD | NEW |