| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "components/autofill/core/browser/region_combobox_model.h" | 5 #include "components/autofill/core/browser/region_combobox_model.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 std::unique_ptr<RegionComboboxModel> model_; | 87 std::unique_ptr<RegionComboboxModel> model_; |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // Make sure the two regions returned by the source are properly set in the | 90 // Make sure the two regions returned by the source are properly set in the |
| 91 // model. | 91 // model. |
| 92 TEST_F(RegionComboboxModelTest, QuebecOntarioRegions) { | 92 TEST_F(RegionComboboxModelTest, QuebecOntarioRegions) { |
| 93 SetupCombobox(false); | 93 SetupCombobox(false); |
| 94 EXPECT_EQ(2, model()->GetItemCount()); | 94 EXPECT_EQ(2, model()->GetItemCount()); |
| 95 EXPECT_EQ(base::ASCIIToUTF16(kQuebec), model()->GetItemAt(0)); | 95 EXPECT_EQ(base::ASCIIToUTF16(kQuebec), model()->GetItemAt(0)); |
| 96 EXPECT_EQ(base::ASCIIToUTF16(kOntario), model()->GetItemAt(1)); | 96 EXPECT_EQ(base::ASCIIToUTF16(kOntario), model()->GetItemAt(1)); |
| 97 EXPECT_FALSE(model()->failed_to_load_data()); |
| 97 } | 98 } |
| 98 | 99 |
| 99 // Make sure the combo box properly support source failures. | 100 // Make sure the combo box properly support source failures. |
| 100 TEST_F(RegionComboboxModelTest, FailingSource) { | 101 TEST_F(RegionComboboxModelTest, FailingSource) { |
| 101 SetupCombobox(true); | 102 SetupCombobox(true); |
| 102 EXPECT_EQ(0, model()->GetItemCount()); | 103 EXPECT_EQ(1, model()->GetItemCount()); |
| 104 EXPECT_TRUE(model()->failed_to_load_data()); |
| 103 } | 105 } |
| 104 | 106 |
| 105 } // namespace autofill | 107 } // namespace autofill |
| OLD | NEW |