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

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

Issue 212873003: Store the language code for the address in autofill profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixups Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <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 2521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2532 personal_data_->RemoveByGUID(moose.guid()); 2532 personal_data_->RemoveByGUID(moose.guid());
2533 AutofillProfile space_invader(base::GenerateGUID(), "Chrome settings"); 2533 AutofillProfile space_invader(base::GenerateGUID(), "Chrome settings");
2534 test::SetProfileInfo(&space_invader, "Marty", "", "Martian", 2534 test::SetProfileInfo(&space_invader, "Marty", "", "Martian",
2535 "mm@example.com", "", "1 Flying Object", "", "Valles Marineris", "", 2535 "mm@example.com", "", "1 Flying Object", "", "Valles Marineris", "",
2536 "", "XX", ""); 2536 "", "XX", "");
2537 personal_data_->AddProfile(moose); 2537 personal_data_->AddProfile(moose);
2538 ResetPersonalDataManager(USER_MODE_NORMAL); 2538 ResetPersonalDataManager(USER_MODE_NORMAL);
2539 EXPECT_EQ("MX", personal_data_->GetDefaultCountryCodeForNewAddress()); 2539 EXPECT_EQ("MX", personal_data_->GetDefaultCountryCodeForNewAddress());
2540 } 2540 }
2541 2541
2542 TEST_F(PersonalDataManagerTest, UpdateLanguageCodeInProfile) {
2543 AutofillProfile profile(base::GenerateGUID(), "https://www.example.com");
2544 test::SetProfileInfo(&profile,
2545 "Marion", "Mitchell", "Morrison",
2546 "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
2547 "91601", "US", "12345678910");
2548 personal_data_->AddProfile(profile);
2549
2550 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
2551 .WillOnce(QuitMainMessageLoop());
2552 base::MessageLoop::current()->Run();
2553
2554 profile.set_language_code("en");
2555 personal_data_->UpdateProfile(profile);
2556
2557 EXPECT_CALL(personal_data_observer_, OnPersonalDataChanged())
2558 .WillOnce(QuitMainMessageLoop());
2559 base::MessageLoop::current()->Run();
2560
2561 const std::vector<AutofillProfile*>& results = personal_data_->GetProfiles();
2562 ASSERT_EQ(1U, results.size());
2563 EXPECT_EQ(0, profile.Compare(*results[0]));
2564 EXPECT_EQ("en", results[0]->language_code());
2565 }
2566
2542 } // namespace autofill 2567 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698