| 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/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" | 
| 10 #include "components/autofill/core/browser/autofill_country.h" | 10 #include "components/autofill/core/browser/autofill_country.h" | 
| 11 #include "components/autofill/core/browser/test_personal_data_manager.h" | 11 #include "components/autofill/core/browser/test_personal_data_manager.h" | 
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" | 
| 13 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
    ss_ui.h" | 13 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
    ss_ui.h" | 
| 14 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
    ss_ui_component.h" | 14 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/addre
    ss_ui_component.h" | 
| 15 | 15 | 
| 16 namespace autofill { | 16 namespace autofill { | 
| 17 | 17 | 
| 18 class CountryComboboxModelTest : public testing::Test { | 18 class CountryComboboxModelTest : public testing::Test { | 
| 19  public: | 19  public: | 
| 20   CountryComboboxModelTest() { | 20   CountryComboboxModelTest() { | 
| 21     manager_.Init(NULL, profile_.GetPrefs(), false); | 21     manager_.Init(NULL, profile_.GetPrefs(), false); | 
| 22     manager_.set_timezone_country_code("KR"); | 22     manager_.set_timezone_country_code("KR"); | 
| 23     CreateModel(true); | 23     CreateModel(true); | 
| 24   } | 24   } | 
| 25   virtual ~CountryComboboxModelTest() {} | 25   virtual ~CountryComboboxModelTest() {} | 
| 26 | 26 | 
| 27  protected: | 27  protected: | 
| 28   void CreateModel(bool show_partially_supported_countries) { | 28   void CreateModel(bool show_partially_supported_countries) { | 
| 29     model_.reset(new CountryComboboxModel( | 29     model_.reset(new CountryComboboxModel( | 
| 30         manager_, show_partially_supported_countries)); | 30         manager_, | 
|  | 31         std::set<base::string16>(), | 
|  | 32         show_partially_supported_countries)); | 
| 31   } | 33   } | 
| 32 | 34 | 
| 33   TestPersonalDataManager* manager() { return &manager_; } | 35   TestPersonalDataManager* manager() { return &manager_; } | 
| 34   CountryComboboxModel* model() { return model_.get(); } | 36   CountryComboboxModel* model() { return model_.get(); } | 
| 35 | 37 | 
| 36  private: | 38  private: | 
| 37   // NB: order is important here - |profile_| must go down after |manager_|. | 39   // NB: order is important here - |profile_| must go down after |manager_|. | 
| 38   TestingProfile profile_; | 40   TestingProfile profile_; | 
| 39   TestPersonalDataManager manager_; | 41   TestPersonalDataManager manager_; | 
| 40   scoped_ptr<CountryComboboxModel> model_; | 42   scoped_ptr<CountryComboboxModel> model_; | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
| 71     std::vector< ::i18n::addressinput::AddressUiComponent> components = | 73     std::vector< ::i18n::addressinput::AddressUiComponent> components = | 
| 72         ::i18n::addressinput::BuildComponents(country_code); | 74         ::i18n::addressinput::BuildComponents(country_code); | 
| 73     ASSERT_FALSE(components.empty()); | 75     ASSERT_FALSE(components.empty()); | 
| 74     for (size_t j = 0; j < components.size(); ++j) { | 76     for (size_t j = 0; j < components.size(); ++j) { | 
| 75       EXPECT_NE(components[j].field, ::i18n::addressinput::DEPENDENT_LOCALITY); | 77       EXPECT_NE(components[j].field, ::i18n::addressinput::DEPENDENT_LOCALITY); | 
| 76     } | 78     } | 
| 77   } | 79   } | 
| 78 } | 80 } | 
| 79 | 81 | 
| 80 }  // namespace autofill | 82 }  // namespace autofill | 
| OLD | NEW | 
|---|