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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 // form. | 476 // form. |
477 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 477 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
478 | 478 |
479 // Press tab to accept the autofill suggestions. | 479 // Press tab to accept the autofill suggestions. |
480 SendKeyToPopupAndWait(ui::VKEY_TAB); | 480 SendKeyToPopupAndWait(ui::VKEY_TAB); |
481 | 481 |
482 // The form should be filled. | 482 // The form should be filled. |
483 ExpectFilledTestForm(); | 483 ExpectFilledTestForm(); |
484 } | 484 } |
485 | 485 |
| 486 // Test that a field is still autofillable after the previously autofilled |
| 487 // value is deleted. |
| 488 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, OnDeleteValueAfterAutofill) { |
| 489 CreateTestProfile(); |
| 490 |
| 491 // Load the test page. |
| 492 ASSERT_NO_FATAL_FAILURE(ui_test_utils::NavigateToURL(browser(), |
| 493 GURL(std::string(kDataURIPrefix) + kTestFormString))); |
| 494 |
| 495 // Invoke and accept the Autofill popup and verify the form was filled. |
| 496 FocusFirstNameField(); |
| 497 SendKeyToPageAndWait(ui::VKEY_M); |
| 498 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
| 499 SendKeyToPopupAndWait(ui::VKEY_RETURN); |
| 500 ExpectFilledTestForm(); |
| 501 |
| 502 // Delete the value of a filled field. |
| 503 ASSERT_TRUE(content::ExecuteScript( |
| 504 GetRenderViewHost(), |
| 505 "document.getElementById('firstname').value = '';")); |
| 506 ExpectFieldValue("firstname", ""); |
| 507 |
| 508 // Invoke and accept the Autofill popup and verify the field was filled. |
| 509 SendKeyToPageAndWait(ui::VKEY_M); |
| 510 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
| 511 SendKeyToPopupAndWait(ui::VKEY_RETURN); |
| 512 ExpectFieldValue("firstname", "Milton"); |
| 513 } |
| 514 |
486 // Test that a JavaScript oninput event is fired after auto-filling a form. | 515 // Test that a JavaScript oninput event is fired after auto-filling a form. |
487 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, OnInputAfterAutofill) { | 516 IN_PROC_BROWSER_TEST_F(AutofillInteractiveTest, OnInputAfterAutofill) { |
488 CreateTestProfile(); | 517 CreateTestProfile(); |
489 | 518 |
490 const char kOnInputScript[] = | 519 const char kOnInputScript[] = |
491 "<script>" | 520 "<script>" |
492 "focused_fired = false;" | 521 "focused_fired = false;" |
493 "unfocused_fired = false;" | 522 "unfocused_fired = false;" |
494 "changed_select_fired = false;" | 523 "changed_select_fired = false;" |
495 "unchanged_select_fired = false;" | 524 "unchanged_select_fired = false;" |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 ASSERT_TRUE(content::ExecuteScript( | 1260 ASSERT_TRUE(content::ExecuteScript( |
1232 GetRenderViewHost(), | 1261 GetRenderViewHost(), |
1233 "document.querySelector('input').autocomplete = 'off';")); | 1262 "document.querySelector('input').autocomplete = 'off';")); |
1234 | 1263 |
1235 // Press the down arrow to select the suggestion and attempt to preview the | 1264 // Press the down arrow to select the suggestion and attempt to preview the |
1236 // autofilled form. | 1265 // autofilled form. |
1237 SendKeyToPopupAndWait(ui::VKEY_DOWN); | 1266 SendKeyToPopupAndWait(ui::VKEY_DOWN); |
1238 } | 1267 } |
1239 | 1268 |
1240 } // namespace autofill | 1269 } // namespace autofill |
OLD | NEW |