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

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

Issue 306053008: Rename AutofillManagerDelegate to AutofillClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: One more Android fix Created 6 years, 6 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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
15 #include "base/run_loop.h" 15 #include "base/run_loop.h"
16 #include "base/strings/string16.h" 16 #include "base/strings/string16.h"
17 #include "base/strings/string_number_conversions.h" 17 #include "base/strings/string_number_conversions.h"
18 #include "base/strings/stringprintf.h" 18 #include "base/strings/stringprintf.h"
19 #include "base/strings/utf_string_conversions.h" 19 #include "base/strings/utf_string_conversions.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "base/tuple.h" 21 #include "base/tuple.h"
22 #include "components/autofill/core/browser/autocomplete_history_manager.h" 22 #include "components/autofill/core/browser/autocomplete_history_manager.h"
23 #include "components/autofill/core/browser/autofill_manager.h" 23 #include "components/autofill/core/browser/autofill_manager.h"
24 #include "components/autofill/core/browser/autofill_metrics.h" 24 #include "components/autofill/core/browser/autofill_metrics.h"
25 #include "components/autofill/core/browser/autofill_profile.h" 25 #include "components/autofill/core/browser/autofill_profile.h"
26 #include "components/autofill/core/browser/autofill_test_utils.h" 26 #include "components/autofill/core/browser/autofill_test_utils.h"
27 #include "components/autofill/core/browser/credit_card.h" 27 #include "components/autofill/core/browser/credit_card.h"
28 #include "components/autofill/core/browser/personal_data_manager.h" 28 #include "components/autofill/core/browser/personal_data_manager.h"
29 #include "components/autofill/core/browser/popup_item_ids.h" 29 #include "components/autofill/core/browser/popup_item_ids.h"
30 #include "components/autofill/core/browser/test_autofill_client.h"
30 #include "components/autofill/core/browser/test_autofill_driver.h" 31 #include "components/autofill/core/browser/test_autofill_driver.h"
31 #include "components/autofill/core/browser/test_autofill_external_delegate.h" 32 #include "components/autofill/core/browser/test_autofill_external_delegate.h"
32 #include "components/autofill/core/browser/test_autofill_manager_delegate.h"
33 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" 33 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
34 #include "components/autofill/core/common/autofill_pref_names.h" 34 #include "components/autofill/core/common/autofill_pref_names.h"
35 #include "components/autofill/core/common/form_data.h" 35 #include "components/autofill/core/common/form_data.h"
36 #include "components/autofill/core/common/form_field_data.h" 36 #include "components/autofill/core/common/form_field_data.h"
37 #include "grit/components_strings.h" 37 #include "grit/components_strings.h"
38 #include "testing/gmock/include/gmock/gmock.h" 38 #include "testing/gmock/include/gmock/gmock.h"
39 #include "testing/gtest/include/gtest/gtest.h" 39 #include "testing/gtest/include/gtest/gtest.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41 #include "ui/gfx/rect.h" 41 #include "ui/gfx/rect.h"
42 #include "url/gurl.h" 42 #include "url/gurl.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 const char* year, 352 const char* year,
353 const char* month) { 353 const char* month) {
354 ExpectFilledForm(page_id, filled_form, expected_page_id, 354 ExpectFilledForm(page_id, filled_form, expected_page_id,
355 "", "", "", "", "", "", "", "", "", "", "", 355 "", "", "", "", "", "", "", "", "", "", "",
356 "Miku Hatsune", "4234567890654321", month, year, 356 "Miku Hatsune", "4234567890654321", month, year,
357 has_address_fields, true, true); 357 has_address_fields, true, true);
358 } 358 }
359 359
360 class MockAutocompleteHistoryManager : public AutocompleteHistoryManager { 360 class MockAutocompleteHistoryManager : public AutocompleteHistoryManager {
361 public: 361 public:
362 MockAutocompleteHistoryManager(AutofillDriver* driver, 362 MockAutocompleteHistoryManager(AutofillDriver* driver, AutofillClient* client)
363 AutofillManagerDelegate* delegate) 363 : AutocompleteHistoryManager(driver, client) {}
364 : AutocompleteHistoryManager(driver, delegate) {}
365 364
366 MOCK_METHOD1(OnFormSubmitted, void(const FormData& form)); 365 MOCK_METHOD1(OnFormSubmitted, void(const FormData& form));
367 366
368 private: 367 private:
369 DISALLOW_COPY_AND_ASSIGN(MockAutocompleteHistoryManager); 368 DISALLOW_COPY_AND_ASSIGN(MockAutocompleteHistoryManager);
370 }; 369 };
371 370
372 class MockAutofillDriver : public TestAutofillDriver { 371 class MockAutofillDriver : public TestAutofillDriver {
373 public: 372 public:
374 MockAutofillDriver() {} 373 MockAutofillDriver() {}
375 374
376 // Mock methods to enable testability. 375 // Mock methods to enable testability.
377 MOCK_METHOD3(SendFormDataToRenderer, void(int query_id, 376 MOCK_METHOD3(SendFormDataToRenderer, void(int query_id,
378 RendererFormDataAction action, 377 RendererFormDataAction action,
379 const FormData& data)); 378 const FormData& data));
380 379
381 private: 380 private:
382 DISALLOW_COPY_AND_ASSIGN(MockAutofillDriver); 381 DISALLOW_COPY_AND_ASSIGN(MockAutofillDriver);
383 }; 382 };
384 383
385 class TestAutofillManager : public AutofillManager { 384 class TestAutofillManager : public AutofillManager {
386 public: 385 public:
387 TestAutofillManager(AutofillDriver* driver, 386 TestAutofillManager(AutofillDriver* driver,
388 autofill::AutofillManagerDelegate* delegate, 387 autofill::AutofillClient* client,
389 TestPersonalDataManager* personal_data) 388 TestPersonalDataManager* personal_data)
390 : AutofillManager(driver, delegate, personal_data), 389 : AutofillManager(driver, client, personal_data),
391 personal_data_(personal_data), 390 personal_data_(personal_data),
392 autofill_enabled_(true) {} 391 autofill_enabled_(true) {}
393 virtual ~TestAutofillManager() {} 392 virtual ~TestAutofillManager() {}
394 393
395 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; } 394 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; }
396 395
397 void set_autofill_enabled(bool autofill_enabled) { 396 void set_autofill_enabled(bool autofill_enabled) {
398 autofill_enabled_ = autofill_enabled; 397 autofill_enabled_ = autofill_enabled;
399 } 398 }
400 399
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 std::vector<int> autofill_unique_ids_; 579 std::vector<int> autofill_unique_ids_;
581 580
582 DISALLOW_COPY_AND_ASSIGN(TestAutofillExternalDelegate); 581 DISALLOW_COPY_AND_ASSIGN(TestAutofillExternalDelegate);
583 }; 582 };
584 583
585 } // namespace 584 } // namespace
586 585
587 class AutofillManagerTest : public testing::Test { 586 class AutofillManagerTest : public testing::Test {
588 public: 587 public:
589 virtual void SetUp() OVERRIDE { 588 virtual void SetUp() OVERRIDE {
590 autofill_delegate_.SetPrefs(test::PrefServiceForTesting()); 589 autofill_client_.SetPrefs(test::PrefServiceForTesting());
591 personal_data_.set_database(autofill_delegate_.GetDatabase()); 590 personal_data_.set_database(autofill_client_.GetDatabase());
592 personal_data_.SetPrefService(autofill_delegate_.GetPrefs()); 591 personal_data_.SetPrefService(autofill_client_.GetPrefs());
593 autofill_driver_.reset(new MockAutofillDriver()); 592 autofill_driver_.reset(new MockAutofillDriver());
594 autofill_manager_.reset(new TestAutofillManager( 593 autofill_manager_.reset(new TestAutofillManager(
595 autofill_driver_.get(), &autofill_delegate_, &personal_data_)); 594 autofill_driver_.get(), &autofill_client_, &personal_data_));
596 595
597 external_delegate_.reset(new TestAutofillExternalDelegate( 596 external_delegate_.reset(new TestAutofillExternalDelegate(
598 autofill_manager_.get(), 597 autofill_manager_.get(),
599 autofill_driver_.get())); 598 autofill_driver_.get()));
600 autofill_manager_->SetExternalDelegate(external_delegate_.get()); 599 autofill_manager_->SetExternalDelegate(external_delegate_.get());
601 } 600 }
602 601
603 virtual void TearDown() OVERRIDE { 602 virtual void TearDown() OVERRIDE {
604 // Order of destruction is important as AutofillManager relies on 603 // Order of destruction is important as AutofillManager relies on
605 // PersonalDataManager to be around when it gets destroyed. 604 // PersonalDataManager to be around when it gets destroyed.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 testing::SaveArg<2>(response_data)))); 666 testing::SaveArg<2>(response_data))));
668 FillAutofillFormData(input_query_id, input_form, input_field, unique_id); 667 FillAutofillFormData(input_query_id, input_form, input_field, unique_id);
669 } 668 }
670 669
671 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid) const { 670 int PackGUIDs(const GUIDPair& cc_guid, const GUIDPair& profile_guid) const {
672 return autofill_manager_->PackGUIDs(cc_guid, profile_guid); 671 return autofill_manager_->PackGUIDs(cc_guid, profile_guid);
673 } 672 }
674 673
675 protected: 674 protected:
676 base::MessageLoop message_loop_; 675 base::MessageLoop message_loop_;
677 TestAutofillManagerDelegate autofill_delegate_; 676 TestAutofillClient autofill_client_;
678 scoped_ptr<MockAutofillDriver> autofill_driver_; 677 scoped_ptr<MockAutofillDriver> autofill_driver_;
679 scoped_ptr<TestAutofillManager> autofill_manager_; 678 scoped_ptr<TestAutofillManager> autofill_manager_;
680 scoped_ptr<TestAutofillExternalDelegate> external_delegate_; 679 scoped_ptr<TestAutofillExternalDelegate> external_delegate_;
681 TestPersonalDataManager personal_data_; 680 TestPersonalDataManager personal_data_;
682 }; 681 };
683 682
684 class TestFormStructure : public FormStructure { 683 class TestFormStructure : public FormStructure {
685 public: 684 public:
686 explicit TestFormStructure(const FormData& form) 685 explicit TestFormStructure(const FormData& form)
687 : FormStructure(form) {} 686 : FormStructure(form) {}
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 FormData response_data; 1544 FormData response_data;
1546 FillAutofillFormDataAndSaveResults(kDefaultPageID, form, form.fields[0], 1545 FillAutofillFormDataAndSaveResults(kDefaultPageID, form, form.fields[0],
1547 PackGUIDs(empty, guid), &response_page_id, &response_data); 1546 PackGUIDs(empty, guid), &response_page_id, &response_data);
1548 ExpectFilledAddressFormElvis( 1547 ExpectFilledAddressFormElvis(
1549 response_page_id, response_data, kDefaultPageID, false); 1548 response_page_id, response_data, kDefaultPageID, false);
1550 } 1549 }
1551 1550
1552 // Test that we correctly fill an address form from an auxiliary profile. 1551 // Test that we correctly fill an address form from an auxiliary profile.
1553 TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) { 1552 TEST_F(AutofillManagerTest, FillAddressFormFromAuxiliaryProfile) {
1554 personal_data_.ClearAutofillProfiles(); 1553 personal_data_.ClearAutofillProfiles();
1555 autofill_delegate_.GetPrefs()->SetBoolean( 1554 autofill_client_.GetPrefs()->SetBoolean(
1556 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true); 1555 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, true);
1557 personal_data_.CreateTestAuxiliaryProfiles(); 1556 personal_data_.CreateTestAuxiliaryProfiles();
1558 1557
1559 // Set up our form data. 1558 // Set up our form data.
1560 FormData form; 1559 FormData form;
1561 test::CreateTestAddressFormData(&form); 1560 test::CreateTestAddressFormData(&form);
1562 std::vector<FormData> forms(1, form); 1561 std::vector<FormData> forms(1, form);
1563 FormsSeen(forms); 1562 FormsSeen(forms);
1564 1563
1565 GUIDPair guid("00000000-0000-0000-0000-000000000001", 0); 1564 GUIDPair guid("00000000-0000-0000-0000-000000000001", 0);
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2301 2300
2302 // Simulate form submission. We should call into the PDM to try to save the 2301 // Simulate form submission. We should call into the PDM to try to save the
2303 // filled data. 2302 // filled data.
2304 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(1); 2303 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(1);
2305 FormSubmitted(response_data); 2304 FormSubmitted(response_data);
2306 } 2305 }
2307 2306
2308 // Test that when Autocomplete is enabled and Autofill is disabled, 2307 // Test that when Autocomplete is enabled and Autofill is disabled,
2309 // form submissions are still received by AutocompleteHistoryManager. 2308 // form submissions are still received by AutocompleteHistoryManager.
2310 TEST_F(AutofillManagerTest, FormSubmittedAutocompleteEnabled) { 2309 TEST_F(AutofillManagerTest, FormSubmittedAutocompleteEnabled) {
2311 TestAutofillManagerDelegate delegate; 2310 TestAutofillClient client;
2312 autofill_manager_.reset(new TestAutofillManager( 2311 autofill_manager_.reset(
2313 autofill_driver_.get(), 2312 new TestAutofillManager(autofill_driver_.get(), &client, NULL));
2314 &delegate,
2315 NULL));
2316 autofill_manager_->set_autofill_enabled(false); 2313 autofill_manager_->set_autofill_enabled(false);
2317 scoped_ptr<MockAutocompleteHistoryManager> autocomplete_history_manager; 2314 scoped_ptr<MockAutocompleteHistoryManager> autocomplete_history_manager;
2318 autocomplete_history_manager.reset( 2315 autocomplete_history_manager.reset(
2319 new MockAutocompleteHistoryManager(autofill_driver_.get(), &delegate)); 2316 new MockAutocompleteHistoryManager(autofill_driver_.get(), &client));
2320 autofill_manager_->autocomplete_history_manager_ = 2317 autofill_manager_->autocomplete_history_manager_ =
2321 autocomplete_history_manager.Pass(); 2318 autocomplete_history_manager.Pass();
2322 2319
2323 // Set up our form data. 2320 // Set up our form data.
2324 FormData form; 2321 FormData form;
2325 test::CreateTestAddressFormData(&form); 2322 test::CreateTestAddressFormData(&form);
2326 form.method = ASCIIToUTF16("GET"); 2323 form.method = ASCIIToUTF16("GET");
2327 MockAutocompleteHistoryManager* m = static_cast< 2324 MockAutocompleteHistoryManager* m = static_cast<
2328 MockAutocompleteHistoryManager*>( 2325 MockAutocompleteHistoryManager*>(
2329 autofill_manager_->autocomplete_history_manager_.get()); 2326 autofill_manager_->autocomplete_history_manager_.get());
2330 EXPECT_CALL(*m, 2327 EXPECT_CALL(*m,
2331 OnFormSubmitted(_)).Times(1); 2328 OnFormSubmitted(_)).Times(1);
2332 FormSubmitted(form); 2329 FormSubmitted(form);
2333 } 2330 }
2334 2331
2335 // Test that when Autocomplete is enabled and Autofill is disabled, 2332 // Test that when Autocomplete is enabled and Autofill is disabled,
2336 // Autocomplete suggestions are still received. 2333 // Autocomplete suggestions are still received.
2337 TEST_F(AutofillManagerTest, AutocompleteSuggestionsWhenAutofillDisabled) { 2334 TEST_F(AutofillManagerTest, AutocompleteSuggestionsWhenAutofillDisabled) {
2338 TestAutofillManagerDelegate delegate; 2335 TestAutofillClient client;
2339 autofill_manager_.reset(new TestAutofillManager( 2336 autofill_manager_.reset(
2340 autofill_driver_.get(), 2337 new TestAutofillManager(autofill_driver_.get(), &client, NULL));
2341 &delegate,
2342 NULL));
2343 autofill_manager_->set_autofill_enabled(false); 2338 autofill_manager_->set_autofill_enabled(false);
2344 autofill_manager_->SetExternalDelegate(external_delegate_.get()); 2339 autofill_manager_->SetExternalDelegate(external_delegate_.get());
2345 2340
2346 // Set up our form data. 2341 // Set up our form data.
2347 FormData form; 2342 FormData form;
2348 test::CreateTestAddressFormData(&form); 2343 test::CreateTestAddressFormData(&form);
2349 form.method = ASCIIToUTF16("GET"); 2344 form.method = ASCIIToUTF16("GET");
2350 std::vector<FormData> forms(1, form); 2345 std::vector<FormData> forms(1, form);
2351 FormsSeen(forms); 2346 FormsSeen(forms);
2352 const FormFieldData& field = form.fields[0]; 2347 const FormFieldData& field = form.fields[0];
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
2469 2464
2470 // Simulate form submission. We should not call into the PDM to try to save 2465 // Simulate form submission. We should not call into the PDM to try to save
2471 // the filled data, since the filled form is effectively missing an address. 2466 // the filled data, since the filled form is effectively missing an address.
2472 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); 2467 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0);
2473 FormSubmitted(response_data); 2468 FormSubmitted(response_data);
2474 } 2469 }
2475 2470
2476 // Checks that resetting the auxiliary profile enabled preference does the right 2471 // Checks that resetting the auxiliary profile enabled preference does the right
2477 // thing on all platforms. 2472 // thing on all platforms.
2478 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { 2473 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) {
2479 PrefService* prefs = autofill_delegate_.GetPrefs(); 2474 PrefService* prefs = autofill_client_.GetPrefs();
2480 #if defined(OS_MACOSX) || defined(OS_ANDROID) 2475 #if defined(OS_MACOSX) || defined(OS_ANDROID)
2481 // Auxiliary profiles is implemented on Mac and Android only. 2476 // Auxiliary profiles is implemented on Mac and Android only.
2482 // OSX: enables Mac Address Book integration. 2477 // OSX: enables Mac Address Book integration.
2483 // Android: enables integration with user's contact profile. 2478 // Android: enables integration with user's contact profile.
2484 ASSERT_TRUE( 2479 ASSERT_TRUE(
2485 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled)); 2480 prefs->GetBoolean(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled));
2486 prefs->SetBoolean( 2481 prefs->SetBoolean(
2487 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, false); 2482 ::autofill::prefs::kAutofillAuxiliaryProfilesEnabled, false);
2488 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled); 2483 prefs->ClearPref(::autofill::prefs::kAutofillAuxiliaryProfilesEnabled);
2489 ASSERT_TRUE( 2484 ASSERT_TRUE(
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
2829 autofill_manager_->RemoveAutofillProfileOrCreditCard(id); 2824 autofill_manager_->RemoveAutofillProfileOrCreditCard(id);
2830 2825
2831 // TODO(csharp): Currently variants should not be deleted, but once they are 2826 // TODO(csharp): Currently variants should not be deleted, but once they are
2832 // update these expectations. 2827 // update these expectations.
2833 // http://crbug.com/124211 2828 // http://crbug.com/124211
2834 EXPECT_TRUE(autofill_manager_->GetProfileWithGUID(guid.c_str())); 2829 EXPECT_TRUE(autofill_manager_->GetProfileWithGUID(guid.c_str()));
2835 } 2830 }
2836 2831
2837 namespace { 2832 namespace {
2838 2833
2839 class MockAutofillManagerDelegate : public TestAutofillManagerDelegate { 2834 class MockAutofillClient : public TestAutofillClient {
2840 public: 2835 public:
2841 MockAutofillManagerDelegate() {} 2836 MockAutofillClient() {}
2842 2837
2843 virtual ~MockAutofillManagerDelegate() {} 2838 virtual ~MockAutofillClient() {}
2844 2839
2845 virtual void ShowRequestAutocompleteDialog( 2840 virtual void ShowRequestAutocompleteDialog(
2846 const FormData& form, 2841 const FormData& form,
2847 const GURL& source_url, 2842 const GURL& source_url,
2848 const ResultCallback& callback) OVERRIDE { 2843 const ResultCallback& callback) OVERRIDE {
2849 callback.Run(user_supplied_data_ ? AutocompleteResultSuccess : 2844 callback.Run(user_supplied_data_ ? AutocompleteResultSuccess :
2850 AutocompleteResultErrorDisabled, 2845 AutocompleteResultErrorDisabled,
2851 base::string16(), 2846 base::string16(),
2852 user_supplied_data_.get()); 2847 user_supplied_data_.get());
2853 } 2848 }
2854 2849
2855 void SetUserSuppliedData(scoped_ptr<FormStructure> user_supplied_data) { 2850 void SetUserSuppliedData(scoped_ptr<FormStructure> user_supplied_data) {
2856 user_supplied_data_.reset(user_supplied_data.release()); 2851 user_supplied_data_.reset(user_supplied_data.release());
2857 } 2852 }
2858 2853
2859 private: 2854 private:
2860 scoped_ptr<FormStructure> user_supplied_data_; 2855 scoped_ptr<FormStructure> user_supplied_data_;
2861 2856
2862 DISALLOW_COPY_AND_ASSIGN(MockAutofillManagerDelegate); 2857 DISALLOW_COPY_AND_ASSIGN(MockAutofillClient);
2863 }; 2858 };
2864 2859
2865 } // namespace 2860 } // namespace
2866 2861
2867 // Test our external delegate is called at the right time. 2862 // Test our external delegate is called at the right time.
2868 TEST_F(AutofillManagerTest, TestExternalDelegate) { 2863 TEST_F(AutofillManagerTest, TestExternalDelegate) {
2869 FormData form; 2864 FormData form;
2870 test::CreateTestAddressFormData(&form); 2865 test::CreateTestAddressFormData(&form);
2871 std::vector<FormData> forms(1, form); 2866 std::vector<FormData> forms(1, form);
2872 FormsSeen(forms); 2867 FormsSeen(forms);
2873 const FormFieldData& field = form.fields[0]; 2868 const FormFieldData& field = form.fields[0];
2874 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery() 2869 GetAutofillSuggestions(form, field); // should call the delegate's OnQuery()
2875 2870
2876 EXPECT_TRUE(external_delegate_->on_query_seen()); 2871 EXPECT_TRUE(external_delegate_->on_query_seen());
2877 } 2872 }
2878 2873
2879 } // namespace autofill 2874 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698