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

Unified Diff: chrome/browser/ui/autofill/country_combobox_model_unittest.cc

Issue 124533003: Add country combobox to change country and rebuild address inputs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/country_combobox_model_unittest.cc
diff --git a/chrome/browser/ui/autofill/country_combobox_model_unittest.cc b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..347833b37a612a639d63f5ad22d8b41edf65af2a
--- /dev/null
+++ b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/autofill/country_combobox_model.h"
+
+#include "components/autofill/core/browser/autofill_country.h"
+#include "components/autofill/core/browser/test_personal_data_manager.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace autofill {
+
+TEST(CountryComboboxModel, SelectIndexes) {
+ TestPersonalDataManager manager;
+ CountryComboboxModel model(manager);
+ EXPECT_TRUE(model.IsDefaultIndexSelected());
+
+ const std::string default_country = model.GetSelectedCountryCode();
+
+ model.SelectIndex(5);
+ EXPECT_NE(default_country, model.GetSelectedCountryCode());
+ EXPECT_FALSE(model.IsDefaultIndexSelected());
+
+ model.SelectDefaultIndex();
+ EXPECT_EQ(default_country, model.GetSelectedCountryCode());
+ EXPECT_TRUE(model.IsDefaultIndexSelected());
+}
+
+TEST(CountryComboboxModel, SelectCountry) {
+ TestPersonalDataManager manager;
+ CountryComboboxModel model(manager);
+
+ EXPECT_NE("AQ", model.GetSelectedCountryCode());
+ model.SelectCountry("AQ");
+ EXPECT_EQ("AQ", model.GetSelectedCountryCode());
+}
+
+TEST(CountryComboboxModel, DefaultCountry) {
+ TestPersonalDataManager manager;
+ ASSERT_NE("AQ", manager.GetDefaultCountryCodeForNewAddress());
+ manager.set_default_country_code("AQ");
+
+ CountryComboboxModel model(manager);
+ EXPECT_EQ("AQ", model.countries()[model.GetDefaultIndex()]->country_code());
+ EXPECT_EQ("AQ", model.GetSelectedCountryCode());
+}
+
+} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698