| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ref_counted.h" | 7 #include "base/ref_counted.h" |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/scoped_vector.h" | 9 #include "base/scoped_vector.h" |
| 10 #include "base/string16.h" | 10 #include "base/string16.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class TestPersonalDataManager : public PersonalDataManager { | 38 class TestPersonalDataManager : public PersonalDataManager { |
| 39 public: | 39 public: |
| 40 TestPersonalDataManager() { | 40 TestPersonalDataManager() { |
| 41 CreateTestAutoFillProfiles(&web_profiles_); | 41 CreateTestAutoFillProfiles(&web_profiles_); |
| 42 CreateTestCreditCards(&credit_cards_); | 42 CreateTestCreditCards(&credit_cards_); |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual void InitializeIfNeeded() {} | 45 virtual void InitializeIfNeeded() {} |
| 46 virtual void SaveImportedFormData() {} | 46 virtual void SaveImportedFormData() {} |
| 47 virtual bool IsDataLoaded() const { return true; } |
| 47 | 48 |
| 48 AutoFillProfile* GetLabeledProfile(const char* label) { | 49 AutoFillProfile* GetLabeledProfile(const char* label) { |
| 49 for (std::vector<AutoFillProfile *>::iterator it = web_profiles_.begin(); | 50 for (std::vector<AutoFillProfile *>::iterator it = web_profiles_.begin(); |
| 50 it != web_profiles_.end(); ++it) { | 51 it != web_profiles_.end(); ++it) { |
| 51 if (!(*it)->Label().compare(ASCIIToUTF16(label))) | 52 if (!(*it)->Label().compare(ASCIIToUTF16(label))) |
| 52 return *it; | 53 return *it; |
| 53 } | 54 } |
| 54 return NULL; | 55 return NULL; |
| 55 } | 56 } |
| 56 | 57 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 "", ""); | 102 "", ""); |
| 102 credit_card->set_unique_id(6); | 103 credit_card->set_unique_id(6); |
| 103 credit_cards->push_back(credit_card); | 104 credit_cards->push_back(credit_card); |
| 104 } | 105 } |
| 105 | 106 |
| 106 DISALLOW_COPY_AND_ASSIGN(TestPersonalDataManager); | 107 DISALLOW_COPY_AND_ASSIGN(TestPersonalDataManager); |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 class TestAutoFillManager : public AutoFillManager { | 110 class TestAutoFillManager : public AutoFillManager { |
| 110 public: | 111 public: |
| 111 explicit TestAutoFillManager(TabContents* tab_contents) | 112 TestAutoFillManager(TabContents* tab_contents, |
| 113 TestPersonalDataManager* personal_manager) |
| 112 : AutoFillManager(tab_contents, NULL) { | 114 : AutoFillManager(tab_contents, NULL) { |
| 113 test_personal_data_ = new TestPersonalDataManager(); | 115 test_personal_data_ = personal_manager; |
| 114 set_personal_data_manager(test_personal_data_.get()); | 116 set_personal_data_manager(personal_manager); |
| 117 // Download manager requests are disabled for purposes of this unit-test. |
| 118 // These request are tested in autofill_download_unittest.cc. |
| 119 set_disable_download_manager_requests(true); |
| 115 } | 120 } |
| 116 | 121 |
| 117 virtual bool IsAutoFillEnabled() const { return true; } | 122 virtual bool IsAutoFillEnabled() const { return true; } |
| 118 | 123 |
| 119 AutoFillProfile* GetLabeledProfile(const char* label) { | 124 AutoFillProfile* GetLabeledProfile(const char* label) { |
| 120 return test_personal_data_->GetLabeledProfile(label); | 125 return test_personal_data_->GetLabeledProfile(label); |
| 121 } | 126 } |
| 122 | 127 |
| 123 void AddProfile(AutoFillProfile* profile) { | 128 void AddProfile(AutoFillProfile* profile) { |
| 124 test_personal_data_->AddProfile(profile); | 129 test_personal_data_->AddProfile(profile); |
| 125 } | 130 } |
| 126 | 131 |
| 127 private: | 132 private: |
| 128 scoped_refptr<TestPersonalDataManager> test_personal_data_; | 133 TestPersonalDataManager* test_personal_data_; |
| 129 | 134 |
| 130 DISALLOW_COPY_AND_ASSIGN(TestAutoFillManager); | 135 DISALLOW_COPY_AND_ASSIGN(TestAutoFillManager); |
| 131 }; | 136 }; |
| 132 | 137 |
| 133 void CreateTestFormData(FormData* form) { | 138 void CreateTestFormData(FormData* form) { |
| 134 form->name = ASCIIToUTF16("MyForm"); | 139 form->name = ASCIIToUTF16("MyForm"); |
| 135 form->method = ASCIIToUTF16("POST"); | 140 form->method = ASCIIToUTF16("POST"); |
| 136 form->origin = GURL("http://myform.com/form.html"); | 141 form->origin = GURL("http://myform.com/form.html"); |
| 137 form->action = GURL("http://myform.com/submit.html"); | 142 form->action = GURL("http://myform.com/submit.html"); |
| 138 form->user_submitted = true; | 143 form->user_submitted = true; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 "Expiration Date", "ccmonth", "", "text", &field); | 229 "Expiration Date", "ccmonth", "", "text", &field); |
| 225 form->fields.push_back(field); | 230 form->fields.push_back(field); |
| 226 autofill_unittest::CreateTestFormField( | 231 autofill_unittest::CreateTestFormField( |
| 227 "", "ccyear", "", "text", &field); | 232 "", "ccyear", "", "text", &field); |
| 228 form->fields.push_back(field); | 233 form->fields.push_back(field); |
| 229 } | 234 } |
| 230 | 235 |
| 231 class AutoFillManagerTest : public RenderViewHostTestHarness { | 236 class AutoFillManagerTest : public RenderViewHostTestHarness { |
| 232 public: | 237 public: |
| 233 AutoFillManagerTest() {} | 238 AutoFillManagerTest() {} |
| 239 virtual ~AutoFillManagerTest() { |
| 240 // Order of destruction is important as AutoFillManager relies on |
| 241 // PersonalDataManager to be around when it gets destroyed. |
| 242 autofill_manager_.reset(NULL); |
| 243 test_personal_data_ = NULL; |
| 244 } |
| 234 | 245 |
| 235 virtual void SetUp() { | 246 virtual void SetUp() { |
| 236 RenderViewHostTestHarness::SetUp(); | 247 RenderViewHostTestHarness::SetUp(); |
| 237 autofill_manager_.reset(new TestAutoFillManager(contents())); | 248 test_personal_data_ = new TestPersonalDataManager(); |
| 249 autofill_manager_.reset(new TestAutoFillManager(contents(), |
| 250 test_personal_data_.get())); |
| 238 } | 251 } |
| 239 | 252 |
| 240 Profile* profile() { return contents()->profile(); } | 253 Profile* profile() { return contents()->profile(); } |
| 241 | 254 |
| 242 bool GetAutoFillSuggestionsMessage(int* page_id, | 255 bool GetAutoFillSuggestionsMessage(int* page_id, |
| 243 std::vector<string16>* values, | 256 std::vector<string16>* values, |
| 244 std::vector<string16>* labels) { | 257 std::vector<string16>* labels) { |
| 245 const uint32 kMsgID = ViewMsg_AutoFillSuggestionsReturned::ID; | 258 const uint32 kMsgID = ViewMsg_AutoFillSuggestionsReturned::ID; |
| 246 const IPC::Message* message = | 259 const IPC::Message* message = |
| 247 process()->sink().GetFirstMessageMatching(kMsgID); | 260 process()->sink().GetFirstMessageMatching(kMsgID); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 269 ViewMsg_AutoFillFormDataFilled::Read(message, &autofill_param); | 282 ViewMsg_AutoFillFormDataFilled::Read(message, &autofill_param); |
| 270 if (page_id) | 283 if (page_id) |
| 271 *page_id = autofill_param.a; | 284 *page_id = autofill_param.a; |
| 272 if (results) | 285 if (results) |
| 273 *results = autofill_param.b; | 286 *results = autofill_param.b; |
| 274 return true; | 287 return true; |
| 275 } | 288 } |
| 276 | 289 |
| 277 protected: | 290 protected: |
| 278 scoped_ptr<TestAutoFillManager> autofill_manager_; | 291 scoped_ptr<TestAutoFillManager> autofill_manager_; |
| 292 scoped_refptr<TestPersonalDataManager> test_personal_data_; |
| 279 | 293 |
| 280 private: | 294 private: |
| 281 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); | 295 DISALLOW_COPY_AND_ASSIGN(AutoFillManagerTest); |
| 282 }; | 296 }; |
| 283 | 297 |
| 284 // TODO(georgey): All of these tests crash in official | 298 TEST_F(AutoFillManagerTest, GetProfileSuggestionsEmptyValue) { |
| 285 // builds. http://crbug.com/50537 | |
| 286 #if defined(GOOGLE_CHROME_BUILD) | |
| 287 #define SKIP_BRANDED(test) DISABLED_##test | |
| 288 #else | |
| 289 #define SKIP_BRANDED(test) test | |
| 290 #endif | |
| 291 | |
| 292 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetProfileSuggestionsEmptyValue)) { | |
| 293 FormData form; | 299 FormData form; |
| 294 CreateTestFormData(&form); | 300 CreateTestFormData(&form); |
| 295 | 301 |
| 296 // Set up our FormStructures. | 302 // Set up our FormStructures. |
| 297 std::vector<FormData> forms; | 303 std::vector<FormData> forms; |
| 298 forms.push_back(form); | 304 forms.push_back(form); |
| 299 autofill_manager_->FormsSeen(forms); | 305 autofill_manager_->FormsSeen(forms); |
| 300 | 306 |
| 301 // The page ID sent to the AutoFillManager from the RenderView, used to send | 307 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 302 // an IPC message back to the renderer. | 308 // an IPC message back to the renderer. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 320 ASSERT_EQ(2U, values.size()); | 326 ASSERT_EQ(2U, values.size()); |
| 321 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 327 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
| 322 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 328 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
| 323 ASSERT_EQ(2U, labels.size()); | 329 ASSERT_EQ(2U, labels.size()); |
| 324 // Inferred labels now include full first relevant field, which in this case | 330 // Inferred labels now include full first relevant field, which in this case |
| 325 // the address #1. | 331 // the address #1. |
| 326 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); | 332 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); |
| 327 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); | 333 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); |
| 328 } | 334 } |
| 329 | 335 |
| 330 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetProfileSuggestionsMatchCharacter)) { | 336 TEST_F(AutoFillManagerTest, GetProfileSuggestionsMatchCharacter) { |
| 331 FormData form; | 337 FormData form; |
| 332 CreateTestFormData(&form); | 338 CreateTestFormData(&form); |
| 333 | 339 |
| 334 // Set up our FormStructures. | 340 // Set up our FormStructures. |
| 335 std::vector<FormData> forms; | 341 std::vector<FormData> forms; |
| 336 forms.push_back(form); | 342 forms.push_back(form); |
| 337 autofill_manager_->FormsSeen(forms); | 343 autofill_manager_->FormsSeen(forms); |
| 338 | 344 |
| 339 // The page ID sent to the AutoFillManager from the RenderView, used to send | 345 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 340 // an IPC message back to the renderer. | 346 // an IPC message back to the renderer. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 354 std::vector<string16> values; | 360 std::vector<string16> values; |
| 355 std::vector<string16> labels; | 361 std::vector<string16> labels; |
| 356 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 362 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
| 357 EXPECT_EQ(kPageID, page_id); | 363 EXPECT_EQ(kPageID, page_id); |
| 358 ASSERT_EQ(1U, values.size()); | 364 ASSERT_EQ(1U, values.size()); |
| 359 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 365 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
| 360 ASSERT_EQ(1U, labels.size()); | 366 ASSERT_EQ(1U, labels.size()); |
| 361 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); | 367 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); |
| 362 } | 368 } |
| 363 | 369 |
| 364 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsEmptyValue)) { | 370 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsEmptyValue) { |
| 365 FormData form; | 371 FormData form; |
| 366 CreateTestFormDataBilling(&form); | 372 CreateTestFormDataBilling(&form); |
| 367 | 373 |
| 368 // Set up our FormStructures. | 374 // Set up our FormStructures. |
| 369 std::vector<FormData> forms; | 375 std::vector<FormData> forms; |
| 370 forms.push_back(form); | 376 forms.push_back(form); |
| 371 autofill_manager_->FormsSeen(forms); | 377 autofill_manager_->FormsSeen(forms); |
| 372 | 378 |
| 373 // The page ID sent to the AutoFillManager from the RenderView, used to send | 379 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 374 // an IPC message back to the renderer. | 380 // an IPC message back to the renderer. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 398 EXPECT_EQ(ASCIIToUTF16("************8765"), values[5]); | 404 EXPECT_EQ(ASCIIToUTF16("************8765"), values[5]); |
| 399 ASSERT_EQ(6U, labels.size()); | 405 ASSERT_EQ(6U, labels.size()); |
| 400 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); | 406 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); |
| 401 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); | 407 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); |
| 402 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); | 408 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); |
| 403 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *8765"), labels[3]); | 409 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *8765"), labels[3]); |
| 404 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[4]); | 410 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[4]); |
| 405 EXPECT_EQ(ASCIIToUTF16("*8765"), labels[5]); | 411 EXPECT_EQ(ASCIIToUTF16("*8765"), labels[5]); |
| 406 } | 412 } |
| 407 | 413 |
| 408 TEST_F(AutoFillManagerTest, | 414 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsMatchCharacter) { |
| 409 SKIP_BRANDED(GetCreditCardSuggestionsMatchCharacter)) { | |
| 410 FormData form; | 415 FormData form; |
| 411 CreateTestFormDataBilling(&form); | 416 CreateTestFormDataBilling(&form); |
| 412 | 417 |
| 413 // Set up our FormStructures. | 418 // Set up our FormStructures. |
| 414 std::vector<FormData> forms; | 419 std::vector<FormData> forms; |
| 415 forms.push_back(form); | 420 forms.push_back(form); |
| 416 autofill_manager_->FormsSeen(forms); | 421 autofill_manager_->FormsSeen(forms); |
| 417 | 422 |
| 418 // The page ID sent to the AutoFillManager from the RenderView, used to send | 423 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 419 // an IPC message back to the renderer. | 424 // an IPC message back to the renderer. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 437 ASSERT_EQ(3U, values.size()); | 442 ASSERT_EQ(3U, values.size()); |
| 438 EXPECT_EQ(ASCIIToUTF16("************3456"), values[0]); | 443 EXPECT_EQ(ASCIIToUTF16("************3456"), values[0]); |
| 439 EXPECT_EQ(ASCIIToUTF16("************3456"), values[1]); | 444 EXPECT_EQ(ASCIIToUTF16("************3456"), values[1]); |
| 440 EXPECT_EQ(ASCIIToUTF16("************3456"), values[2]); | 445 EXPECT_EQ(ASCIIToUTF16("************3456"), values[2]); |
| 441 ASSERT_EQ(3U, labels.size()); | 446 ASSERT_EQ(3U, labels.size()); |
| 442 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); | 447 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); |
| 443 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); | 448 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); |
| 444 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); | 449 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); |
| 445 } | 450 } |
| 446 | 451 |
| 447 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsNonCCNumber)) { | 452 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonCCNumber) { |
| 448 FormData form; | 453 FormData form; |
| 449 CreateTestFormDataBilling(&form); | 454 CreateTestFormDataBilling(&form); |
| 450 | 455 |
| 451 // Set up our FormStructures. | 456 // Set up our FormStructures. |
| 452 std::vector<FormData> forms; | 457 std::vector<FormData> forms; |
| 453 forms.push_back(form); | 458 forms.push_back(form); |
| 454 autofill_manager_->FormsSeen(forms); | 459 autofill_manager_->FormsSeen(forms); |
| 455 | 460 |
| 456 // The page ID sent to the AutoFillManager from the RenderView, used to send | 461 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 457 // an IPC message back to the renderer. | 462 // an IPC message back to the renderer. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 481 EXPECT_EQ(ASCIIToUTF16("Buddy Holly"), values[5]); | 486 EXPECT_EQ(ASCIIToUTF16("Buddy Holly"), values[5]); |
| 482 ASSERT_EQ(6U, labels.size()); | 487 ASSERT_EQ(6U, labels.size()); |
| 483 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); | 488 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); |
| 484 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); | 489 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); |
| 485 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); | 490 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); |
| 486 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *8765"), labels[3]); | 491 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *8765"), labels[3]); |
| 487 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[4]); | 492 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[4]); |
| 488 EXPECT_EQ(ASCIIToUTF16("*8765"), labels[5]); | 493 EXPECT_EQ(ASCIIToUTF16("*8765"), labels[5]); |
| 489 } | 494 } |
| 490 | 495 |
| 491 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsSemicolon)) { | 496 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsSemicolon) { |
| 492 // |profile| will be owned by the mock PersonalDataManager. | 497 // |profile| will be owned by the mock PersonalDataManager. |
| 493 AutoFillProfile* profile = new AutoFillProfile; | 498 AutoFillProfile* profile = new AutoFillProfile; |
| 494 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", | 499 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", |
| 495 "flatlander@gmail.com", "MCA", | 500 "flatlander@gmail.com", "MCA", |
| 496 "916 16th St.", "Apt. 6", "Lubbock", | 501 "916 16th St.", "Apt. 6", "Lubbock", |
| 497 "Texas", "79401", "USA", | 502 "Texas", "79401", "USA", |
| 498 "12345678901", ""); | 503 "12345678901", ""); |
| 499 autofill_manager_->AddProfile(profile); | 504 autofill_manager_->AddProfile(profile); |
| 500 | 505 |
| 501 FormData form; | 506 FormData form; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); | 543 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); |
| 539 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); | 544 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *3456"), labels[1]); |
| 540 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); | 545 EXPECT_EQ(ASCIIToUTF16("*3456"), labels[2]); |
| 541 EXPECT_EQ(ASCIIToUTF16("Joe Ely; *3456"), labels[3]); | 546 EXPECT_EQ(ASCIIToUTF16("Joe Ely; *3456"), labels[3]); |
| 542 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *8765"), labels[4]); | 547 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *8765"), labels[4]); |
| 543 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[5]); | 548 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[5]); |
| 544 EXPECT_EQ(ASCIIToUTF16("*8765"), labels[6]); | 549 EXPECT_EQ(ASCIIToUTF16("*8765"), labels[6]); |
| 545 EXPECT_EQ(ASCIIToUTF16("Joe Ely; *8765"), labels[7]); | 550 EXPECT_EQ(ASCIIToUTF16("Joe Ely; *8765"), labels[7]); |
| 546 } | 551 } |
| 547 | 552 |
| 548 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetCreditCardSuggestionsNonHTTPS)) { | 553 TEST_F(AutoFillManagerTest, GetCreditCardSuggestionsNonHTTPS) { |
| 549 FormData form; | 554 FormData form; |
| 550 CreateTestFormDataBilling(&form); | 555 CreateTestFormDataBilling(&form); |
| 551 form.origin = GURL("http://myform.com/form.html"); | 556 form.origin = GURL("http://myform.com/form.html"); |
| 552 | 557 |
| 553 // Set up our FormStructures. | 558 // Set up our FormStructures. |
| 554 std::vector<FormData> forms; | 559 std::vector<FormData> forms; |
| 555 forms.push_back(form); | 560 forms.push_back(form); |
| 556 autofill_manager_->FormsSeen(forms); | 561 autofill_manager_->FormsSeen(forms); |
| 557 | 562 |
| 558 // The page ID sent to the AutoFillManager from the RenderView, used to send | 563 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 559 // an IPC message back to the renderer. | 564 // an IPC message back to the renderer. |
| 560 const int kPageID = 1; | 565 const int kPageID = 1; |
| 561 | 566 |
| 562 webkit_glue::FormField field; | 567 webkit_glue::FormField field; |
| 563 autofill_unittest::CreateTestFormField( | 568 autofill_unittest::CreateTestFormField( |
| 564 "Card Number", "cardnumber", "", "text", &field); | 569 "Card Number", "cardnumber", "", "text", &field); |
| 565 EXPECT_FALSE( | 570 EXPECT_FALSE( |
| 566 autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); | 571 autofill_manager_->GetAutoFillSuggestions(kPageID, false, field)); |
| 567 } | 572 } |
| 568 | 573 |
| 569 TEST_F(AutoFillManagerTest, | 574 TEST_F(AutoFillManagerTest, GetCombinedAutoFillAndAutocompleteSuggestions) { |
| 570 SKIP_BRANDED(GetCombinedAutoFillAndAutocompleteSuggestions)) { | |
| 571 FormData form; | 575 FormData form; |
| 572 CreateTestFormData(&form); | 576 CreateTestFormData(&form); |
| 573 | 577 |
| 574 // Set up our FormStructures. | 578 // Set up our FormStructures. |
| 575 std::vector<FormData> forms; | 579 std::vector<FormData> forms; |
| 576 forms.push_back(form); | 580 forms.push_back(form); |
| 577 autofill_manager_->FormsSeen(forms); | 581 autofill_manager_->FormsSeen(forms); |
| 578 | 582 |
| 579 // The page ID sent to the AutoFillManager from the RenderView, used to send | 583 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 580 // an IPC message back to the renderer. | 584 // an IPC message back to the renderer. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 603 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 607 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
| 604 EXPECT_EQ(ASCIIToUTF16("Jay"), values[2]); | 608 EXPECT_EQ(ASCIIToUTF16("Jay"), values[2]); |
| 605 EXPECT_EQ(ASCIIToUTF16("Jason"), values[3]); | 609 EXPECT_EQ(ASCIIToUTF16("Jason"), values[3]); |
| 606 ASSERT_EQ(4U, labels.size()); | 610 ASSERT_EQ(4U, labels.size()); |
| 607 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); | 611 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), labels[0]); |
| 608 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); | 612 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), labels[1]); |
| 609 EXPECT_EQ(string16(), labels[2]); | 613 EXPECT_EQ(string16(), labels[2]); |
| 610 EXPECT_EQ(string16(), labels[3]); | 614 EXPECT_EQ(string16(), labels[3]); |
| 611 } | 615 } |
| 612 | 616 |
| 613 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetFieldSuggestionsFormIsAutoFilled)) { | 617 TEST_F(AutoFillManagerTest, GetFieldSuggestionsFormIsAutoFilled) { |
| 614 FormData form; | 618 FormData form; |
| 615 CreateTestFormData(&form); | 619 CreateTestFormData(&form); |
| 616 | 620 |
| 617 // Set up our FormStructures. | 621 // Set up our FormStructures. |
| 618 std::vector<FormData> forms; | 622 std::vector<FormData> forms; |
| 619 forms.push_back(form); | 623 forms.push_back(form); |
| 620 autofill_manager_->FormsSeen(forms); | 624 autofill_manager_->FormsSeen(forms); |
| 621 | 625 |
| 622 // The page ID sent to the AutoFillManager from the RenderView, used to send | 626 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 623 // an IPC message back to the renderer. | 627 // an IPC message back to the renderer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 639 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 643 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
| 640 EXPECT_EQ(kPageID, page_id); | 644 EXPECT_EQ(kPageID, page_id); |
| 641 ASSERT_EQ(2U, values.size()); | 645 ASSERT_EQ(2U, values.size()); |
| 642 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 646 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
| 643 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 647 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
| 644 ASSERT_EQ(2U, labels.size()); | 648 ASSERT_EQ(2U, labels.size()); |
| 645 EXPECT_EQ(string16(), labels[0]); | 649 EXPECT_EQ(string16(), labels[0]); |
| 646 EXPECT_EQ(string16(), labels[1]); | 650 EXPECT_EQ(string16(), labels[1]); |
| 647 } | 651 } |
| 648 | 652 |
| 649 TEST_F(AutoFillManagerTest, | 653 TEST_F(AutoFillManagerTest, GetFieldSuggestionsForAutocompleteOnly) { |
| 650 SKIP_BRANDED(GetFieldSuggestionsForAutocompleteOnly)) { | |
| 651 FormData form; | 654 FormData form; |
| 652 CreateTestFormData(&form); | 655 CreateTestFormData(&form); |
| 653 | 656 |
| 654 // Set up our FormStructures. | 657 // Set up our FormStructures. |
| 655 std::vector<FormData> forms; | 658 std::vector<FormData> forms; |
| 656 forms.push_back(form); | 659 forms.push_back(form); |
| 657 autofill_manager_->FormsSeen(forms); | 660 autofill_manager_->FormsSeen(forms); |
| 658 | 661 |
| 659 // The page ID sent to the AutoFillManager from the RenderView, used to send | 662 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 660 // an IPC message back to the renderer. | 663 // an IPC message back to the renderer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 676 // Test that we sent the right message to the renderer. | 679 // Test that we sent the right message to the renderer. |
| 677 int page_id = 0; | 680 int page_id = 0; |
| 678 std::vector<string16> values; | 681 std::vector<string16> values; |
| 679 std::vector<string16> labels; | 682 std::vector<string16> labels; |
| 680 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 683 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
| 681 EXPECT_EQ(kAlternatePageID, page_id); | 684 EXPECT_EQ(kAlternatePageID, page_id); |
| 682 ASSERT_EQ(0U, values.size()); | 685 ASSERT_EQ(0U, values.size()); |
| 683 ASSERT_EQ(0U, labels.size()); | 686 ASSERT_EQ(0U, labels.size()); |
| 684 } | 687 } |
| 685 | 688 |
| 686 TEST_F(AutoFillManagerTest, | 689 TEST_F(AutoFillManagerTest, GetFieldSuggestionsWithDuplicateValues) { |
| 687 SKIP_BRANDED(GetFieldSuggestionsWithDuplicateValues)) { | |
| 688 FormData form; | 690 FormData form; |
| 689 CreateTestFormData(&form); | 691 CreateTestFormData(&form); |
| 690 | 692 |
| 691 // Set up our FormStructures. | 693 // Set up our FormStructures. |
| 692 std::vector<FormData> forms; | 694 std::vector<FormData> forms; |
| 693 forms.push_back(form); | 695 forms.push_back(form); |
| 694 autofill_manager_->FormsSeen(forms); | 696 autofill_manager_->FormsSeen(forms); |
| 695 | 697 |
| 696 // |profile| will be owned by the mock PersonalDataManager. | 698 // |profile| will be owned by the mock PersonalDataManager. |
| 697 AutoFillProfile* profile = new AutoFillProfile; | 699 AutoFillProfile* profile = new AutoFillProfile; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 719 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 721 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
| 720 EXPECT_EQ(kPageID, page_id); | 722 EXPECT_EQ(kPageID, page_id); |
| 721 ASSERT_EQ(2U, values.size()); | 723 ASSERT_EQ(2U, values.size()); |
| 722 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); | 724 EXPECT_EQ(ASCIIToUTF16("Elvis"), values[0]); |
| 723 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); | 725 EXPECT_EQ(ASCIIToUTF16("Charles"), values[1]); |
| 724 ASSERT_EQ(2U, labels.size()); | 726 ASSERT_EQ(2U, labels.size()); |
| 725 EXPECT_EQ(string16(), labels[0]); | 727 EXPECT_EQ(string16(), labels[0]); |
| 726 EXPECT_EQ(string16(), labels[1]); | 728 EXPECT_EQ(string16(), labels[1]); |
| 727 } | 729 } |
| 728 | 730 |
| 729 TEST_F(AutoFillManagerTest, SKIP_BRANDED(GetBillingSuggestionsAddress1)) { | 731 TEST_F(AutoFillManagerTest, GetBillingSuggestionsAddress1) { |
| 730 FormData form; | 732 FormData form; |
| 731 CreateTestFormDataBilling(&form); | 733 CreateTestFormDataBilling(&form); |
| 732 | 734 |
| 733 // Set up our FormStructures. | 735 // Set up our FormStructures. |
| 734 std::vector<FormData> forms; | 736 std::vector<FormData> forms; |
| 735 forms.push_back(form); | 737 forms.push_back(form); |
| 736 autofill_manager_->FormsSeen(forms); | 738 autofill_manager_->FormsSeen(forms); |
| 737 | 739 |
| 738 // The page ID sent to the AutoFillManager from the RenderView, used to send | 740 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 739 // an IPC message back to the renderer. | 741 // an IPC message back to the renderer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 755 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); | 757 EXPECT_TRUE(GetAutoFillSuggestionsMessage(&page_id, &values, &labels)); |
| 756 EXPECT_EQ(kPageID, page_id); | 758 EXPECT_EQ(kPageID, page_id); |
| 757 ASSERT_EQ(2U, values.size()); | 759 ASSERT_EQ(2U, values.size()); |
| 758 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), values[0]); | 760 EXPECT_EQ(ASCIIToUTF16("3734 Elvis Presley Blvd."), values[0]); |
| 759 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), values[1]); | 761 EXPECT_EQ(ASCIIToUTF16("123 Apple St."), values[1]); |
| 760 ASSERT_EQ(2U, labels.size()); | 762 ASSERT_EQ(2U, labels.size()); |
| 761 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); | 763 EXPECT_EQ(ASCIIToUTF16("Elvis Aaron Presley; *3456"), labels[0]); |
| 762 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[1]); | 764 EXPECT_EQ(ASCIIToUTF16("Charles Hardin Holley; *8765"), labels[1]); |
| 763 } | 765 } |
| 764 | 766 |
| 765 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillCreditCardForm)) { | 767 TEST_F(AutoFillManagerTest, FillCreditCardForm) { |
| 766 FormData form; | 768 FormData form; |
| 767 CreateTestFormDataBilling(&form); | 769 CreateTestFormDataBilling(&form); |
| 768 | 770 |
| 769 // Set up our FormStructures. | 771 // Set up our FormStructures. |
| 770 std::vector<FormData> forms; | 772 std::vector<FormData> forms; |
| 771 forms.push_back(form); | 773 forms.push_back(form); |
| 772 autofill_manager_->FormsSeen(forms); | 774 autofill_manager_->FormsSeen(forms); |
| 773 | 775 |
| 774 // The page ID sent to the AutoFillManager from the RenderView, used to send | 776 // The page ID sent to the AutoFillManager from the RenderView, used to send |
| 775 // an IPC message back to the renderer. | 777 // an IPC message back to the renderer. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 "Card Number", "cardnumber", "1234567890123456", "text", &field); | 831 "Card Number", "cardnumber", "1234567890123456", "text", &field); |
| 830 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); | 832 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); |
| 831 autofill_unittest::CreateTestFormField( | 833 autofill_unittest::CreateTestFormField( |
| 832 "Expiration Date", "ccmonth", "04", "text", &field); | 834 "Expiration Date", "ccmonth", "04", "text", &field); |
| 833 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); | 835 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); |
| 834 autofill_unittest::CreateTestFormField( | 836 autofill_unittest::CreateTestFormField( |
| 835 "", "ccyear", "2012", "text", &field); | 837 "", "ccyear", "2012", "text", &field); |
| 836 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); | 838 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); |
| 837 } | 839 } |
| 838 | 840 |
| 839 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillNonBillingFormSemicolon)) { | 841 TEST_F(AutoFillManagerTest, FillNonBillingFormSemicolon) { |
| 840 // |profile| will be owned by the mock PersonalDataManager. | 842 // |profile| will be owned by the mock PersonalDataManager. |
| 841 AutoFillProfile* profile = new AutoFillProfile; | 843 AutoFillProfile* profile = new AutoFillProfile; |
| 842 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", | 844 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", |
| 843 "flatlander@gmail.com", "MCA", | 845 "flatlander@gmail.com", "MCA", |
| 844 "916 16th St.", "Apt. 6", "Lubbock", | 846 "916 16th St.", "Apt. 6", "Lubbock", |
| 845 "Texas", "79401", "USA", | 847 "Texas", "79401", "USA", |
| 846 "12345678901", ""); | 848 "12345678901", ""); |
| 847 profile->set_unique_id(7); | 849 profile->set_unique_id(7); |
| 848 autofill_manager_->AddProfile(profile); | 850 autofill_manager_->AddProfile(profile); |
| 849 | 851 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 900 "Country", "country", "USA", "text", &field); | 902 "Country", "country", "USA", "text", &field); |
| 901 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[8])); | 903 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[8])); |
| 902 autofill_unittest::CreateTestFormField( | 904 autofill_unittest::CreateTestFormField( |
| 903 "Phone Number", "phonenumber", "12345678901", "text", &field); | 905 "Phone Number", "phonenumber", "12345678901", "text", &field); |
| 904 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[9])); | 906 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[9])); |
| 905 autofill_unittest::CreateTestFormField( | 907 autofill_unittest::CreateTestFormField( |
| 906 "Email", "email", "flatlander@gmail.com", "text", &field); | 908 "Email", "email", "flatlander@gmail.com", "text", &field); |
| 907 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10])); | 909 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[10])); |
| 908 } | 910 } |
| 909 | 911 |
| 910 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillBillFormSemicolon)) { | 912 TEST_F(AutoFillManagerTest, FillBillFormSemicolon) { |
| 911 // |profile| will be owned by the mock PersonalDataManager. | 913 // |profile| will be owned by the mock PersonalDataManager. |
| 912 AutoFillProfile* profile = new AutoFillProfile; | 914 AutoFillProfile* profile = new AutoFillProfile; |
| 913 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", | 915 autofill_unittest::SetProfileInfo(profile, "Home; 8765", "Joe", "", "Ely", |
| 914 "flatlander@gmail.com", "MCA", | 916 "flatlander@gmail.com", "MCA", |
| 915 "916 16th St.", "Apt. 6", "Lubbock", | 917 "916 16th St.", "Apt. 6", "Lubbock", |
| 916 "Texas", "79401", "USA", | 918 "Texas", "79401", "USA", |
| 917 "12345678901", ""); | 919 "12345678901", ""); |
| 918 profile->set_unique_id(7); | 920 profile->set_unique_id(7); |
| 919 autofill_manager_->AddProfile(profile); | 921 autofill_manager_->AddProfile(profile); |
| 920 | 922 |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 984 "Card Number", "cardnumber", "1234567890123456", "text", &field); | 986 "Card Number", "cardnumber", "1234567890123456", "text", &field); |
| 985 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); | 987 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[12])); |
| 986 autofill_unittest::CreateTestFormField( | 988 autofill_unittest::CreateTestFormField( |
| 987 "Expiration Date", "ccmonth", "04", "text", &field); | 989 "Expiration Date", "ccmonth", "04", "text", &field); |
| 988 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); | 990 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[13])); |
| 989 autofill_unittest::CreateTestFormField( | 991 autofill_unittest::CreateTestFormField( |
| 990 "", "ccyear", "2012", "text", &field); | 992 "", "ccyear", "2012", "text", &field); |
| 991 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); | 993 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[14])); |
| 992 } | 994 } |
| 993 | 995 |
| 994 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FillPhoneNumber)) { | 996 TEST_F(AutoFillManagerTest, FillPhoneNumber) { |
| 995 FormData form; | 997 FormData form; |
| 996 | 998 |
| 997 form.name = ASCIIToUTF16("MyPhoneForm"); | 999 form.name = ASCIIToUTF16("MyPhoneForm"); |
| 998 form.method = ASCIIToUTF16("POST"); | 1000 form.method = ASCIIToUTF16("POST"); |
| 999 form.origin = GURL("http://myform.com/phone_form.html"); | 1001 form.origin = GURL("http://myform.com/phone_form.html"); |
| 1000 form.action = GURL("http://myform.com/phone_submit.html"); | 1002 form.action = GURL("http://myform.com/phone_submit.html"); |
| 1001 form.user_submitted = true; | 1003 form.user_submitted = true; |
| 1002 | 1004 |
| 1003 webkit_glue::FormField field; | 1005 webkit_glue::FormField field; |
| 1004 | 1006 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 } else { | 1059 } else { |
| 1058 // The only size that is parsed and split, right now is 7: | 1060 // The only size that is parsed and split, right now is 7: |
| 1059 EXPECT_EQ(ASCIIToUTF16("123"), results.fields[2].value()); | 1061 EXPECT_EQ(ASCIIToUTF16("123"), results.fields[2].value()); |
| 1060 EXPECT_EQ(ASCIIToUTF16("4567"), results.fields[3].value()); | 1062 EXPECT_EQ(ASCIIToUTF16("4567"), results.fields[3].value()); |
| 1061 } | 1063 } |
| 1062 } | 1064 } |
| 1063 | 1065 |
| 1064 work_profile->SetInfo(phone_type, saved_phone); | 1066 work_profile->SetInfo(phone_type, saved_phone); |
| 1065 } | 1067 } |
| 1066 | 1068 |
| 1067 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FormChangesRemoveField)) { | 1069 TEST_F(AutoFillManagerTest, FormChangesRemoveField) { |
| 1068 FormData form; | 1070 FormData form; |
| 1069 form.name = ASCIIToUTF16("MyForm"); | 1071 form.name = ASCIIToUTF16("MyForm"); |
| 1070 form.method = ASCIIToUTF16("POST"); | 1072 form.method = ASCIIToUTF16("POST"); |
| 1071 form.origin = GURL("http://myform.com/form.html"); | 1073 form.origin = GURL("http://myform.com/form.html"); |
| 1072 form.action = GURL("http://myform.com/submit.html"); | 1074 form.action = GURL("http://myform.com/submit.html"); |
| 1073 form.user_submitted = true; | 1075 form.user_submitted = true; |
| 1074 | 1076 |
| 1075 webkit_glue::FormField field; | 1077 webkit_glue::FormField field; |
| 1076 autofill_unittest::CreateTestFormField( | 1078 autofill_unittest::CreateTestFormField( |
| 1077 "First Name", "firstname", "", "text", &field); | 1079 "First Name", "firstname", "", "text", &field); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1122 "Middle Name", "middlename", "Aaron", "text", &field); | 1124 "Middle Name", "middlename", "Aaron", "text", &field); |
| 1123 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); | 1125 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[1])); |
| 1124 autofill_unittest::CreateTestFormField( | 1126 autofill_unittest::CreateTestFormField( |
| 1125 "Last Name", "lastname", "Presley", "text", &field); | 1127 "Last Name", "lastname", "Presley", "text", &field); |
| 1126 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); | 1128 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); |
| 1127 autofill_unittest::CreateTestFormField( | 1129 autofill_unittest::CreateTestFormField( |
| 1128 "Email", "email", "theking@gmail.com", "text", &field); | 1130 "Email", "email", "theking@gmail.com", "text", &field); |
| 1129 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); | 1131 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); |
| 1130 } | 1132 } |
| 1131 | 1133 |
| 1132 TEST_F(AutoFillManagerTest, SKIP_BRANDED(FormChangesAddField)) { | 1134 TEST_F(AutoFillManagerTest, FormChangesAddField) { |
| 1133 FormData form; | 1135 FormData form; |
| 1134 form.name = ASCIIToUTF16("MyForm"); | 1136 form.name = ASCIIToUTF16("MyForm"); |
| 1135 form.method = ASCIIToUTF16("POST"); | 1137 form.method = ASCIIToUTF16("POST"); |
| 1136 form.origin = GURL("http://myform.com/form.html"); | 1138 form.origin = GURL("http://myform.com/form.html"); |
| 1137 form.action = GURL("http://myform.com/submit.html"); | 1139 form.action = GURL("http://myform.com/submit.html"); |
| 1138 form.user_submitted = true; | 1140 form.user_submitted = true; |
| 1139 | 1141 |
| 1140 webkit_glue::FormField field; | 1142 webkit_glue::FormField field; |
| 1141 autofill_unittest::CreateTestFormField( | 1143 autofill_unittest::CreateTestFormField( |
| 1142 "First Name", "firstname", "", "text", &field); | 1144 "First Name", "firstname", "", "text", &field); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 "Last Name", "lastname", "Presley", "text", &field); | 1192 "Last Name", "lastname", "Presley", "text", &field); |
| 1191 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); | 1193 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[2])); |
| 1192 autofill_unittest::CreateTestFormField( | 1194 autofill_unittest::CreateTestFormField( |
| 1193 "Phone Number", "phonenumber", "", "text", &field); | 1195 "Phone Number", "phonenumber", "", "text", &field); |
| 1194 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); | 1196 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[3])); |
| 1195 autofill_unittest::CreateTestFormField( | 1197 autofill_unittest::CreateTestFormField( |
| 1196 "Email", "email", "theking@gmail.com", "text", &field); | 1198 "Email", "email", "theking@gmail.com", "text", &field); |
| 1197 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); | 1199 EXPECT_TRUE(field.StrictlyEqualsHack(results.fields[4])); |
| 1198 } | 1200 } |
| 1199 | 1201 |
| 1200 TEST_F(AutoFillManagerTest, SKIP_BRANDED(HiddenFields)) { | 1202 TEST_F(AutoFillManagerTest, HiddenFields) { |
| 1201 FormData form; | 1203 FormData form; |
| 1202 form.name = ASCIIToUTF16("MyForm"); | 1204 form.name = ASCIIToUTF16("MyForm"); |
| 1203 form.method = ASCIIToUTF16("POST"); | 1205 form.method = ASCIIToUTF16("POST"); |
| 1204 form.origin = GURL("http://myform.com/form.html"); | 1206 form.origin = GURL("http://myform.com/form.html"); |
| 1205 form.action = GURL("http://myform.com/submit.html"); | 1207 form.action = GURL("http://myform.com/submit.html"); |
| 1206 form.user_submitted = true; | 1208 form.user_submitted = true; |
| 1207 | 1209 |
| 1208 webkit_glue::FormField field; | 1210 webkit_glue::FormField field; |
| 1209 autofill_unittest::CreateTestFormField( | 1211 autofill_unittest::CreateTestFormField( |
| 1210 "E-mail", "one", "one", "hidden", &field); | 1212 "E-mail", "one", "one", "hidden", &field); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1247 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
| 1246 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1248 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
| 1247 profile()->GetPrefs()->SetBoolean( | 1249 profile()->GetPrefs()->SetBoolean( |
| 1248 prefs::kAutoFillAuxiliaryProfilesEnabled, true); | 1250 prefs::kAutoFillAuxiliaryProfilesEnabled, true); |
| 1249 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); | 1251 profile()->GetPrefs()->ClearPref(prefs::kAutoFillAuxiliaryProfilesEnabled); |
| 1250 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( | 1252 ASSERT_FALSE(profile()->GetPrefs()->GetBoolean( |
| 1251 prefs::kAutoFillAuxiliaryProfilesEnabled)); | 1253 prefs::kAutoFillAuxiliaryProfilesEnabled)); |
| 1252 #endif | 1254 #endif |
| 1253 } | 1255 } |
| 1254 | 1256 |
| OLD | NEW |