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
3 // found in the LICENSE file.
5 #include "chrome/browser/ui/autofill/country_combobox_model.h"
7 #include "components/autofill/core/browser/autofill_country.h"
8 #include "components/autofill/core/browser/test_personal_data_manager.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui.h"
11 #include "third_party/libaddressinput/chromium/cpp/include/libaddressinput/address_ui_component.h"
15 TEST(CountryComboboxModel, RespectsManagerDefaultCountry) {
16 const std::string test_country = "AQ";
17 TestPersonalDataManager manager;
18 manager.set_timezone_country_code(test_country);
20 CountryComboboxModel model(manager);
21 EXPECT_EQ(test_country, model.GetDefaultCountryCode());
24 TEST(CountryComboboxModel, AllCountriesHaveComponents) {
25 TestPersonalDataManager manager;
26 CountryComboboxModel model(manager);
28 for (int i = 0; i < model.GetItemCount(); ++i) {
29 if (model.IsItemSeparatorAt(i))
32 std::string country_code = model.countries()[i]->country_code();
33 std::vector< ::i18n::addressinput::AddressUiComponent> components =
34 ::i18n::addressinput::BuildComponents(country_code);
35 EXPECT_FALSE(components.empty());
39 } // namespace autofill