OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/autofill/country_combobox_model.h" | 5 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/signin/account_tracker_service_factory.h" |
9 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
10 #include "components/autofill/core/browser/autofill_country.h" | 11 #include "components/autofill/core/browser/autofill_country.h" |
11 #include "components/autofill/core/browser/test_personal_data_manager.h" | 12 #include "components/autofill/core/browser/test_personal_data_manager.h" |
| 13 #include "components/signin/core/browser/account_tracker_service.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
.h" | 15 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
.h" |
14 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
_component.h" | 16 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
_component.h" |
15 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/localizati
on.h" | 17 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/localizati
on.h" |
16 | 18 |
17 namespace autofill { | 19 namespace autofill { |
18 | 20 |
19 class CountryComboboxModelTest : public testing::Test { | 21 class CountryComboboxModelTest : public testing::Test { |
20 public: | 22 public: |
21 CountryComboboxModelTest() { | 23 CountryComboboxModelTest() { |
22 manager_.Init(NULL, profile_.GetPrefs(), false); | 24 manager_.Init( |
| 25 NULL, profile_.GetPrefs(), |
| 26 AccountTrackerServiceFactory::GetForProfile(&profile_), false); |
23 manager_.set_timezone_country_code("KR"); | 27 manager_.set_timezone_country_code("KR"); |
24 model_.reset(new CountryComboboxModel()); | 28 model_.reset(new CountryComboboxModel()); |
25 model_->SetCountries(manager_, base::Callback<bool(const std::string&)>()); | 29 model_->SetCountries(manager_, base::Callback<bool(const std::string&)>()); |
26 } | 30 } |
27 | 31 |
28 TestPersonalDataManager* manager() { return &manager_; } | 32 TestPersonalDataManager* manager() { return &manager_; } |
29 CountryComboboxModel* model() { return model_.get(); } | 33 CountryComboboxModel* model() { return model_.get(); } |
30 | 34 |
31 private: | 35 private: |
32 // NB: order is important here - |profile_| must go down after |manager_|. | 36 // NB: order is important here - |profile_| must go down after |manager_|. |
(...skipping 20 matching lines...) Expand all Loading... |
53 | 57 |
54 std::string country_code = model()->countries()[i]->country_code(); | 58 std::string country_code = model()->countries()[i]->country_code(); |
55 std::vector< ::i18n::addressinput::AddressUiComponent> components = | 59 std::vector< ::i18n::addressinput::AddressUiComponent> components = |
56 ::i18n::addressinput::BuildComponents( | 60 ::i18n::addressinput::BuildComponents( |
57 country_code, localization, std::string(), &unused); | 61 country_code, localization, std::string(), &unused); |
58 EXPECT_FALSE(components.empty()); | 62 EXPECT_FALSE(components.empty()); |
59 } | 63 } |
60 } | 64 } |
61 | 65 |
62 } // namespace autofill | 66 } // namespace autofill |
OLD | NEW |