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

Side by Side Diff: components/autofill/core/browser/autofill_external_delegate_unittest.cc

Issue 15660018: [autofill] Add support for PSL domain matching for password autofill. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed test expectation to match intention and comment Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/strings/string16.h" 8 #include "base/strings/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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 autofill::GenerateTestAutofillPopup(external_delegate_.get()); 293 autofill::GenerateTestAutofillPopup(external_delegate_.get());
294 294
295 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); 295 EXPECT_CALL(manager_delegate_, HideAutofillPopup());
296 external_delegate_->DidEndTextFieldEditing(); 296 external_delegate_->DidEndTextFieldEditing();
297 } 297 }
298 298
299 // Test that the popup is marked as visible after recieving password 299 // Test that the popup is marked as visible after recieving password
300 // suggestions. 300 // suggestions.
301 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegatePasswordSuggestions) { 301 TEST_F(AutofillExternalDelegateUnitTest, ExternalDelegatePasswordSuggestions) {
302 static const base::string16 kUsername = ASCIIToUTF16("username"); 302 static const base::string16 kUsername = ASCIIToUTF16("username");
303 static const base::string16 kSignonRealm = ASCIIToUTF16("http://foo.com/");
303 std::vector<base::string16> suggestions; 304 std::vector<base::string16> suggestions;
304 suggestions.push_back(kUsername); 305 suggestions.push_back(kUsername);
306 std::vector<base::string16> realms;
307 realms.push_back(kSignonRealm);
305 308
306 FormFieldData field; 309 FormFieldData field;
307 field.is_focusable = true; 310 field.is_focusable = true;
308 field.should_autocomplete = true; 311 field.should_autocomplete = true;
309 const gfx::RectF element_bounds; 312 const gfx::RectF element_bounds;
310 313
311 FormFieldData username_field_data; 314 FormFieldData username_field_data;
312 username_field_data.value = kUsername; 315 username_field_data.value = kUsername;
313 PasswordFormFillData password_form_fill_data; 316 PasswordFormFillData password_form_fill_data;
314 password_form_fill_data.basic_data.fields.push_back(username_field_data); 317 password_form_fill_data.basic_data.fields.push_back(username_field_data);
315 external_delegate_->AddPasswordFormMapping(field, password_form_fill_data); 318 external_delegate_->AddPasswordFormMapping(field, password_form_fill_data);
316 319
317 // The enums must be cast to ints to prevent compile errors on linux_rel. 320 // The enums must be cast to ints to prevent compile errors on linux_rel.
318 EXPECT_CALL(manager_delegate_, 321 EXPECT_CALL(manager_delegate_,
319 ShowAutofillPopup( 322 ShowAutofillPopup(
320 _, _, _, _, _, 323 _, _, _, _, _,
321 testing::ElementsAre( 324 testing::ElementsAre(
322 static_cast<int>( 325 static_cast<int>(
323 WebAutofillClient::MenuItemIDPasswordEntry)), 326 WebAutofillClient::MenuItemIDPasswordEntry)),
324 _)); 327 _));
325 328
326 external_delegate_->OnShowPasswordSuggestions(suggestions, 329 external_delegate_->OnShowPasswordSuggestions(suggestions,
330 realms,
327 field, 331 field,
328 element_bounds); 332 element_bounds);
329 333
330 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); 334 EXPECT_CALL(manager_delegate_, HideAutofillPopup());
331 335
332 // This should trigger a call to hide the popup since 336 // This should trigger a call to hide the popup since
333 // we've selected an option. 337 // we've selected an option.
334 external_delegate_->DidAcceptSuggestion( 338 external_delegate_->DidAcceptSuggestion(
335 suggestions[0], 339 suggestions[0],
336 WebAutofillClient::MenuItemIDPasswordEntry); 340 WebAutofillClient::MenuItemIDPasswordEntry);
(...skipping 19 matching lines...) Expand all
356 EXPECT_CALL(manager_delegate_, HideAutofillPopup()); 360 EXPECT_CALL(manager_delegate_, HideAutofillPopup());
357 361
358 external_delegate_->OnSuggestionsReturned(kQueryId, 362 external_delegate_->OnSuggestionsReturned(kQueryId,
359 autofill_items, 363 autofill_items,
360 autofill_items, 364 autofill_items,
361 autofill_items, 365 autofill_items,
362 autofill_ids); 366 autofill_ids);
363 } 367 }
364 368
365 } // namespace autofill 369 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/core/browser/autofill_external_delegate.cc ('k') | components/autofill/core/browser/autofill_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698