Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(330)

Side by Side Diff: components/autofill/core/browser/autofill_manager_unittest.cc

Issue 133893004: Allow deleting autofill password suggestions on Shift+Delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "components/autofill/core/common/forms_seen_state.h" 43 #include "components/autofill/core/common/forms_seen_state.h"
44 #include "components/user_prefs/user_prefs.h" 44 #include "components/user_prefs/user_prefs.h"
45 #include "content/public/browser/web_contents.h" 45 #include "content/public/browser/web_contents.h"
46 #include "content/public/test/mock_render_process_host.h" 46 #include "content/public/test/mock_render_process_host.h"
47 #include "content/public/test/test_utils.h" 47 #include "content/public/test/test_utils.h"
48 #include "grit/component_strings.h" 48 #include "grit/component_strings.h"
49 #include "ipc/ipc_test_sink.h" 49 #include "ipc/ipc_test_sink.h"
50 #include "testing/gmock/include/gmock/gmock.h" 50 #include "testing/gmock/include/gmock/gmock.h"
51 #include "testing/gtest/include/gtest/gtest.h" 51 #include "testing/gtest/include/gtest/gtest.h"
52 #include "third_party/WebKit/public/web/WebAutofillClient.h" 52 #include "third_party/WebKit/public/web/WebAutofillClient.h"
53 #include "third_party/WebKit/public/web/WebFormControlElement.h"
53 #include "ui/base/l10n/l10n_util.h" 54 #include "ui/base/l10n/l10n_util.h"
54 #include "ui/gfx/rect.h" 55 #include "ui/gfx/rect.h"
55 #include "url/gurl.h" 56 #include "url/gurl.h"
56 57
57 using content::WebContents; 58 using content::WebContents;
58 using testing::_; 59 using testing::_;
59 using blink::WebFormElement; 60 using blink::WebFormElement;
60 61
61 namespace autofill { 62 namespace autofill {
62 63
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 AutofillManager* autofill_manager, 537 AutofillManager* autofill_manager,
537 AutofillDriver* autofill_driver) 538 AutofillDriver* autofill_driver)
538 : AutofillExternalDelegate(autofill_manager, autofill_driver), 539 : AutofillExternalDelegate(autofill_manager, autofill_driver),
539 on_query_seen_(false), 540 on_query_seen_(false),
540 on_suggestions_returned_seen_(false) {} 541 on_suggestions_returned_seen_(false) {}
541 virtual ~TestAutofillExternalDelegate() {} 542 virtual ~TestAutofillExternalDelegate() {}
542 543
543 virtual void OnQuery(int query_id, 544 virtual void OnQuery(int query_id,
544 const FormData& form, 545 const FormData& form,
545 const FormFieldData& field, 546 const FormFieldData& field,
547 const blink::WebFormElement& webformelement,
546 const gfx::RectF& bounds, 548 const gfx::RectF& bounds,
547 bool display_warning) OVERRIDE { 549 bool display_warning) OVERRIDE {
548 on_query_seen_ = true; 550 on_query_seen_ = true;
549 on_suggestions_returned_seen_ = false; 551 on_suggestions_returned_seen_ = false;
550 } 552 }
551 553
552 virtual void OnSuggestionsReturned( 554 virtual void OnSuggestionsReturned(
553 int query_id, 555 int query_id,
554 const std::vector<base::string16>& autofill_values, 556 const std::vector<base::string16>& autofill_values,
555 const std::vector<base::string16>& autofill_labels, 557 const std::vector<base::string16>& autofill_labels,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 ChromeRenderViewHostTestHarness::TearDown(); 654 ChromeRenderViewHostTestHarness::TearDown();
653 655
654 // Remove the AutofillWebDataService so TestPersonalDataManager does not 656 // Remove the AutofillWebDataService so TestPersonalDataManager does not
655 // need to care about removing self as an observer in destruction. 657 // need to care about removing self as an observer in destruction.
656 personal_data_.set_database(scoped_refptr<AutofillWebDataService>(NULL)); 658 personal_data_.set_database(scoped_refptr<AutofillWebDataService>(NULL));
657 } 659 }
658 660
659 void GetAutofillSuggestions(int query_id, 661 void GetAutofillSuggestions(int query_id,
660 const FormData& form, 662 const FormData& form,
661 const FormFieldData& field) { 663 const FormFieldData& field) {
664 blink::WebFormElement webformelement;
662 autofill_manager_->OnQueryFormFieldAutofill(query_id, 665 autofill_manager_->OnQueryFormFieldAutofill(query_id,
663 form, 666 form,
664 field, 667 field,
668 webformelement,
665 gfx::Rect(), 669 gfx::Rect(),
666 false); 670 false);
667 } 671 }
668 672
669 void GetAutofillSuggestions(const FormData& form, 673 void GetAutofillSuggestions(const FormData& form,
670 const FormFieldData& field) { 674 const FormFieldData& field) {
671 GetAutofillSuggestions(kDefaultPageID, form, field); 675 GetAutofillSuggestions(kDefaultPageID, form, field);
672 } 676 }
673 677
674 void AutocompleteSuggestionsReturned( 678 void AutocompleteSuggestionsReturned(
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 test::CreateTestAddressFormData(&form); 2927 test::CreateTestAddressFormData(&form);
2924 std::vector<FormData> forms(1, form); 2928 std::vector<FormData> forms(1, form);
2925 FormsSeen(forms); 2929 FormsSeen(forms);
2926 const FormFieldData& field = form.fields[0]; 2930 const FormFieldData& field = form.fields[0];
2927 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2931 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2928 2932
2929 EXPECT_TRUE(external_delegate_->on_query_seen()); 2933 EXPECT_TRUE(external_delegate_->on_query_seen());
2930 } 2934 }
2931 2935
2932 } // namespace autofill 2936 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698