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/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/translate/translate_service.h" | 23 #include "chrome/browser/translate/translate_service.h" |
24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
25 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
27 #include "chrome/common/render_messages.h" | 27 #include "chrome/common/render_messages.h" |
28 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
29 #include "chrome/test/base/interactive_test_utils.h" | 29 #include "chrome/test/base/interactive_test_utils.h" |
30 #include "chrome/test/base/test_switches.h" | 30 #include "chrome/test/base/test_switches.h" |
31 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
32 #include "components/autofill/content/browser/content_autofill_driver.h" | 32 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 33 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
33 #include "components/autofill/core/browser/autofill_manager.h" | 34 #include "components/autofill/core/browser/autofill_manager.h" |
34 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" | 35 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" |
35 #include "components/autofill/core/browser/autofill_profile.h" | 36 #include "components/autofill/core/browser/autofill_profile.h" |
36 #include "components/autofill/core/browser/autofill_test_utils.h" | 37 #include "components/autofill/core/browser/autofill_test_utils.h" |
37 #include "components/autofill/core/browser/personal_data_manager.h" | 38 #include "components/autofill/core/browser/personal_data_manager.h" |
38 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 39 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
39 #include "components/autofill/core/browser/validation.h" | 40 #include "components/autofill/core/browser/validation.h" |
40 #include "components/infobars/core/confirm_infobar_delegate.h" | 41 #include "components/infobars/core/confirm_infobar_delegate.h" |
41 #include "components/infobars/core/infobar.h" | 42 #include "components/infobars/core/infobar.h" |
42 #include "components/infobars/core/infobar_manager.h" | 43 #include "components/infobars/core/infobar_manager.h" |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 ~AutofillInteractiveTest() override {} | 204 ~AutofillInteractiveTest() override {} |
204 | 205 |
205 // InProcessBrowserTest: | 206 // InProcessBrowserTest: |
206 void SetUpOnMainThread() override { | 207 void SetUpOnMainThread() override { |
207 // Don't want Keychain coming up on Mac. | 208 // Don't want Keychain coming up on Mac. |
208 test::DisableSystemServices(browser()->profile()->GetPrefs()); | 209 test::DisableSystemServices(browser()->profile()->GetPrefs()); |
209 | 210 |
210 // Inject the test delegate into the AutofillManager. | 211 // Inject the test delegate into the AutofillManager. |
211 content::WebContents* web_contents = GetWebContents(); | 212 content::WebContents* web_contents = GetWebContents(); |
212 ContentAutofillDriver* autofill_driver = | 213 ContentAutofillDriver* autofill_driver = |
213 ContentAutofillDriver::FromWebContents(web_contents); | 214 ContentAutofillDriverFactory::FromWebContents(web_contents) |
| 215 ->DriverForFrame(web_contents->GetMainFrame()); |
214 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); | 216 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); |
215 autofill_manager->SetTestDelegate(&test_delegate_); | 217 autofill_manager->SetTestDelegate(&test_delegate_); |
216 | 218 |
217 // If the mouse happened to be over where the suggestions are shown, then | 219 // If the mouse happened to be over where the suggestions are shown, then |
218 // the preview will show up and will fail the tests. We need to give it a | 220 // the preview will show up and will fail the tests. We need to give it a |
219 // point that's within the browser frame, or else the method hangs. | 221 // point that's within the browser frame, or else the method hangs. |
220 gfx::Point reset_mouse(GetWebContents()->GetContainerBounds().origin()); | 222 gfx::Point reset_mouse(GetWebContents()->GetContainerBounds().origin()); |
221 reset_mouse = gfx::Point(reset_mouse.x() + 5, reset_mouse.y() + 5); | 223 reset_mouse = gfx::Point(reset_mouse.x() + 5, reset_mouse.y() + 5); |
222 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(reset_mouse)); | 224 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(reset_mouse)); |
223 } | 225 } |
224 | 226 |
225 void TearDownOnMainThread() override { | 227 void TearDownOnMainThread() override { |
226 // Make sure to close any showing popups prior to tearing down the UI. | 228 // Make sure to close any showing popups prior to tearing down the UI. |
227 content::WebContents* web_contents = GetWebContents(); | 229 content::WebContents* web_contents = GetWebContents(); |
228 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents( | 230 AutofillManager* autofill_manager = |
229 web_contents)->autofill_manager(); | 231 ContentAutofillDriverFactory::FromWebContents(web_contents) |
| 232 ->DriverForFrame(web_contents->GetMainFrame()) |
| 233 ->autofill_manager(); |
230 autofill_manager->client()->HideAutofillPopup(); | 234 autofill_manager->client()->HideAutofillPopup(); |
231 } | 235 } |
232 | 236 |
233 PersonalDataManager* GetPersonalDataManager() { | 237 PersonalDataManager* GetPersonalDataManager() { |
234 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); | 238 return PersonalDataManagerFactory::GetForProfile(browser()->profile()); |
235 } | 239 } |
236 | 240 |
237 content::WebContents* GetWebContents() { | 241 content::WebContents* GetWebContents() { |
238 return browser()->tab_strip_model()->GetActiveWebContents(); | 242 return browser()->tab_strip_model()->GetActiveWebContents(); |
239 } | 243 } |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1447 ASSERT_TRUE(content::ExecuteScript( | 1451 ASSERT_TRUE(content::ExecuteScript( |
1448 GetRenderViewHost(), | 1452 GetRenderViewHost(), |
1449 "document.querySelector('input').autocomplete = 'off';")); | 1453 "document.querySelector('input').autocomplete = 'off';")); |
1450 | 1454 |
1451 // Press the down arrow to select the suggestion and attempt to preview the | 1455 // Press the down arrow to select the suggestion and attempt to preview the |
1452 // autofilled form. | 1456 // autofilled form. |
1453 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 1457 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
1454 } | 1458 } |
1455 | 1459 |
1456 } // namespace autofill | 1460 } // namespace autofill |
OLD | NEW |