Commit 75acd15f authored by takumif's avatar takumif Committed by Commit bot

Unit test for PresentationDispatcher

This CL adds test cases for methods in the blink::WebPresentationClient
interface implemented by PresentationDispatcher.

BUG=576808

Review-Url: https://codereview.chromium.org/2597853002
Cr-Commit-Position: refs/heads/master@{#441752}
parent 01b84566
...@@ -36,6 +36,8 @@ class WebVector; ...@@ -36,6 +36,8 @@ class WebVector;
namespace content { namespace content {
class TestPresentationDispatcher;
// PresentationDispatcher is a delegate for Presentation API messages used by // PresentationDispatcher is a delegate for Presentation API messages used by
// Blink. It forwards the calls to the Mojo PresentationService. // Blink. It forwards the calls to the Mojo PresentationService.
class CONTENT_EXPORT PresentationDispatcher class CONTENT_EXPORT PresentationDispatcher
...@@ -47,6 +49,21 @@ class CONTENT_EXPORT PresentationDispatcher ...@@ -47,6 +49,21 @@ class CONTENT_EXPORT PresentationDispatcher
~PresentationDispatcher() override; ~PresentationDispatcher() override;
private: private:
friend class TestPresentationDispatcher;
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSession);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestStartSessionError);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSession);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestJoinSessionError);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendString);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendArrayBuffer);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestSendBlobData);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestCloseSession);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest, TestTerminateSession);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest,
TestListenForScreenAvailability);
FRIEND_TEST_ALL_PREFIXES(PresentationDispatcherTest,
TestSetDefaultPresentationUrls);
struct SendMessageRequest { struct SendMessageRequest {
SendMessageRequest(blink::mojom::PresentationSessionInfoPtr session_info, SendMessageRequest(blink::mojom::PresentationSessionInfoPtr session_info,
blink::mojom::ConnectionMessagePtr message); blink::mojom::ConnectionMessagePtr message);
...@@ -137,7 +154,7 @@ class CONTENT_EXPORT PresentationDispatcher ...@@ -137,7 +154,7 @@ class CONTENT_EXPORT PresentationDispatcher
void DoSendMessage(SendMessageRequest* request); void DoSendMessage(SendMessageRequest* request);
void HandleSendMessageRequests(bool success); void HandleSendMessageRequests(bool success);
void ConnectToPresentationServiceIfNeeded(); virtual void ConnectToPresentationServiceIfNeeded();
void UpdateListeningState(); void UpdateListeningState();
......
...@@ -1357,6 +1357,7 @@ test("content_unittests") { ...@@ -1357,6 +1357,7 @@ test("content_unittests") {
"../renderer/media/video_capture_impl_unittest.cc", "../renderer/media/video_capture_impl_unittest.cc",
"../renderer/media/webmediaplayer_ms_unittest.cc", "../renderer/media/webmediaplayer_ms_unittest.cc",
"../renderer/peripheral_content_heuristic_unittest.cc", "../renderer/peripheral_content_heuristic_unittest.cc",
"../renderer/presentation/presentation_dispatcher_unittest.cc",
"../renderer/render_thread_impl_unittest.cc", "../renderer/render_thread_impl_unittest.cc",
"../renderer/render_widget_unittest.cc", "../renderer/render_widget_unittest.cc",
"../renderer/scheduler/resource_dispatch_throttler_unittest.cc", "../renderer/scheduler/resource_dispatch_throttler_unittest.cc",
......
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