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

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: comment 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..edb06379e3fe6df3363501fc9fa7edc39fdc73f9
--- /dev/null
+++ b/chrome/browser/ui/autofill/country_combobox_model_unittest.cc
@@ -0,0 +1,53 @@
+// 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/gmock/include/gmock/gmock.h"
+#include "testing/gmock_mutant.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/base/models/combobox_model_observer.h"
+
+namespace autofill {
+
+namespace {
+
+const char kTestCountry[] = "AQ";
+
+class MockObserver : public ui::ComboboxModelObserver {
+ public:
+ MOCK_METHOD1(OnComboboxModelChanged, void(ui::ComboboxModel* model));
+};
+
+} // namespace
+
+TEST(CountryComboboxModel, SetAndResetDefaultCountry) {
+ TestPersonalDataManager manager;
+ CountryComboboxModel model(manager);
+
+ MockObserver observer;
+ model.AddObserver(&observer);
+ EXPECT_CALL(observer, OnComboboxModelChanged(&model)).Times(2);
+
+ std::string default_country = model.GetDefaultCountryCode();
+ ASSERT_NE(default_country, kTestCountry);
+
+ model.SetDefaultCountry(kTestCountry);
+ EXPECT_EQ(kTestCountry, model.GetDefaultCountryCode());
+
+ model.ResetDefault();
+ EXPECT_EQ(default_country, model.GetDefaultCountryCode());
+}
+
+TEST(CountryComboboxModel, RespectsManagerDefaultCountry) {
+ TestPersonalDataManager manager;
+ manager.set_timezone_country_code(kTestCountry);
+
+ CountryComboboxModel model(manager);
+ EXPECT_EQ(kTestCountry, model.GetDefaultCountryCode());
+}
+
+} // namespace autofill
« no previous file with comments | « chrome/browser/ui/autofill/country_combobox_model.cc ('k') | chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698