| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 3173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3184 GURL(), | 3184 GURL(), |
| 3185 content::SSLStatus()); | 3185 content::SSLStatus()); |
| 3186 | 3186 |
| 3187 EXPECT_EQ(1U, autofill_manager_->request_autocomplete_results().size()); | 3187 EXPECT_EQ(1U, autofill_manager_->request_autocomplete_results().size()); |
| 3188 EXPECT_EQ(WebFormElement::AutocompleteResultErrorDisabled, | 3188 EXPECT_EQ(WebFormElement::AutocompleteResultErrorDisabled, |
| 3189 autofill_manager_->request_autocomplete_results()[0].first); | 3189 autofill_manager_->request_autocomplete_results()[0].first); |
| 3190 } | 3190 } |
| 3191 | 3191 |
| 3192 namespace { | 3192 namespace { |
| 3193 | 3193 |
| 3194 class MockAutofillExternalDelegate : | 3194 class MockAutofillExternalDelegate : public AutofillExternalDelegate { |
| 3195 public autofill::TestAutofillExternalDelegate { | |
| 3196 public: | 3195 public: |
| 3197 explicit MockAutofillExternalDelegate(content::WebContents* web_contents, | 3196 explicit MockAutofillExternalDelegate(content::WebContents* web_contents, |
| 3198 AutofillManager* autofill_manager) | 3197 AutofillManager* autofill_manager) |
| 3199 : TestAutofillExternalDelegate(web_contents, autofill_manager) {} | 3198 : AutofillExternalDelegate(web_contents, autofill_manager) {} |
| 3200 virtual ~MockAutofillExternalDelegate() {} | 3199 virtual ~MockAutofillExternalDelegate() {} |
| 3201 | 3200 |
| 3202 MOCK_METHOD5(OnQuery, void(int query_id, | 3201 MOCK_METHOD5(OnQuery, void(int query_id, |
| 3203 const FormData& form, | 3202 const FormData& form, |
| 3204 const FormFieldData& field, | 3203 const FormFieldData& field, |
| 3205 const gfx::RectF& bounds, | 3204 const gfx::RectF& bounds, |
| 3206 bool display_warning)); | 3205 bool display_warning)); |
| 3207 | 3206 |
| 3208 private: | 3207 private: |
| 3209 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate); | 3208 DISALLOW_COPY_AND_ASSIGN(MockAutofillExternalDelegate); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3220 | 3219 |
| 3221 FormData form; | 3220 FormData form; |
| 3222 CreateTestAddressFormData(&form); | 3221 CreateTestAddressFormData(&form); |
| 3223 std::vector<FormData> forms(1, form); | 3222 std::vector<FormData> forms(1, form); |
| 3224 FormsSeen(forms); | 3223 FormsSeen(forms); |
| 3225 const FormFieldData& field = form.fields[0]; | 3224 const FormFieldData& field = form.fields[0]; |
| 3226 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() | 3225 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() |
| 3227 | 3226 |
| 3228 autofill_manager_->SetExternalDelegate(NULL); | 3227 autofill_manager_->SetExternalDelegate(NULL); |
| 3229 } | 3228 } |
| OLD | NEW |