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

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

Issue 229723002: Better error reasons for rAc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: woopsies Created 6 years, 8 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 | Annotate | Revision Log
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/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 2839 matching lines...) Expand 10 before | Expand all | Expand 10 after
2850 2850
2851 class MockAutofillManagerDelegate : public TestAutofillManagerDelegate { 2851 class MockAutofillManagerDelegate : public TestAutofillManagerDelegate {
2852 public: 2852 public:
2853 MockAutofillManagerDelegate() {} 2853 MockAutofillManagerDelegate() {}
2854 2854
2855 virtual ~MockAutofillManagerDelegate() {} 2855 virtual ~MockAutofillManagerDelegate() {}
2856 2856
2857 virtual void ShowRequestAutocompleteDialog( 2857 virtual void ShowRequestAutocompleteDialog(
2858 const FormData& form, 2858 const FormData& form,
2859 const GURL& source_url, 2859 const GURL& source_url,
2860 const base::Callback<void(const FormStructure*)>& callback) OVERRIDE { 2860 const ResultCallback& callback) OVERRIDE {
2861 callback.Run(user_supplied_data_.get()); 2861 callback.Run(user_supplied_data_ ? AutocompleteResultSuccess :
blundell 2014/04/10 08:03:40 These need to be prefixed by AutofillManagerDelega
Evan Stade 2014/04/10 16:38:58 No, because |this| inherits from AutofillManagerDe
2862 AutocompleteResultErrorDisabled,
2863 user_supplied_data_.get());
2862 } 2864 }
2863 2865
2864 void SetUserSuppliedData(scoped_ptr<FormStructure> user_supplied_data) { 2866 void SetUserSuppliedData(scoped_ptr<FormStructure> user_supplied_data) {
2865 user_supplied_data_.reset(user_supplied_data.release()); 2867 user_supplied_data_.reset(user_supplied_data.release());
2866 } 2868 }
2867 2869
2868 private: 2870 private:
2869 scoped_ptr<FormStructure> user_supplied_data_; 2871 scoped_ptr<FormStructure> user_supplied_data_;
2870 2872
2871 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate); 2873 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate);
2872 }; 2874 };
2873 2875
2874 } // namespace 2876 } // namespace
2875 2877
2876 // Test our external delegate is called at the right time. 2878 // Test our external delegate is called at the right time.
2877 TEST_F(AutofillManagerTest, TestExternalDelegate) { 2879 TEST_F(AutofillManagerTest, TestExternalDelegate) {
2878 FormData form; 2880 FormData form;
2879 test::CreateTestAddressFormData(&form); 2881 test::CreateTestAddressFormData(&form);
2880 std::vector<FormData> forms(1, form); 2882 std::vector<FormData> forms(1, form);
2881 FormsSeen(forms); 2883 FormsSeen(forms);
2882 const FormFieldData& field = form.fields[0]; 2884 const FormFieldData& field = form.fields[0];
2883 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2885 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2884 2886
2885 EXPECT_TRUE(external_delegate_->on_query_seen()); 2887 EXPECT_TRUE(external_delegate_->on_query_seen());
2886 } 2888 }
2887 2889
2888 } // namespace autofill 2890 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698