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

Side by Side Diff: chrome/renderer/autofill/password_generation_agent_browsertest.cc

Issue 662493002: [Password Generation] Enable generation for dynamically created forms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better Created 6 years, 2 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
« no previous file with comments | « no previous file | components/autofill/content/renderer/autofill_agent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string.h> 5 #include <string.h>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "chrome/test/base/chrome_render_view_test.h" 10 #include "chrome/test/base/chrome_render_view_test.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // Loading a different page triggers UMA stat upload. Verify that only one 336 // Loading a different page triggers UMA stat upload. Verify that only one
337 // display event is sent even though 337 // display event is sent even though
338 LoadHTML(kSigninFormHTML); 338 LoadHTML(kSigninFormHTML);
339 339
340 histogram_tester.ExpectBucketCount( 340 histogram_tester.ExpectBucketCount(
341 "PasswordGeneration.Event", 341 "PasswordGeneration.Event",
342 autofill::password_generation::GENERATION_POPUP_SHOWN, 342 autofill::password_generation::GENERATION_POPUP_SHOWN,
343 1); 343 1);
344 } 344 }
345 345
346 TEST_F(PasswordGenerationAgentTest, DynamicFormTest) {
347 LoadHTML(kSigninFormHTML);
348 SetNotBlacklistedMessage(kSigninFormHTML);
349 SetAccountCreationFormsDetectedMessage(kSigninFormHTML);
350
351 ExecuteJavaScript(
352 "var form = document.createElement('form');"
353 "var username = document.createElement('input');"
354 "username.type = 'text';"
355 "username.id = 'dynamic_username';"
356 "var first_password = document.createElement('input');"
357 "first_password.type = 'password';"
358 "first_password.id = 'first_password';"
359 "first_password.name = 'first_password';"
360 "var second_password = document.createElement('input');"
361 "second_password.type = 'password';"
362 "second_password.id = 'second_password';"
363 "second_password.name = 'second_password';"
364 "form.appendChild(username);"
365 "form.appendChild(first_password);"
366 "form.appendChild(second_password);"
367 "document.body.appendChild(form);");
368 ProcessPendingMessages();
369 // TODO(gcasto): I'm slighty worried about flakes in this test where
370 // didAssociateFormControls() isn't called. If this turns out to be a problem
371 // adding a call to OnDynamicFormsSeen(GetMainFrame()) will fix it, though
372 // it will weaken the test.
373 ExpectPasswordGenerationAvailable("first_password", true);
374 }
375
346 } // namespace autofill 376 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/content/renderer/autofill_agent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698