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

Unified Diff: content/browser/frame_host/render_frame_message_filter_browsertest.cc

Issue 2202723005: Move FrameHostMsg_GetCookies to mojom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sync-associated-message
Patch Set: 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: content/browser/frame_host/render_frame_message_filter_browsertest.cc
diff --git a/content/browser/frame_host/render_frame_message_filter_browsertest.cc b/content/browser/frame_host/render_frame_message_filter_browsertest.cc
index 4e82248118a6b4f537b1545975abcd6ecc532e27..e6c3dcd379d3db2099e00f65f1e4de4ef3595c37 100644
--- a/content/browser/frame_host/render_frame_message_filter_browsertest.cc
+++ b/content/browser/frame_host/render_frame_message_filter_browsertest.cc
@@ -39,6 +39,12 @@ std::string GetCookieFromJS(RenderFrameHost* frame) {
return cookie;
}
+mojom::RenderFrameMessageFilter* GetFilterForProcess(
+ RenderProcessHost* process) {
+ return static_cast<RenderProcessHostImpl*>(process)
+ ->render_frame_message_filter_for_testing();
+}
+
} // namespace
class RenderFrameMessageFilterBrowserTest : public ContentBrowserTest {
@@ -190,18 +196,18 @@ IN_PROC_BROWSER_TEST_F(RenderFrameMessageFilterBrowserTest,
EXPECT_NE(iframe->GetProcess(), main_frame->GetProcess());
- // Try to get cross-site cookies from the subframe's process and wait for it
- // to be killed.
- std::string response;
- FrameHostMsg_GetCookies illegal_get_cookies(
- iframe->GetRoutingID(), GURL("http://127.0.0.1/"),
- GURL("http://127.0.0.1/"), &response);
-
RenderProcessHostWatcher iframe_killed(
iframe->GetProcess(), RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
- IPC::IpcSecurityTestUtil::PwnMessageReceived(
- iframe->GetProcess()->GetChannel(), illegal_get_cookies);
+ // Try to get cross-site cookies from the subframe's process and wait for it
+ // to be killed.
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)->PostTask(
+ FROM_HERE,
+ base::Bind([] (RenderFrameHost* frame) {
+ GetFilterForProcess(frame->GetProcess())->GetCookies(
+ frame->GetRoutingID(), GURL("http://127.0.0.1/"),
+ GURL("http://127.0.0.1/"), base::Bind([] (mojo::String) {}));
+ }, iframe));
iframe_killed.Wait();
@@ -218,15 +224,13 @@ IN_PROC_BROWSER_TEST_F(RenderFrameMessageFilterBrowserTest,
tab->GetMainFrame()->GetProcess(),
RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);
- RenderProcessHostImpl* process =
- static_cast<RenderProcessHostImpl*>(tab->GetMainFrame()->GetProcess());
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)->PostTask(
FROM_HERE,
- base::Bind(
- &mojom::RenderFrameMessageFilter::SetCookie,
- base::Unretained(process->render_frame_message_filter_for_testing()),
- tab->GetMainFrame()->GetRoutingID(), GURL("https://baz.com/"),
- GURL("https://baz.com/"), "pwn=ed"));
+ base::Bind([] (RenderFrameHost* frame) {
+ GetFilterForProcess(frame->GetProcess())->SetCookie(
+ frame->GetRoutingID(), GURL("https://baz.com/"),
+ GURL("https://baz.com/"), "pwn=ed");
+ }, main_frame));
main_frame_killed.Wait();

Powered by Google App Engine
This is Rietveld 408576698