Commit 17f6ae1f authored by Gyuyoung Kim's avatar Gyuyoung Kim Committed by Commit Bot

Convert WebTestHostMsg_BlockThirdPartyCookies to Mojo

This CL migrates the legacy BlockThirdPartyCookies IPC message
to the new Mojo defined in WebTestClient interface.

Bug: 1039247
Change-Id: I5b5bfce334dc1ebeb7139befbe0eb9422af2beb8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2032462
Commit-Queue: Gyuyoung Kim <gyuyoung@igalia.com>
Reviewed-by: default avatarDave Tapuska <dtapuska@chromium.org>
Reviewed-by: default avatarMike West <mkwst@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738861}
parent 64ee5022
...@@ -804,8 +804,6 @@ bool BlinkTestController::OnMessageReceived(const IPC::Message& message) { ...@@ -804,8 +804,6 @@ bool BlinkTestController::OnMessageReceived(const IPC::Message& message) {
bool handled = true; bool handled = true;
IPC_BEGIN_MESSAGE_MAP(BlinkTestController, message) IPC_BEGIN_MESSAGE_MAP(BlinkTestController, message)
IPC_MESSAGE_HANDLER(BlinkTestHostMsg_PrintMessage, OnPrintMessage) IPC_MESSAGE_HANDLER(BlinkTestHostMsg_PrintMessage, OnPrintMessage)
IPC_MESSAGE_HANDLER(WebTestHostMsg_BlockThirdPartyCookies,
OnBlockThirdPartyCookies)
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
......
...@@ -198,6 +198,7 @@ class BlinkTestController : public WebContentsObserver, ...@@ -198,6 +198,7 @@ class BlinkTestController : public WebContentsObserver,
void OnSetPopupBlockingEnabled(bool block_popups); void OnSetPopupBlockingEnabled(bool block_popups);
void OnLoadURLForFrame(const GURL& url, const std::string& frame_name); void OnLoadURLForFrame(const GURL& url, const std::string& frame_name);
void OnNavigateSecondaryWindow(const GURL& url); void OnNavigateSecondaryWindow(const GURL& url);
void OnBlockThirdPartyCookies(bool block);
private: private:
enum TestPhase { BETWEEN_TESTS, DURING_TEST, CLEAN_UP }; enum TestPhase { BETWEEN_TESTS, DURING_TEST, CLEAN_UP };
...@@ -232,7 +233,6 @@ class BlinkTestController : public WebContentsObserver, ...@@ -232,7 +233,6 @@ class BlinkTestController : public WebContentsObserver,
void OnTestFinished(); void OnTestFinished();
void OnCaptureSessionHistory(); void OnCaptureSessionHistory();
void OnLeakDetectionDone(const LeakDetector::LeakDetectionReport& report); void OnLeakDetectionDone(const LeakDetector::LeakDetectionReport& report);
void OnBlockThirdPartyCookies(bool block);
mojo::AssociatedRemote<mojom::BlinkTestControl>& GetBlinkTestControlRemote( mojo::AssociatedRemote<mojom::BlinkTestControl>& GetBlinkTestControlRemote(
RenderFrameHost* frame); RenderFrameHost* frame);
void HandleBlinkTestControlError(const GlobalFrameRoutingId& key); void HandleBlinkTestControlError(const GlobalFrameRoutingId& key);
......
...@@ -88,4 +88,8 @@ void WebTestClientImpl::SimulateWebContentIndexDelete(const std::string& id) { ...@@ -88,4 +88,8 @@ void WebTestClientImpl::SimulateWebContentIndexDelete(const std::string& id) {
id); id);
} }
void WebTestClientImpl::BlockThirdPartyCookies(bool block) {
BlinkTestController::Get()->OnBlockThirdPartyCookies(block);
}
} // namespace content } // namespace content
...@@ -32,6 +32,7 @@ class WebTestClientImpl : public mojom::WebTestClient { ...@@ -32,6 +32,7 @@ class WebTestClientImpl : public mojom::WebTestClient {
void SimulateWebNotificationClose(const std::string& title, void SimulateWebNotificationClose(const std::string& title,
bool by_user) override; bool by_user) override;
void SimulateWebContentIndexDelete(const std::string& id) override; void SimulateWebContentIndexDelete(const std::string& id) override;
void BlockThirdPartyCookies(bool block) override;
}; };
} // namespace content } // namespace content
......
...@@ -20,4 +20,9 @@ interface WebTestClient { ...@@ -20,4 +20,9 @@ interface WebTestClient {
// - |title|: the title of the notification. // - |title|: the title of the notification.
// - |by_user|: whether the user clicks the notification. // - |by_user|: whether the user clicks the notification.
SimulateWebNotificationClose(string title, bool by_user); SimulateWebNotificationClose(string title, bool by_user);
};
\ No newline at end of file // Sets the cookie policy to:
// - allow all cookies when |block| is false
// - block only third-party cookies when |block| is true
BlockThirdPartyCookies(bool block);
};
...@@ -32,7 +32,6 @@ IPC_MESSAGE_ROUTED3(WebTestHostMsg_SimulateWebNotificationClick, ...@@ -32,7 +32,6 @@ IPC_MESSAGE_ROUTED3(WebTestHostMsg_SimulateWebNotificationClick,
std::string /* title */, std::string /* title */,
base::Optional<int> /* action_index */, base::Optional<int> /* action_index */,
base::Optional<base::string16> /* reply */) base::Optional<base::string16> /* reply */)
IPC_MESSAGE_ROUTED1(WebTestHostMsg_BlockThirdPartyCookies, bool /* block */)
IPC_MESSAGE_ROUTED0(WebTestHostMsg_DeleteAllCookies) IPC_MESSAGE_ROUTED0(WebTestHostMsg_DeleteAllCookies)
IPC_MESSAGE_ROUTED4(WebTestHostMsg_SetPermission, IPC_MESSAGE_ROUTED4(WebTestHostMsg_SetPermission,
std::string /* name */, std::string /* name */,
......
...@@ -378,7 +378,7 @@ void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) { ...@@ -378,7 +378,7 @@ void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) {
} }
void BlinkTestRunner::SetBlockThirdPartyCookies(bool block) { void BlinkTestRunner::SetBlockThirdPartyCookies(bool block) {
Send(new WebTestHostMsg_BlockThirdPartyCookies(routing_id(), block)); GetWebTestClientRemote().BlockThirdPartyCookies(block);
} }
std::string BlinkTestRunner::PathToLocalResource(const std::string& resource) { std::string BlinkTestRunner::PathToLocalResource(const std::string& resource) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment