| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | |
| 8 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 10 #include "base/string16.h" | 9 #include "base/string16.h" |
| 11 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| 12 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 13 #include "base/time.h" | 12 #include "base/time.h" |
| 14 #include "base/tuple.h" | 13 #include "base/tuple.h" |
| 15 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/autocomplete_history_manager.h" | 15 #include "chrome/browser/autocomplete_history_manager.h" |
| 17 #include "chrome/browser/autofill/autofill_common_test.h" | 16 #include "chrome/browser/autofill/autofill_common_test.h" |
| 18 #include "chrome/browser/autofill/autofill_manager.h" | 17 #include "chrome/browser/autofill/autofill_manager.h" |
| 19 #include "chrome/browser/autofill/autofill_profile.h" | 18 #include "chrome/browser/autofill/autofill_profile.h" |
| 20 #include "chrome/browser/autofill/credit_card.h" | 19 #include "chrome/browser/autofill/credit_card.h" |
| 21 #include "chrome/browser/autofill/personal_data_manager.h" | 20 #include "chrome/browser/autofill/personal_data_manager.h" |
| 21 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" | 22 #include "chrome/browser/prefs/pref_service.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/ui/browser.h" | 24 #include "chrome/browser/ui/browser.h" |
| 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 25 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 26 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" | 26 #include "chrome/browser/ui/tab_contents/test_tab_contents_wrapper.h" |
| 27 #include "chrome/common/autofill_messages.h" | 27 #include "chrome/common/autofill_messages.h" |
| 28 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
| 29 #include "chrome/test/base/testing_profile.h" | 29 #include "chrome/test/base/testing_profile.h" |
| 30 #include "content/browser/browser_thread.h" | 30 #include "content/browser/browser_thread.h" |
| 31 #include "content/browser/tab_contents/test_tab_contents.h" | 31 #include "content/browser/tab_contents/test_tab_contents.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 53 std::vector<string16>, | 53 std::vector<string16>, |
| 54 std::vector<int> > AutofillParam; | 54 std::vector<int> > AutofillParam; |
| 55 | 55 |
| 56 class TestPersonalDataManager : public PersonalDataManager { | 56 class TestPersonalDataManager : public PersonalDataManager { |
| 57 public: | 57 public: |
| 58 TestPersonalDataManager() { | 58 TestPersonalDataManager() { |
| 59 CreateTestAutofillProfiles(&web_profiles_); | 59 CreateTestAutofillProfiles(&web_profiles_); |
| 60 CreateTestCreditCards(&credit_cards_); | 60 CreateTestCreditCards(&credit_cards_); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Factory method for keyed service. PersonalDataManager is NULL for testing. |
| 64 static ProfileKeyedService* Build(Profile* profile) { |
| 65 return NULL; |
| 66 } |
| 67 |
| 63 MOCK_METHOD1(SaveImportedProfile, void(const AutofillProfile&)); | 68 MOCK_METHOD1(SaveImportedProfile, void(const AutofillProfile&)); |
| 64 | 69 |
| 65 AutofillProfile* GetProfileWithGUID(const char* guid) { | 70 AutofillProfile* GetProfileWithGUID(const char* guid) { |
| 66 for (std::vector<AutofillProfile *>::iterator it = web_profiles_.begin(); | 71 for (std::vector<AutofillProfile *>::iterator it = web_profiles_.begin(); |
| 67 it != web_profiles_.end(); ++it) { | 72 it != web_profiles_.end(); ++it) { |
| 68 if (!(*it)->guid().compare(guid)) | 73 if (!(*it)->guid().compare(guid)) |
| 69 return *it; | 74 return *it; |
| 70 } | 75 } |
| 71 return NULL; | 76 return NULL; |
| 72 } | 77 } |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 const char* month) { | 397 const char* month) { |
| 393 ExpectFilledForm(page_id, filled_form, expected_page_id, | 398 ExpectFilledForm(page_id, filled_form, expected_page_id, |
| 394 "", "", "", "", "", "", "", "", "", "", "", | 399 "", "", "", "", "", "", "", "", "", "", "", |
| 395 "Miku Hatsune", "4234567890654321", month, year, | 400 "Miku Hatsune", "4234567890654321", month, year, |
| 396 has_address_fields, true, true); | 401 has_address_fields, true, true); |
| 397 } | 402 } |
| 398 | 403 |
| 399 class TestAutofillManager : public AutofillManager { | 404 class TestAutofillManager : public AutofillManager { |
| 400 public: | 405 public: |
| 401 TestAutofillManager(TabContentsWrapper* tab_contents, | 406 TestAutofillManager(TabContentsWrapper* tab_contents, |
| 402 TestPersonalDataManager* personal_manager) | 407 TestPersonalDataManager* personal_data) |
| 403 : AutofillManager(tab_contents, personal_manager), | 408 : AutofillManager(tab_contents, personal_data), |
| 409 personal_data_(personal_data), |
| 404 autofill_enabled_(true) { | 410 autofill_enabled_(true) { |
| 405 test_personal_data_ = personal_manager; | |
| 406 } | 411 } |
| 407 | 412 |
| 408 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; } | 413 virtual bool IsAutofillEnabled() const OVERRIDE { return autofill_enabled_; } |
| 409 | 414 |
| 410 void set_autofill_enabled(bool autofill_enabled) { | 415 void set_autofill_enabled(bool autofill_enabled) { |
| 411 autofill_enabled_ = autofill_enabled; | 416 autofill_enabled_ = autofill_enabled; |
| 412 } | 417 } |
| 413 | 418 |
| 414 virtual void UploadFormData(const FormStructure& submitted_form) OVERRIDE { | 419 virtual void UploadFormData(const FormStructure& submitted_form) OVERRIDE { |
| 415 submitted_form_signature_ = submitted_form.FormSignature(); | 420 submitted_form_signature_ = submitted_form.FormSignature(); |
| 416 } | 421 } |
| 417 | 422 |
| 418 const std::string GetSubmittedFormSignature() { | 423 const std::string GetSubmittedFormSignature() { |
| 419 return submitted_form_signature_; | 424 return submitted_form_signature_; |
| 420 } | 425 } |
| 421 | 426 |
| 422 AutofillProfile* GetProfileWithGUID(const char* guid) { | 427 AutofillProfile* GetProfileWithGUID(const char* guid) { |
| 423 return test_personal_data_->GetProfileWithGUID(guid); | 428 return personal_data_->GetProfileWithGUID(guid); |
| 424 } | 429 } |
| 425 | 430 |
| 426 void AddProfile(AutofillProfile* profile) { | 431 void AddProfile(AutofillProfile* profile) { |
| 427 test_personal_data_->AddProfile(profile); | 432 personal_data_->AddProfile(profile); |
| 428 } | 433 } |
| 429 | 434 |
| 430 void AddCreditCard(CreditCard* credit_card) { | 435 void AddCreditCard(CreditCard* credit_card) { |
| 431 test_personal_data_->AddCreditCard(credit_card); | 436 personal_data_->AddCreditCard(credit_card); |
| 432 } | 437 } |
| 433 | 438 |
| 434 int GetPackedCreditCardID(int credit_card_id) { | 439 int GetPackedCreditCardID(int credit_card_id) { |
| 435 return PackGUIDs(IDToGUID(credit_card_id), GUIDPair(std::string(), 0)); | 440 return PackGUIDs(IDToGUID(credit_card_id), GUIDPair(std::string(), 0)); |
| 436 } | 441 } |
| 437 | 442 |
| 438 virtual int GUIDToID(const GUIDPair& guid) const OVERRIDE { | 443 virtual int GUIDToID(const GUIDPair& guid) const OVERRIDE { |
| 439 if (guid.first.empty()) | 444 if (guid.first.empty()) |
| 440 return 0; | 445 return 0; |
| 441 | 446 |
| 442 int id; | 447 int id; |
| 443 EXPECT_TRUE(base::StringToInt(guid.first.substr(guid.first.rfind("-") + 1), | 448 EXPECT_TRUE(base::StringToInt(guid.first.substr(guid.first.rfind("-") + 1), |
| 444 &id)); | 449 &id)); |
| 445 return id; | 450 return id; |
| 446 } | 451 } |
| 447 | 452 |
| 448 virtual const GUIDPair IDToGUID(int id) const OVERRIDE { | 453 virtual const GUIDPair IDToGUID(int id) const OVERRIDE { |
| 449 EXPECT_TRUE(id >= 0); | 454 EXPECT_TRUE(id >= 0); |
| 450 if (id <= 0) | 455 if (id <= 0) |
| 451 return GUIDPair(std::string(), 0); | 456 return GUIDPair(std::string(), 0); |
| 452 | 457 |
| 453 return GUIDPair(base::StringPrintf("00000000-0000-0000-0000-%012d", id), 0); | 458 return GUIDPair(base::StringPrintf("00000000-0000-0000-0000-%012d", id), 0); |
| 454 } | 459 } |
| 455 | 460 |
| 456 void AddSeenForm(FormStructure* form) { | 461 void AddSeenForm(FormStructure* form) { |
| 457 form_structures()->push_back(form); | 462 form_structures()->push_back(form); |
| 458 } | 463 } |
| 459 | 464 |
| 460 private: | 465 private: |
| 461 TestPersonalDataManager* test_personal_data_; | 466 // Weak reference. |
| 467 TestPersonalDataManager* personal_data_; |
| 462 bool autofill_enabled_; | 468 bool autofill_enabled_; |
| 463 std::string submitted_form_signature_; | 469 std::string submitted_form_signature_; |
| 464 | 470 |
| 465 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); | 471 DISALLOW_COPY_AND_ASSIGN(TestAutofillManager); |
| 466 }; | 472 }; |
| 467 | 473 |
| 468 } // namespace | 474 } // namespace |
| 469 | 475 |
| 470 class AutofillManagerTest : public TabContentsWrapperTestHarness { | 476 class AutofillManagerTest : public TabContentsWrapperTestHarness { |
| 471 public: | 477 public: |
| 472 typedef AutofillManager::GUIDPair GUIDPair; | 478 typedef AutofillManager::GUIDPair GUIDPair; |
| 473 | 479 |
| 474 AutofillManagerTest() | 480 AutofillManagerTest() |
| 475 : TabContentsWrapperTestHarness(), | 481 : TabContentsWrapperTestHarness(), |
| 476 browser_thread_(BrowserThread::UI, &message_loop_) {} | 482 browser_thread_(BrowserThread::UI, &message_loop_) {} |
| 477 | 483 |
| 478 virtual ~AutofillManagerTest() { | 484 virtual ~AutofillManagerTest() { |
| 479 // Order of destruction is important as AutofillManager relies on | 485 // Order of destruction is important as AutofillManager relies on |
| 480 // PersonalDataManager to be around when it gets destroyed. | 486 // PersonalDataManager to be around when it gets destroyed. |
| 481 autofill_manager_.reset(NULL); | 487 autofill_manager_.reset(NULL); |
| 482 test_personal_data_ = NULL; | |
| 483 } | 488 } |
| 484 | 489 |
| 485 virtual void SetUp() { | 490 virtual void SetUp() { |
| 491 Profile* profile = new TestingProfile(); |
| 492 browser_context_.reset(profile); |
| 493 PersonalDataManagerFactory::GetInstance()->SetTestingFactory( |
| 494 profile, TestPersonalDataManager::Build); |
| 495 |
| 486 TabContentsWrapperTestHarness::SetUp(); | 496 TabContentsWrapperTestHarness::SetUp(); |
| 487 test_personal_data_ = new TestPersonalDataManager(); | |
| 488 autofill_manager_.reset(new TestAutofillManager(contents_wrapper(), | 497 autofill_manager_.reset(new TestAutofillManager(contents_wrapper(), |
| 489 test_personal_data_.get())); | 498 &personal_data_)); |
| 490 } | 499 } |
| 491 | 500 |
| 492 void GetAutofillSuggestions(int query_id, | 501 void GetAutofillSuggestions(int query_id, |
| 493 const webkit_glue::FormData& form, | 502 const webkit_glue::FormData& form, |
| 494 const webkit_glue::FormField& field) { | 503 const webkit_glue::FormField& field) { |
| 495 autofill_manager_->OnQueryFormFieldAutofill(query_id, form, field); | 504 autofill_manager_->OnQueryFormFieldAutofill(query_id, form, field); |
| 496 } | 505 } |
| 497 | 506 |
| 498 void GetAutofillSuggestions(const webkit_glue::FormData& form, | 507 void GetAutofillSuggestions(const webkit_glue::FormData& form, |
| 499 const webkit_glue::FormField& field) { | 508 const webkit_glue::FormField& field) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 *results = autofill_param.b; | 572 *results = autofill_param.b; |
| 564 | 573 |
| 565 process()->sink().ClearMessages(); | 574 process()->sink().ClearMessages(); |
| 566 return true; | 575 return true; |
| 567 } | 576 } |
| 568 | 577 |
| 569 protected: | 578 protected: |
| 570 BrowserThread browser_thread_; | 579 BrowserThread browser_thread_; |
| 571 | 580 |
| 572 scoped_ptr<TestAutofillManager> autofill_manager_; | 581 scoped_ptr<TestAutofillManager> autofill_manager_; |
| 573 scoped_refptr<TestPersonalDataManager> test_personal_data_; | 582 TestPersonalDataManager personal_data_; |
| 574 | 583 |
| 575 private: | 584 private: |
| 576 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTest); | 585 DISALLOW_COPY_AND_ASSIGN(AutofillManagerTest); |
| 577 }; | 586 }; |
| 578 | 587 |
| 579 class TestFormStructure : public FormStructure { | 588 class TestFormStructure : public FormStructure { |
| 580 public: | 589 public: |
| 581 explicit TestFormStructure(const FormData& form) : FormStructure(form) {} | 590 explicit TestFormStructure(const FormData& form) : FormStructure(form) {} |
| 582 virtual ~TestFormStructure() {} | 591 virtual ~TestFormStructure() {} |
| 583 | 592 |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 ASCIIToUTF16("Jason") | 833 ASCIIToUTF16("Jason") |
| 825 }; | 834 }; |
| 826 string16 expected_labels2[] = {string16(), string16(), string16()}; | 835 string16 expected_labels2[] = {string16(), string16(), string16()}; |
| 827 string16 expected_icons2[] = {string16(), string16(), string16()}; | 836 string16 expected_icons2[] = {string16(), string16(), string16()}; |
| 828 int expected_unique_ids2[] = {-1, 0, 0}; | 837 int expected_unique_ids2[] = {-1, 0, 0}; |
| 829 ExpectSuggestions(page_id, values, labels, icons, unique_ids, | 838 ExpectSuggestions(page_id, values, labels, icons, unique_ids, |
| 830 kPageID2, arraysize(expected_values2), expected_values2, | 839 kPageID2, arraysize(expected_values2), expected_values2, |
| 831 expected_labels2, expected_icons2, expected_unique_ids2); | 840 expected_labels2, expected_icons2, expected_unique_ids2); |
| 832 | 841 |
| 833 // Now clear the test profiles and try again -- we shouldn't return a warning. | 842 // Now clear the test profiles and try again -- we shouldn't return a warning. |
| 834 test_personal_data_->ClearAutofillProfiles(); | 843 personal_data_.ClearAutofillProfiles(); |
| 835 GetAutofillSuggestions(form, field); | 844 GetAutofillSuggestions(form, field); |
| 836 EXPECT_FALSE(GetAutofillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); | 845 EXPECT_FALSE(GetAutofillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); |
| 837 } | 846 } |
| 838 | 847 |
| 839 // Test that we return all credit card profile suggestions when all form fields | 848 // Test that we return all credit card profile suggestions when all form fields |
| 840 // are empty. | 849 // are empty. |
| 841 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsEmptyValue) { | 850 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsEmptyValue) { |
| 842 // Set up our form data. | 851 // Set up our form data. |
| 843 FormData form; | 852 FormData form; |
| 844 CreateTestCreditCardFormData(&form, true, false); | 853 CreateTestCreditCardFormData(&form, true, false); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 ASCIIToUTF16("Jason") | 1020 ASCIIToUTF16("Jason") |
| 1012 }; | 1021 }; |
| 1013 string16 expected_labels2[] = {string16(), string16(), string16()}; | 1022 string16 expected_labels2[] = {string16(), string16(), string16()}; |
| 1014 string16 expected_icons2[] = {string16(), string16(), string16()}; | 1023 string16 expected_icons2[] = {string16(), string16(), string16()}; |
| 1015 int expected_unique_ids2[] = {-1, 0, 0}; | 1024 int expected_unique_ids2[] = {-1, 0, 0}; |
| 1016 ExpectSuggestions(page_id, values, labels, icons, unique_ids, | 1025 ExpectSuggestions(page_id, values, labels, icons, unique_ids, |
| 1017 kPageID2, arraysize(expected_values2), expected_values2, | 1026 kPageID2, arraysize(expected_values2), expected_values2, |
| 1018 expected_labels2, expected_icons2, expected_unique_ids2); | 1027 expected_labels2, expected_icons2, expected_unique_ids2); |
| 1019 | 1028 |
| 1020 // Clear the test credit cards and try again -- we shouldn't return a warning. | 1029 // Clear the test credit cards and try again -- we shouldn't return a warning. |
| 1021 test_personal_data_->ClearCreditCards(); | 1030 personal_data_.ClearCreditCards(); |
| 1022 GetAutofillSuggestions(form, field); | 1031 GetAutofillSuggestions(form, field); |
| 1023 EXPECT_FALSE(GetAutofillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); | 1032 EXPECT_FALSE(GetAutofillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); |
| 1024 } | 1033 } |
| 1025 | 1034 |
| 1026 // Test that we return all credit card suggestions in the case that two cards | 1035 // Test that we return all credit card suggestions in the case that two cards |
| 1027 // have the same obfuscated number. | 1036 // have the same obfuscated number. |
| 1028 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsRepeatedObfuscatedNumber) { | 1037 TEST_F(AutofillManagerTest, GetCreditCardSuggestionsRepeatedObfuscatedNumber) { |
| 1029 // Add a credit card with the same obfuscated number as Elvis's. | 1038 // Add a credit card with the same obfuscated number as Elvis's. |
| 1030 // |credit_card| will be owned by the mock PersonalDataManager. | 1039 // |credit_card| will be owned by the mock PersonalDataManager. |
| 1031 CreditCard* credit_card = new CreditCard; | 1040 CreditCard* credit_card = new CreditCard; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1212 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION) | 1221 l10n_util::GetStringUTF16(IDS_AUTOFILL_WARNING_INSECURE_CONNECTION) |
| 1213 }; | 1222 }; |
| 1214 string16 expected_labels2[] = {string16()}; | 1223 string16 expected_labels2[] = {string16()}; |
| 1215 string16 expected_icons2[] = {string16()}; | 1224 string16 expected_icons2[] = {string16()}; |
| 1216 int expected_unique_ids2[] = {-1}; | 1225 int expected_unique_ids2[] = {-1}; |
| 1217 ExpectSuggestions(page_id, values, labels, icons, unique_ids, | 1226 ExpectSuggestions(page_id, values, labels, icons, unique_ids, |
| 1218 kPageID2, arraysize(expected_values2), expected_values2, | 1227 kPageID2, arraysize(expected_values2), expected_values2, |
| 1219 expected_labels2, expected_icons2, expected_unique_ids2); | 1228 expected_labels2, expected_icons2, expected_unique_ids2); |
| 1220 | 1229 |
| 1221 // Clear the test credit cards and try again -- we shouldn't return a warning. | 1230 // Clear the test credit cards and try again -- we shouldn't return a warning. |
| 1222 test_personal_data_->ClearCreditCards(); | 1231 personal_data_.ClearCreditCards(); |
| 1223 GetAutofillSuggestions(form, field); | 1232 GetAutofillSuggestions(form, field); |
| 1224 EXPECT_FALSE(GetAutofillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); | 1233 EXPECT_FALSE(GetAutofillSuggestionsMessage(NULL, NULL, NULL, NULL, NULL)); |
| 1225 } | 1234 } |
| 1226 | 1235 |
| 1227 // Test that we correctly combine autofill and autocomplete suggestions. | 1236 // Test that we correctly combine autofill and autocomplete suggestions. |
| 1228 TEST_F(AutofillManagerTest, GetCombinedAutofillAndAutocompleteSuggestions) { | 1237 TEST_F(AutofillManagerTest, GetCombinedAutofillAndAutocompleteSuggestions) { |
| 1229 // Set up our form data. | 1238 // Set up our form data. |
| 1230 FormData form; | 1239 FormData form; |
| 1231 CreateTestAddressFormData(&form); | 1240 CreateTestAddressFormData(&form); |
| 1232 std::vector<FormData> forms(1, form); | 1241 std::vector<FormData> forms(1, form); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 | 1416 |
| 1408 // |profile| will be owned by the mock PersonalDataManager. | 1417 // |profile| will be owned by the mock PersonalDataManager. |
| 1409 AutofillProfile* profile = new AutofillProfile; | 1418 AutofillProfile* profile = new AutofillProfile; |
| 1410 autofill_test::SetProfileInfo(profile, "Elvis", "", "Presley", "me@x.com", "", | 1419 autofill_test::SetProfileInfo(profile, "Elvis", "", "Presley", "me@x.com", "", |
| 1411 "", "", "", "", "", "", ""); | 1420 "", "", "", "", "", "", ""); |
| 1412 profile->set_guid("00000000-0000-0000-0000-000000000101"); | 1421 profile->set_guid("00000000-0000-0000-0000-000000000101"); |
| 1413 std::vector<string16> multi_values(2); | 1422 std::vector<string16> multi_values(2); |
| 1414 multi_values[0] = ASCIIToUTF16("Elvis Presley"); | 1423 multi_values[0] = ASCIIToUTF16("Elvis Presley"); |
| 1415 multi_values[1] = ASCIIToUTF16("Elena Love"); | 1424 multi_values[1] = ASCIIToUTF16("Elena Love"); |
| 1416 profile->SetMultiInfo(NAME_FULL, multi_values); | 1425 profile->SetMultiInfo(NAME_FULL, multi_values); |
| 1417 test_personal_data_->ClearAutofillProfiles(); | 1426 personal_data_.ClearAutofillProfiles(); |
| 1418 autofill_manager_->AddProfile(profile); | 1427 autofill_manager_->AddProfile(profile); |
| 1419 | 1428 |
| 1420 { | 1429 { |
| 1421 // Get the first name field. | 1430 // Get the first name field. |
| 1422 // Start out with "E", hoping for either "Elvis" or "Elena. | 1431 // Start out with "E", hoping for either "Elvis" or "Elena. |
| 1423 FormField& field = form.fields[0]; | 1432 FormField& field = form.fields[0]; |
| 1424 field.value = ASCIIToUTF16("E"); | 1433 field.value = ASCIIToUTF16("E"); |
| 1425 field.is_autofilled = false; | 1434 field.is_autofilled = false; |
| 1426 GetAutofillSuggestions(form, field); | 1435 GetAutofillSuggestions(form, field); |
| 1427 | 1436 |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 FormData results; | 1632 FormData results; |
| 1624 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 1633 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 1625 ExpectFilledCreditCardFormElvis(page_id, results, kDefaultPageID, false); | 1634 ExpectFilledCreditCardFormElvis(page_id, results, kDefaultPageID, false); |
| 1626 } | 1635 } |
| 1627 | 1636 |
| 1628 // Test that we correctly fill a credit card form with month input type. | 1637 // Test that we correctly fill a credit card form with month input type. |
| 1629 // 1. year empty, month empty | 1638 // 1. year empty, month empty |
| 1630 TEST_F(AutofillManagerTest, FillCreditCardFormNoYearNoMonth) { | 1639 TEST_F(AutofillManagerTest, FillCreditCardFormNoYearNoMonth) { |
| 1631 // Same as the SetUp(), but generate 4 credit cards with year month | 1640 // Same as the SetUp(), but generate 4 credit cards with year month |
| 1632 // combination. | 1641 // combination. |
| 1633 test_personal_data_->CreateTestCreditCardsYearAndMonth("", ""); | 1642 personal_data_.CreateTestCreditCardsYearAndMonth("", ""); |
| 1634 // Set up our form data. | 1643 // Set up our form data. |
| 1635 FormData form; | 1644 FormData form; |
| 1636 CreateTestCreditCardFormData(&form, true, true); | 1645 CreateTestCreditCardFormData(&form, true, true); |
| 1637 std::vector<FormData> forms(1, form); | 1646 std::vector<FormData> forms(1, form); |
| 1638 FormsSeen(forms); | 1647 FormsSeen(forms); |
| 1639 | 1648 |
| 1640 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); | 1649 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); |
| 1641 GUIDPair empty(std::string(), 0); | 1650 GUIDPair empty(std::string(), 0); |
| 1642 FillAutofillFormData( | 1651 FillAutofillFormData( |
| 1643 kDefaultPageID, form, *form.fields.begin(), | 1652 kDefaultPageID, form, *form.fields.begin(), |
| 1644 autofill_manager_->PackGUIDs(guid, empty)); | 1653 autofill_manager_->PackGUIDs(guid, empty)); |
| 1645 | 1654 |
| 1646 int page_id = 0; | 1655 int page_id = 0; |
| 1647 FormData results; | 1656 FormData results; |
| 1648 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 1657 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 1649 ExpectFilledCreditCardYearMonthWithYearMonth(page_id, results, | 1658 ExpectFilledCreditCardYearMonthWithYearMonth(page_id, results, |
| 1650 kDefaultPageID, false, "", ""); | 1659 kDefaultPageID, false, "", ""); |
| 1651 } | 1660 } |
| 1652 | 1661 |
| 1653 | 1662 |
| 1654 // Test that we correctly fill a credit card form with month input type. | 1663 // Test that we correctly fill a credit card form with month input type. |
| 1655 // 2. year empty, month non-empty | 1664 // 2. year empty, month non-empty |
| 1656 TEST_F(AutofillManagerTest, FillCreditCardFormNoYearMonth) { | 1665 TEST_F(AutofillManagerTest, FillCreditCardFormNoYearMonth) { |
| 1657 // Same as the SetUp(), but generate 4 credit cards with year month | 1666 // Same as the SetUp(), but generate 4 credit cards with year month |
| 1658 // combination. | 1667 // combination. |
| 1659 test_personal_data_->CreateTestCreditCardsYearAndMonth("", "04"); | 1668 personal_data_.CreateTestCreditCardsYearAndMonth("", "04"); |
| 1660 // Set up our form data. | 1669 // Set up our form data. |
| 1661 FormData form; | 1670 FormData form; |
| 1662 CreateTestCreditCardFormData(&form, true, true); | 1671 CreateTestCreditCardFormData(&form, true, true); |
| 1663 std::vector<FormData> forms(1, form); | 1672 std::vector<FormData> forms(1, form); |
| 1664 FormsSeen(forms); | 1673 FormsSeen(forms); |
| 1665 | 1674 |
| 1666 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); | 1675 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); |
| 1667 GUIDPair empty(std::string(), 0); | 1676 GUIDPair empty(std::string(), 0); |
| 1668 FillAutofillFormData( | 1677 FillAutofillFormData( |
| 1669 kDefaultPageID, form, *form.fields.begin(), | 1678 kDefaultPageID, form, *form.fields.begin(), |
| 1670 autofill_manager_->PackGUIDs(guid, empty)); | 1679 autofill_manager_->PackGUIDs(guid, empty)); |
| 1671 | 1680 |
| 1672 int page_id = 0; | 1681 int page_id = 0; |
| 1673 FormData results; | 1682 FormData results; |
| 1674 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 1683 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 1675 ExpectFilledCreditCardYearMonthWithYearMonth(page_id, results, | 1684 ExpectFilledCreditCardYearMonthWithYearMonth(page_id, results, |
| 1676 kDefaultPageID, false, "", "04"); | 1685 kDefaultPageID, false, "", "04"); |
| 1677 } | 1686 } |
| 1678 | 1687 |
| 1679 // Test that we correctly fill a credit card form with month input type. | 1688 // Test that we correctly fill a credit card form with month input type. |
| 1680 // 3. year non-empty, month empty | 1689 // 3. year non-empty, month empty |
| 1681 TEST_F(AutofillManagerTest, FillCreditCardFormYearNoMonth) { | 1690 TEST_F(AutofillManagerTest, FillCreditCardFormYearNoMonth) { |
| 1682 // Same as the SetUp(), but generate 4 credit cards with year month | 1691 // Same as the SetUp(), but generate 4 credit cards with year month |
| 1683 // combination. | 1692 // combination. |
| 1684 test_personal_data_->CreateTestCreditCardsYearAndMonth("2012", ""); | 1693 personal_data_.CreateTestCreditCardsYearAndMonth("2012", ""); |
| 1685 // Set up our form data. | 1694 // Set up our form data. |
| 1686 FormData form; | 1695 FormData form; |
| 1687 CreateTestCreditCardFormData(&form, true, true); | 1696 CreateTestCreditCardFormData(&form, true, true); |
| 1688 std::vector<FormData> forms(1, form); | 1697 std::vector<FormData> forms(1, form); |
| 1689 FormsSeen(forms); | 1698 FormsSeen(forms); |
| 1690 | 1699 |
| 1691 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); | 1700 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); |
| 1692 GUIDPair empty(std::string(), 0); | 1701 GUIDPair empty(std::string(), 0); |
| 1693 FillAutofillFormData( | 1702 FillAutofillFormData( |
| 1694 kDefaultPageID, form, *form.fields.begin(), | 1703 kDefaultPageID, form, *form.fields.begin(), |
| 1695 autofill_manager_->PackGUIDs(guid, empty)); | 1704 autofill_manager_->PackGUIDs(guid, empty)); |
| 1696 | 1705 |
| 1697 int page_id = 0; | 1706 int page_id = 0; |
| 1698 FormData results; | 1707 FormData results; |
| 1699 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 1708 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 1700 ExpectFilledCreditCardYearMonthWithYearMonth(page_id, results, | 1709 ExpectFilledCreditCardYearMonthWithYearMonth(page_id, results, |
| 1701 kDefaultPageID, false, "2012", ""); | 1710 kDefaultPageID, false, "2012", ""); |
| 1702 } | 1711 } |
| 1703 | 1712 |
| 1704 // Test that we correctly fill a credit card form with month input type. | 1713 // Test that we correctly fill a credit card form with month input type. |
| 1705 // 4. year non-empty, month empty | 1714 // 4. year non-empty, month empty |
| 1706 TEST_F(AutofillManagerTest, FillCreditCardFormYearMonth) { | 1715 TEST_F(AutofillManagerTest, FillCreditCardFormYearMonth) { |
| 1707 // Same as the SetUp(), but generate 4 credit cards with year month | 1716 // Same as the SetUp(), but generate 4 credit cards with year month |
| 1708 // combination. | 1717 // combination. |
| 1709 test_personal_data_->ClearCreditCards(); | 1718 personal_data_.ClearCreditCards(); |
| 1710 test_personal_data_->CreateTestCreditCardsYearAndMonth("2012", "04"); | 1719 personal_data_.CreateTestCreditCardsYearAndMonth("2012", "04"); |
| 1711 // Set up our form data. | 1720 // Set up our form data. |
| 1712 FormData form; | 1721 FormData form; |
| 1713 CreateTestCreditCardFormData(&form, true, true); | 1722 CreateTestCreditCardFormData(&form, true, true); |
| 1714 std::vector<FormData> forms(1, form); | 1723 std::vector<FormData> forms(1, form); |
| 1715 FormsSeen(forms); | 1724 FormsSeen(forms); |
| 1716 | 1725 |
| 1717 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); | 1726 GUIDPair guid("00000000-0000-0000-0000-000000000007", 0); |
| 1718 GUIDPair empty(std::string(), 0); | 1727 GUIDPair empty(std::string(), 0); |
| 1719 FillAutofillFormData( | 1728 FillAutofillFormData( |
| 1720 kDefaultPageID, form, *form.fields.begin(), | 1729 kDefaultPageID, form, *form.fields.begin(), |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2293 FillAutofillFormData(kDefaultPageID, form, form.fields[0], | 2302 FillAutofillFormData(kDefaultPageID, form, form.fields[0], |
| 2294 autofill_manager_->PackGUIDs(empty, guid)); | 2303 autofill_manager_->PackGUIDs(empty, guid)); |
| 2295 | 2304 |
| 2296 int page_id = 0; | 2305 int page_id = 0; |
| 2297 FormData results; | 2306 FormData results; |
| 2298 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 2307 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 2299 ExpectFilledAddressFormElvis(page_id, results, kDefaultPageID, false); | 2308 ExpectFilledAddressFormElvis(page_id, results, kDefaultPageID, false); |
| 2300 | 2309 |
| 2301 // Simulate form submission. We should call into the PDM to try to save the | 2310 // Simulate form submission. We should call into the PDM to try to save the |
| 2302 // filled data. | 2311 // filled data. |
| 2303 EXPECT_CALL(*test_personal_data_, SaveImportedProfile(::testing::_)).Times(1); | 2312 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(1); |
| 2304 FormSubmitted(results); | 2313 FormSubmitted(results); |
| 2305 } | 2314 } |
| 2306 | 2315 |
| 2307 // Test that we are able to save form data when forms are submitted and we only | 2316 // Test that we are able to save form data when forms are submitted and we only |
| 2308 // have server data for the field types. | 2317 // have server data for the field types. |
| 2309 TEST_F(AutofillManagerTest, FormSubmittedServerTypes) { | 2318 TEST_F(AutofillManagerTest, FormSubmittedServerTypes) { |
| 2310 // Set up our form data. | 2319 // Set up our form data. |
| 2311 FormData form; | 2320 FormData form; |
| 2312 CreateTestAddressFormData(&form); | 2321 CreateTestAddressFormData(&form); |
| 2313 | 2322 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2331 FillAutofillFormData(kDefaultPageID, form, form.fields[0], | 2340 FillAutofillFormData(kDefaultPageID, form, form.fields[0], |
| 2332 autofill_manager_->PackGUIDs(empty, guid)); | 2341 autofill_manager_->PackGUIDs(empty, guid)); |
| 2333 | 2342 |
| 2334 int page_id = 0; | 2343 int page_id = 0; |
| 2335 FormData results; | 2344 FormData results; |
| 2336 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 2345 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 2337 ExpectFilledAddressFormElvis(page_id, results, kDefaultPageID, false); | 2346 ExpectFilledAddressFormElvis(page_id, results, kDefaultPageID, false); |
| 2338 | 2347 |
| 2339 // Simulate form submission. We should call into the PDM to try to save the | 2348 // Simulate form submission. We should call into the PDM to try to save the |
| 2340 // filled data. | 2349 // filled data. |
| 2341 EXPECT_CALL(*test_personal_data_, SaveImportedProfile(::testing::_)).Times(1); | 2350 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(1); |
| 2342 FormSubmitted(results); | 2351 FormSubmitted(results); |
| 2343 } | 2352 } |
| 2344 | 2353 |
| 2345 // Test that the form signature for an uploaded form always matches the form | 2354 // Test that the form signature for an uploaded form always matches the form |
| 2346 // signature from the query. | 2355 // signature from the query. |
| 2347 TEST_F(AutofillManagerTest, FormSubmittedWithDifferentFields) { | 2356 TEST_F(AutofillManagerTest, FormSubmittedWithDifferentFields) { |
| 2348 // Set up our form data. | 2357 // Set up our form data. |
| 2349 FormData form; | 2358 FormData form; |
| 2350 CreateTestAddressFormData(&form); | 2359 CreateTestAddressFormData(&form); |
| 2351 std::vector<FormData> forms(1, form); | 2360 std::vector<FormData> forms(1, form); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2389 GUIDPair empty(std::string(), 0); | 2398 GUIDPair empty(std::string(), 0); |
| 2390 FillAutofillFormData(kDefaultPageID, form, form.fields[3], | 2399 FillAutofillFormData(kDefaultPageID, form, form.fields[3], |
| 2391 autofill_manager_->PackGUIDs(empty, guid)); | 2400 autofill_manager_->PackGUIDs(empty, guid)); |
| 2392 | 2401 |
| 2393 int page_id = 0; | 2402 int page_id = 0; |
| 2394 FormData results; | 2403 FormData results; |
| 2395 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); | 2404 EXPECT_TRUE(GetAutofillFormDataFilledMessage(&page_id, &results)); |
| 2396 | 2405 |
| 2397 // Simulate form submission. We should call into the PDM to try to save the | 2406 // Simulate form submission. We should call into the PDM to try to save the |
| 2398 // filled data. | 2407 // filled data. |
| 2399 EXPECT_CALL(*test_personal_data_, SaveImportedProfile(::testing::_)).Times(1); | 2408 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(1); |
| 2400 FormSubmitted(results); | 2409 FormSubmitted(results); |
| 2401 | 2410 |
| 2402 // Set the address field's value back to the default value. | 2411 // Set the address field's value back to the default value. |
| 2403 results.fields[3].value = ASCIIToUTF16("Enter your address"); | 2412 results.fields[3].value = ASCIIToUTF16("Enter your address"); |
| 2404 | 2413 |
| 2405 // Simulate form submission. We should not call into the PDM to try to save | 2414 // Simulate form submission. We should not call into the PDM to try to save |
| 2406 // the filled data, since the filled form is effectively missing an address. | 2415 // the filled data, since the filled form is effectively missing an address. |
| 2407 EXPECT_CALL(*test_personal_data_, SaveImportedProfile(::testing::_)).Times(0); | 2416 EXPECT_CALL(personal_data_, SaveImportedProfile(::testing::_)).Times(0); |
| 2408 FormSubmitted(results); | 2417 FormSubmitted(results); |
| 2409 } | 2418 } |
| 2410 | 2419 |
| 2411 // Checks that resetting the auxiliary profile enabled preference does the right | 2420 // Checks that resetting the auxiliary profile enabled preference does the right |
| 2412 // thing on all platforms. | 2421 // thing on all platforms. |
| 2413 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { | 2422 TEST_F(AutofillManagerTest, AuxiliaryProfilesReset) { |
| 2414 #if defined(OS_MACOSX) | 2423 #if defined(OS_MACOSX) |
| 2415 // Auxiliary profiles is implemented on Mac only. It enables Mac Address | 2424 // Auxiliary profiles is implemented on Mac only. It enables Mac Address |
| 2416 // Book integration. | 2425 // Book integration. |
| 2417 ASSERT_TRUE(profile()->GetPrefs()->GetBoolean( | 2426 ASSERT_TRUE(profile()->GetPrefs()->GetBoolean( |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2720 EXPECT_EQ(expected_types[i].size(), possible_types.size()); | 2729 EXPECT_EQ(expected_types[i].size(), possible_types.size()); |
| 2721 for (FieldTypeSet::const_iterator it = expected_types[i].begin(); | 2730 for (FieldTypeSet::const_iterator it = expected_types[i].begin(); |
| 2722 it != expected_types[i].end(); ++it) { | 2731 it != expected_types[i].end(); ++it) { |
| 2723 EXPECT_TRUE(possible_types.count(*it)) | 2732 EXPECT_TRUE(possible_types.count(*it)) |
| 2724 << "Expected type: " << AutofillType::FieldTypeToString(*it); | 2733 << "Expected type: " << AutofillType::FieldTypeToString(*it); |
| 2725 } | 2734 } |
| 2726 } | 2735 } |
| 2727 } | 2736 } |
| 2728 | 2737 |
| 2729 TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUploadStressTest) { | 2738 TEST_F(AutofillManagerTest, DeterminePossibleFieldTypesForUploadStressTest) { |
| 2730 test_personal_data_->ClearAutofillProfiles(); | 2739 personal_data_.ClearAutofillProfiles(); |
| 2731 const int kNumProfiles = 5; | 2740 const int kNumProfiles = 5; |
| 2732 for (int i = 0; i < kNumProfiles; ++i) { | 2741 for (int i = 0; i < kNumProfiles; ++i) { |
| 2733 AutofillProfile* profile = new AutofillProfile; | 2742 AutofillProfile* profile = new AutofillProfile; |
| 2734 autofill_test::SetProfileInfo(profile, | 2743 autofill_test::SetProfileInfo(profile, |
| 2735 StringPrintf("John%d", i).c_str(), | 2744 StringPrintf("John%d", i).c_str(), |
| 2736 "", | 2745 "", |
| 2737 StringPrintf("Doe%d", i).c_str(), | 2746 StringPrintf("Doe%d", i).c_str(), |
| 2738 StringPrintf("JohnDoe%d@somesite.com", | 2747 StringPrintf("JohnDoe%d@somesite.com", |
| 2739 i).c_str(), | 2748 i).c_str(), |
| 2740 "", | 2749 "", |
| 2741 StringPrintf("%d 1st st.", i).c_str(), | 2750 StringPrintf("%d 1st st.", i).c_str(), |
| 2742 "", | 2751 "", |
| 2743 "Memphis", "Tennessee", "38116", "USA", | 2752 "Memphis", "Tennessee", "38116", "USA", |
| 2744 StringPrintf("650234%04d", i).c_str()); | 2753 StringPrintf("650234%04d", i).c_str()); |
| 2745 profile->set_guid( | 2754 profile->set_guid( |
| 2746 StringPrintf("00000000-0000-0000-0001-00000000%04d", i).c_str()); | 2755 StringPrintf("00000000-0000-0000-0001-00000000%04d", i).c_str()); |
| 2747 test_personal_data_->AddProfile(profile); | 2756 personal_data_.AddProfile(profile); |
| 2748 } | 2757 } |
| 2749 FormData form; | 2758 FormData form; |
| 2750 CreateTestAddressFormData(&form); | 2759 CreateTestAddressFormData(&form); |
| 2751 ASSERT_LT(3U, form.fields.size()); | 2760 ASSERT_LT(3U, form.fields.size()); |
| 2752 form.fields[0].value = ASCIIToUTF16("6502340001"); | 2761 form.fields[0].value = ASCIIToUTF16("6502340001"); |
| 2753 form.fields[1].value = ASCIIToUTF16("John1"); | 2762 form.fields[1].value = ASCIIToUTF16("John1"); |
| 2754 form.fields[2].value = ASCIIToUTF16("12345"); | 2763 form.fields[2].value = ASCIIToUTF16("12345"); |
| 2755 FormStructure form_structure(form); | 2764 FormStructure form_structure(form); |
| 2756 autofill_manager_->DeterminePossibleFieldTypesForUpload(&form_structure); | 2765 autofill_manager_->DeterminePossibleFieldTypesForUpload(&form_structure); |
| 2757 ASSERT_LT(3U, form_structure.field_count()); | 2766 ASSERT_LT(3U, form_structure.field_count()); |
| 2758 const FieldTypeSet& possible_types0 = | 2767 const FieldTypeSet& possible_types0 = |
| 2759 form_structure.field(0)->possible_types(); | 2768 form_structure.field(0)->possible_types(); |
| 2760 EXPECT_EQ(2U, possible_types0.size()); | 2769 EXPECT_EQ(2U, possible_types0.size()); |
| 2761 EXPECT_TRUE(possible_types0.find(PHONE_HOME_WHOLE_NUMBER) != | 2770 EXPECT_TRUE(possible_types0.find(PHONE_HOME_WHOLE_NUMBER) != |
| 2762 possible_types0.end()); | 2771 possible_types0.end()); |
| 2763 EXPECT_TRUE(possible_types0.find(PHONE_HOME_CITY_AND_NUMBER) != | 2772 EXPECT_TRUE(possible_types0.find(PHONE_HOME_CITY_AND_NUMBER) != |
| 2764 possible_types0.end()); | 2773 possible_types0.end()); |
| 2765 const FieldTypeSet& possible_types1 = | 2774 const FieldTypeSet& possible_types1 = |
| 2766 form_structure.field(1)->possible_types(); | 2775 form_structure.field(1)->possible_types(); |
| 2767 EXPECT_EQ(1U, possible_types1.size()); | 2776 EXPECT_EQ(1U, possible_types1.size()); |
| 2768 EXPECT_TRUE(possible_types1.find(NAME_FIRST) != possible_types1.end()); | 2777 EXPECT_TRUE(possible_types1.find(NAME_FIRST) != possible_types1.end()); |
| 2769 const FieldTypeSet& possible_types2 = | 2778 const FieldTypeSet& possible_types2 = |
| 2770 form_structure.field(2)->possible_types(); | 2779 form_structure.field(2)->possible_types(); |
| 2771 EXPECT_EQ(1U, possible_types2.size()); | 2780 EXPECT_EQ(1U, possible_types2.size()); |
| 2772 EXPECT_TRUE(possible_types2.find(UNKNOWN_TYPE) != | 2781 EXPECT_TRUE(possible_types2.find(UNKNOWN_TYPE) != |
| 2773 possible_types2.end()); | 2782 possible_types2.end()); |
| 2774 } | 2783 } |
| OLD | NEW |