OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/string16.h" | 8 #include "base/string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 10 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
260 autofill::GenerateTestAutofillPopup(external_delegate_.get()); | 260 autofill::GenerateTestAutofillPopup(external_delegate_.get()); |
261 | 261 |
262 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); | 262 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); |
263 external_delegate_->DidEndTextFieldEditing(); | 263 external_delegate_->DidEndTextFieldEditing(); |
264 } | 264 } |
265 | 265 |
266 // Test that the popup is marked as visible after recieving password | 266 // Test that the popup is marked as visible after recieving password |
267 // suggestions. | 267 // suggestions. |
268 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegatePasswordSuggestions) { | 268 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegatePasswordSuggestions) { |
269 static const base::string16 kUsername = ASCIIToUTF16("username"); | 269 static const base::string16 kUsername = ASCIIToUTF16("username"); |
270 static const base::string16 kSignonRealm = ASCIIToUTF16("signon_realm"); | |
palmer
2013/06/11 18:55:45
Is this the file to test specific fuzzy matches th
nyquist
2013/06/11 23:54:43
I have now added these tests at the lowest level,
| |
270 std::vector<base::string16> suggestions; | 271 std::vector<base::string16> suggestions; |
271 suggestions.push_back(kUsername); | 272 suggestions.push_back(kUsername); |
273 std::vector<base::string16> realms; | |
274 realms.push_back(kSignonRealm); | |
272 | 275 |
273 FormFieldData field; | 276 FormFieldData field; |
274 field.is_focusable = true; | 277 field.is_focusable = true; |
275 field.should_autocomplete = true; | 278 field.should_autocomplete = true; |
276 const gfx::RectF element_bounds; | 279 const gfx::RectF element_bounds; |
277 | 280 |
278 FormFieldData username_field_data; | 281 FormFieldData username_field_data; |
279 username_field_data.value = kUsername; | 282 username_field_data.value = kUsername; |
280 PasswordFormFillData password_form_fill_data; | 283 PasswordFormFillData password_form_fill_data; |
281 password_form_fill_data.basic_data.fields.push_back(username_field_data); | 284 password_form_fill_data.basic_data.fields.push_back(username_field_data); |
282 external_delegate_->AddPasswordFormMapping(field, password_form_fill_data); | 285 external_delegate_->AddPasswordFormMapping(field, password_form_fill_data); |
283 | 286 |
284 // The enums must be cast to ints to prevent compile errors on linux_rel. | 287 // The enums must be cast to ints to prevent compile errors on linux_rel. |
285 EXPECT_CALL(manager_delegate_, | 288 EXPECT_CALL(manager_delegate_, |
286 ShowAutofillPopup( | 289 ShowAutofillPopup( |
287 _, _, _, _, | 290 _, _, _, _, |
288 testing::ElementsAre( | 291 testing::ElementsAre( |
289 static_cast<int>( | 292 static_cast<int>( |
290 WebAutofillClient::MenuItemIDPasswordEntry)), | 293 WebAutofillClient::MenuItemIDPasswordEntry)), |
291 _)); | 294 _)); |
292 | 295 |
293 external_delegate_->OnShowPasswordSuggestions(suggestions, | 296 external_delegate_->OnShowPasswordSuggestions(suggestions, |
297 realms, | |
294 field, | 298 field, |
295 element_bounds); | 299 element_bounds); |
296 | 300 |
297 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); | 301 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); |
298 | 302 |
299 // This should trigger a call to hide the popup since | 303 // This should trigger a call to hide the popup since |
300 // we've selected an option. | 304 // we've selected an option. |
301 external_delegate_->DidAcceptSuggestion( | 305 external_delegate_->DidAcceptSuggestion( |
302 suggestions[0], | 306 suggestions[0], |
303 WebAutofillClient::MenuItemIDPasswordEntry); | 307 WebAutofillClient::MenuItemIDPasswordEntry); |
(...skipping 19 matching lines...) Expand all Loading... | |
323 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); | 327 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); |
324 | 328 |
325 external_delegate_->OnSuggestionsReturned(kQueryId, | 329 external_delegate_->OnSuggestionsReturned(kQueryId, |
326 autofill_items, | 330 autofill_items, |
327 autofill_items, | 331 autofill_items, |
328 autofill_items, | 332 autofill_items, |
329 autofill_ids); | 333 autofill_ids); |
330 } | 334 } |
331 | 335 |
332 } // namespace autofill | 336 } // namespace autofill |
OLD | NEW |