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