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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/rand_util.h" | 12 #include "base/rand_util.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_split.h" | 15 #include "base/strings/string_split.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 19 #include "chrome/browser/chrome_notification_types.h" |
20 #include "chrome/browser/infobars/infobar_service.h" | 20 #include "chrome/browser/infobars/infobar_service.h" |
21 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
22 #include "chrome/browser/translate/chrome_translate_client.h" | 22 #include "chrome/browser/translate/chrome_translate_client.h" |
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/test_switches.h" | 30 #include "chrome/test/base/test_switches.h" |
30 #include "chrome/test/base/ui_test_utils.h" | 31 #include "chrome/test/base/ui_test_utils.h" |
31 #include "components/autofill/content/browser/content_autofill_driver.h" | 32 #include "components/autofill/content/browser/content_autofill_driver.h" |
32 #include "components/autofill/core/browser/autofill_manager.h" | 33 #include "components/autofill/core/browser/autofill_manager.h" |
33 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" | 34 #include "components/autofill/core/browser/autofill_manager_test_delegate.h" |
34 #include "components/autofill/core/browser/autofill_profile.h" | 35 #include "components/autofill/core/browser/autofill_profile.h" |
35 #include "components/autofill/core/browser/autofill_test_utils.h" | 36 #include "components/autofill/core/browser/autofill_test_utils.h" |
36 #include "components/autofill/core/browser/personal_data_manager.h" | 37 #include "components/autofill/core/browser/personal_data_manager.h" |
37 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 38 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
38 #include "components/autofill/core/browser/validation.h" | 39 #include "components/autofill/core/browser/validation.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 virtual void SetUpOnMainThread() OVERRIDE { | 208 virtual void SetUpOnMainThread() OVERRIDE { |
208 // Don't want Keychain coming up on Mac. | 209 // Don't want Keychain coming up on Mac. |
209 test::DisableSystemServices(browser()->profile()->GetPrefs()); | 210 test::DisableSystemServices(browser()->profile()->GetPrefs()); |
210 | 211 |
211 // Inject the test delegate into the AutofillManager. | 212 // Inject the test delegate into the AutofillManager. |
212 content::WebContents* web_contents = GetWebContents(); | 213 content::WebContents* web_contents = GetWebContents(); |
213 ContentAutofillDriver* autofill_driver = | 214 ContentAutofillDriver* autofill_driver = |
214 ContentAutofillDriver::FromWebContents(web_contents); | 215 ContentAutofillDriver::FromWebContents(web_contents); |
215 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); | 216 AutofillManager* autofill_manager = autofill_driver->autofill_manager(); |
216 autofill_manager->SetTestDelegate(&test_delegate_); | 217 autofill_manager->SetTestDelegate(&test_delegate_); |
| 218 |
| 219 // If the mouse happened to be over where the suggestions are shown, then |
| 220 // the preview will show up and will fail the tests. We need to give it a |
| 221 // point that's within the browser frame, or else the method hangs. |
| 222 gfx::Point reset_mouse(GetWebContents()->GetContainerBounds().origin()); |
| 223 reset_mouse = gfx::Point(reset_mouse.x() + 5, reset_mouse.y() + 5); |
| 224 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync(reset_mouse)); |
217 } | 225 } |
218 | 226 |
219 virtual void TearDownOnMainThread() OVERRIDE { | 227 virtual void TearDownOnMainThread() OVERRIDE { |
220 // 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. |
221 content::WebContents* web_contents = GetWebContents(); | 229 content::WebContents* web_contents = GetWebContents(); |
222 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents( | 230 AutofillManager* autofill_manager = ContentAutofillDriver::FromWebContents( |
223 web_contents)->autofill_manager(); | 231 web_contents)->autofill_manager(); |
224 autofill_manager->client()->HideAutofillPopup(); | 232 autofill_manager->client()->HideAutofillPopup(); |
225 } | 233 } |
226 | 234 |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 ASSERT_TRUE(content::ExecuteScript( | 1388 ASSERT_TRUE(content::ExecuteScript( |
1381 GetRenderViewHost(), | 1389 GetRenderViewHost(), |
1382 "document.querySelector('input').autocomplete = 'off';")); | 1390 "document.querySelector('input').autocomplete = 'off';")); |
1383 | 1391 |
1384 // Press the down arrow to select the suggestion and attempt to preview the | 1392 // Press the down arrow to select the suggestion and attempt to preview the |
1385 // autofilled form. | 1393 // autofilled form. |
1386 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 1394 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
1387 } | 1395 } |
1388 | 1396 |
1389 } // namespace autofill | 1397 } // namespace autofill |
OLD | NEW |