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

Side by Side Diff: chrome/browser/password_manager/credential_manager_browsertest.cc

Issue 2900983002: Ignore form action URL when determine if a credential should be autofilled. (Closed)
Patch Set: comments and tests Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/macros.h" 5 #include "base/macros.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/password_manager/password_manager_test_base.h" 8 #include "chrome/browser/password_manager/password_manager_test_base.h"
9 #include "chrome/browser/password_manager/password_store_factory.h" 9 #include "chrome/browser/password_manager/password_store_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 EXPECT_FALSE(prompt_observer.IsShowingUpdatePrompt()); 329 EXPECT_FALSE(prompt_observer.IsShowingUpdatePrompt());
330 signin_form.skip_zero_click = false; 330 signin_form.skip_zero_click = false;
331 signin_form.times_used = 1; 331 signin_form.times_used = 1;
332 signin_form.password_value = base::ASCIIToUTF16("API"); 332 signin_form.password_value = base::ASCIIToUTF16("API");
333 password_manager::TestPasswordStore::PasswordMap stored = 333 password_manager::TestPasswordStore::PasswordMap stored =
334 password_store->stored_passwords(); 334 password_store->stored_passwords();
335 ASSERT_EQ(1u, stored.size()); 335 ASSERT_EQ(1u, stored.size());
336 EXPECT_EQ(signin_form, stored[signin_form.signon_realm][0]); 336 EXPECT_EQ(signin_form, stored[signin_form.signon_realm][0]);
337 } 337 }
338 338
339 IN_PROC_BROWSER_TEST_F(CredentialManagerBrowserTest, CredentialsAutofilled) {
340 NavigateToFile("/password/password_form.html");
341
342 ASSERT_TRUE(content::ExecuteScript(
343 RenderFrameHost(),
344 "var c = new PasswordCredential({ id: 'user', password: '12345' });"
345 "navigator.credentials.store(c);"));
346 BubbleObserver bubble_observer(WebContents());
347 bubble_observer.WaitForSavePrompt();
348 bubble_observer.AcceptSavePrompt();
349
350 // Reload the page and make sure it's autofilled.
351 NavigateToFile("/password/password_form.html");
352 WaitForElementValue("username_field", "user");
353 content::SimulateMouseClickAt(
354 WebContents(), 0, blink::WebMouseEvent::Button::kLeft, gfx::Point(1, 1));
355 WaitForElementValue("password_field", "12345");
356 }
357
339 } // namespace 358 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698