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

Unified Diff: chrome/browser/password_manager/password_manager_browsertest.cc

Issue 2216463002: [Autofill] Migrate ContentPasswordManagerDriver<-->Password{Autofill,Generation}Agent IPCs to mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix browser tests: PasswordManagerBrowserTestBase.InFrameNavigationDoesNotClearPopupState Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/password_manager/password_manager_browsertest.cc
diff --git a/chrome/browser/password_manager/password_manager_browsertest.cc b/chrome/browser/password_manager/password_manager_browsertest.cc
index 49ca26d8144535559fb4071140dba5ea093a4321..65ea29a6b0715009c889637ec872cc02821a6036 100644
--- a/chrome/browser/password_manager/password_manager_browsertest.cc
+++ b/chrome/browser/password_manager/password_manager_browsertest.cc
@@ -31,7 +31,6 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
-#include "components/autofill/content/common/autofill_messages.h"
#include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/test_autofill_client.h"
#include "components/autofill/core/common/password_form.h"
@@ -51,7 +50,6 @@
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
-#include "ipc/ipc_security_test_util.h"
#include "net/base/filename_util.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
@@ -1637,12 +1635,11 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase,
password_manager::ContentPasswordManagerDriverFactory::FromWebContents(
WebContents());
ObservingAutofillClient observing_autofill_client;
- driver_factory->TestingSetDriverForFrame(
leonhsl(Using Gerrit) 2016/08/23 08:23:48 The mojo connection has already been established b
- RenderViewHost()->GetMainFrame(),
- base::WrapUnique(new password_manager::ContentPasswordManagerDriver(
- RenderViewHost()->GetMainFrame(),
- ChromePasswordManagerClient::FromWebContents(WebContents()),
- &observing_autofill_client)));
+ password_manager::ContentPasswordManagerDriver* driver =
+ driver_factory->GetDriverForFrame(RenderViewHost()->GetMainFrame());
+ DCHECK(driver);
+ driver->GetPasswordAutofillManager()->TestingSetAutofillClient(
+ &observing_autofill_client);
NavigateToFile("/password/password_form.html");
@@ -2053,20 +2050,21 @@ IN_PROC_BROWSER_TEST_F(PasswordManagerBrowserTestBase,
EXPECT_NE(main_site_instance, iframe_site_instance);
EXPECT_NE(main_frame->GetProcess(), iframe->GetProcess());
+ content::RenderProcessHostWatcher iframe_killed(
+ iframe->GetProcess(),
+ content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
+
// Try to get cross-site passwords from the subframe's process and wait for it
// to be killed.
std::vector<autofill::PasswordForm> password_forms;
password_forms.push_back(autofill::PasswordForm());
password_forms.back().origin = main_frame_url;
- AutofillHostMsg_PasswordFormsParsed illegal_forms_parsed(
- iframe->GetRoutingID(), password_forms);
-
- content::RenderProcessHostWatcher iframe_killed(
- iframe->GetProcess(),
- content::RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
-
- IPC::IpcSecurityTestUtil::PwnMessageReceived(
- iframe->GetProcess()->GetChannel(), illegal_forms_parsed);
+ ContentPasswordManagerDriverFactory* factory =
+ ContentPasswordManagerDriverFactory::FromWebContents(WebContents());
+ EXPECT_TRUE(factory);
+ ContentPasswordManagerDriver* driver = factory->GetDriverForFrame(iframe);
+ EXPECT_TRUE(driver);
+ driver->PasswordFormsParsed(password_forms);
iframe_killed.Wait();
}

Powered by Google App Engine
This is Rietveld 408576698