| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 external_delegate_->DidAcceptSuggestion(autofill_item[0], autofill_ids[0]); | 170 external_delegate_->DidAcceptSuggestion(autofill_item[0], autofill_ids[0]); |
| 171 } | 171 } |
| 172 | 172 |
| 173 // Test that data list elements for a node will appear in the Autofill popup. | 173 // Test that data list elements for a node will appear in the Autofill popup. |
| 174 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) { | 174 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateDataList) { |
| 175 IssueOnQuery(kQueryId); | 175 IssueOnQuery(kQueryId); |
| 176 | 176 |
| 177 std::vector<base::string16> data_list_items; | 177 std::vector<base::string16> data_list_items; |
| 178 data_list_items.push_back(base::string16()); | 178 data_list_items.push_back(base::string16()); |
| 179 | 179 |
| 180 EXPECT_CALL( |
| 181 autofill_client_, |
| 182 UpdateAutofillPopupDataListValues(data_list_items, data_list_items)); |
| 183 |
| 180 external_delegate_->SetCurrentDataListValues(data_list_items, | 184 external_delegate_->SetCurrentDataListValues(data_list_items, |
| 181 data_list_items); | 185 data_list_items); |
| 182 | 186 |
| 183 // The enums must be cast to ints to prevent compile errors on linux_rel. | 187 // The enums must be cast to ints to prevent compile errors on linux_rel. |
| 184 EXPECT_CALL( | 188 EXPECT_CALL( |
| 185 autofill_client_, | 189 autofill_client_, |
| 186 ShowAutofillPopup(_, | 190 ShowAutofillPopup(_, |
| 187 _, | 191 _, |
| 188 _, | 192 _, |
| 189 _, | 193 _, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 IssueOnQuery(kQueryId); | 239 IssueOnQuery(kQueryId); |
| 236 | 240 |
| 237 EXPECT_CALL(autofill_client_, ShowAutofillPopup(_, _, _, _, _, _, _)) | 241 EXPECT_CALL(autofill_client_, ShowAutofillPopup(_, _, _, _, _, _, _)) |
| 238 .Times(0); | 242 .Times(0); |
| 239 | 243 |
| 240 // Make sure just setting the data list values doesn't cause the popup to | 244 // Make sure just setting the data list values doesn't cause the popup to |
| 241 // appear. | 245 // appear. |
| 242 std::vector<base::string16> data_list_items; | 246 std::vector<base::string16> data_list_items; |
| 243 data_list_items.push_back(base::string16()); | 247 data_list_items.push_back(base::string16()); |
| 244 | 248 |
| 249 EXPECT_CALL( |
| 250 autofill_client_, |
| 251 UpdateAutofillPopupDataListValues(data_list_items, data_list_items)); |
| 252 |
| 245 external_delegate_->SetCurrentDataListValues(data_list_items, | 253 external_delegate_->SetCurrentDataListValues(data_list_items, |
| 246 data_list_items); | 254 data_list_items); |
| 247 | 255 |
| 248 // The enums must be cast to ints to prevent compile errors on linux_rel. | 256 // The enums must be cast to ints to prevent compile errors on linux_rel. |
| 249 EXPECT_CALL( | 257 EXPECT_CALL( |
| 250 autofill_client_, | 258 autofill_client_, |
| 251 ShowAutofillPopup(_, | 259 ShowAutofillPopup(_, |
| 252 _, | 260 _, |
| 253 _, | 261 _, |
| 254 _, | 262 _, |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillFieldWithValue) { | 451 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegateFillFieldWithValue) { |
| 444 EXPECT_CALL(autofill_client_, HideAutofillPopup()); | 452 EXPECT_CALL(autofill_client_, HideAutofillPopup()); |
| 445 base::string16 dummy_string(ASCIIToUTF16("baz foo")); | 453 base::string16 dummy_string(ASCIIToUTF16("baz foo")); |
| 446 EXPECT_CALL(*autofill_driver_, | 454 EXPECT_CALL(*autofill_driver_, |
| 447 RendererShouldFillFieldWithValue(dummy_string)); | 455 RendererShouldFillFieldWithValue(dummy_string)); |
| 448 external_delegate_->DidAcceptSuggestion(dummy_string, | 456 external_delegate_->DidAcceptSuggestion(dummy_string, |
| 449 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY); | 457 POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY); |
| 450 } | 458 } |
| 451 | 459 |
| 452 } // namespace autofill | 460 } // namespace autofill |
| OLD | NEW |