OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 2309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2320 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, | 2320 EXPECT_TRUE(personal_data_->ImportFormData(form_structure1, |
2321 &imported_credit_card)); | 2321 &imported_credit_card)); |
2322 ASSERT_FALSE(imported_credit_card); | 2322 ASSERT_FALSE(imported_credit_card); |
2323 | 2323 |
2324 // Verify that the web database has been updated and the notification sent. | 2324 // Verify that the web database has been updated and the notification sent. |
2325 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2325 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2326 .WillOnce(QuitMainMessageLoop()); | 2326 .WillOnce(QuitMainMessageLoop()); |
2327 base::MessageLoop::current()->Run(); | 2327 base::MessageLoop::current()->Run(); |
2328 | 2328 |
2329 AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); | 2329 AutofillProfile expected(base::GenerateGUID(), "https://www.example.com"); |
2330 test::SetProfileInfo(&expected, "George", NULL, | 2330 test::SetProfileInfo(&expected, |
2331 "Washington", "theprez@gmail.com", NULL, "21 Laussat St", NULL, | 2331 "George", |
2332 "San Francisco", "California", "94102", NULL, "(817) 555-6789"); | 2332 NULL, |
| 2333 "Washington", |
| 2334 "theprez@gmail.com", |
| 2335 NULL, |
| 2336 "21 Laussat St", |
| 2337 NULL, |
| 2338 "San Francisco", |
| 2339 "California", |
| 2340 "94102", |
| 2341 NULL, |
| 2342 "817-555-6789"); |
2333 const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); | 2343 const std::vector<AutofillProfile*>& results1 = personal_data_->GetProfiles(); |
2334 ASSERT_EQ(1U, results1.size()); | 2344 ASSERT_EQ(1U, results1.size()); |
2335 EXPECT_EQ(0, expected.Compare(*results1[0])); | 2345 EXPECT_EQ(0, expected.Compare(*results1[0])); |
2336 | 2346 |
2337 // Upper-case the first name and change the phone number. | 2347 // Upper-case the first name and change the phone number. |
2338 FormData form2; | 2348 FormData form2; |
2339 test::CreateTestFormField( | 2349 test::CreateTestFormField( |
2340 "First name:", "first_name", "GEORGE", "text", &field); | 2350 "First name:", "first_name", "GEORGE", "text", &field); |
2341 form2.fields.push_back(field); | 2351 form2.fields.push_back(field); |
2342 test::CreateTestFormField( | 2352 test::CreateTestFormField( |
(...skipping 24 matching lines...) Expand all Loading... |
2367 // Verify that the web database has been updated and the notification sent. | 2377 // Verify that the web database has been updated and the notification sent. |
2368 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) | 2378 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged()) |
2369 .WillOnce(QuitMainMessageLoop()); | 2379 .WillOnce(QuitMainMessageLoop()); |
2370 base::MessageLoop::current()->Run(); | 2380 base::MessageLoop::current()->Run(); |
2371 | 2381 |
2372 const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); | 2382 const std::vector<AutofillProfile*>& results2 = personal_data_->GetProfiles(); |
2373 | 2383 |
2374 // Modify expected to include multi-valued fields. | 2384 // Modify expected to include multi-valued fields. |
2375 std::vector<base::string16> values; | 2385 std::vector<base::string16> values; |
2376 expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); | 2386 expected.GetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, &values); |
2377 values.push_back(ASCIIToUTF16("(214) 555-1234")); | 2387 values.push_back(ASCIIToUTF16("214-555-1234")); |
2378 expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); | 2388 expected.SetRawMultiInfo(PHONE_HOME_WHOLE_NUMBER, values); |
2379 | 2389 |
2380 ASSERT_EQ(1U, results2.size()); | 2390 ASSERT_EQ(1U, results2.size()); |
2381 EXPECT_EQ(0, expected.Compare(*results2[0])); | 2391 EXPECT_EQ(0, expected.Compare(*results2[0])); |
2382 } | 2392 } |
2383 | 2393 |
2384 TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { | 2394 TEST_F(PersonalDataManagerTest, IncognitoReadOnly) { |
2385 ASSERT_TRUE(personal_data_->GetProfiles().empty()); | 2395 ASSERT_TRUE(personal_data_->GetProfiles().empty()); |
2386 ASSERT_TRUE(personal_data_->GetCreditCards().empty()); | 2396 ASSERT_TRUE(personal_data_->GetCreditCards().empty()); |
2387 | 2397 |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2558 .WillOnce(QuitMainMessageLoop()); | 2568 .WillOnce(QuitMainMessageLoop()); |
2559 base::MessageLoop::current()->Run(); | 2569 base::MessageLoop::current()->Run(); |
2560 | 2570 |
2561 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); | 2571 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles(); |
2562 ASSERT_EQ(1U, results.size()); | 2572 ASSERT_EQ(1U, results.size()); |
2563 EXPECT_EQ(0, profile.Compare(*results[0])); | 2573 EXPECT_EQ(0, profile.Compare(*results[0])); |
2564 EXPECT_EQ("en", results[0]->language_code()); | 2574 EXPECT_EQ("en", results[0]->language_code()); |
2565 } | 2575 } |
2566 | 2576 |
2567 } // namespace autofill | 2577 } // namespace autofill |
OLD | NEW |