Index: content/renderer/presentation/presentation_dispatcher_unittest.cc |
diff --git a/content/renderer/presentation/presentation_dispatcher_unittest.cc b/content/renderer/presentation/presentation_dispatcher_unittest.cc |
index 8f49caeb66cd62072e731cc1e62be6e3458ea0b4..4cdbc2aa3fa265fed5edf2983e083da65e736778 100644 |
--- a/content/renderer/presentation/presentation_dispatcher_unittest.cc |
+++ b/content/renderer/presentation/presentation_dispatcher_unittest.cc |
@@ -7,9 +7,13 @@ |
#include "base/run_loop.h" |
#include "content/public/test/test_browser_thread_bundle.h" |
+#include "content/renderer/presentation/presentation_connection_proxy.h" |
#include "content/renderer/presentation/presentation_dispatcher.h" |
#include "testing/gmock/include/gmock/gmock.h" |
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationAvailabilityObserver.h" |
+#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationConnection.h" |
+#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationConnectionCallbacks.h" |
+#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationController.h" |
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationError.h" |
#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationSessionInfo.h" |
#include "third_party/WebKit/public/web/WebArrayBuffer.h" |
@@ -19,7 +23,7 @@ using ::testing::Invoke; |
using blink::WebArrayBuffer; |
using blink::WebPresentationAvailabilityCallbacks; |
using blink::WebPresentationAvailabilityObserver; |
-using blink::WebPresentationConnectionCallback; |
+using blink::WebPresentationConnectionCallbacks; |
using blink::WebPresentationError; |
using blink::WebPresentationSessionInfo; |
using blink::WebString; |
@@ -117,8 +121,22 @@ class MockPresentationService : public PresentationService { |
PresentationConnection* connection)); |
}; |
+class TestPresentationConnection : public blink::WebPresentationConnection { |
mark a. foltz
2017/01/23 20:18:42
Is this identical to the one in presentation_conne
zhaobin
2017/01/24 01:23:24
Done.
|
+ public: |
+ void bindProxy( |
+ std::unique_ptr<blink::WebPresentationConnectionProxy> proxy) override { |
+ proxy_ = std::move(proxy); |
+ } |
+ MOCK_METHOD1(didReceiveTextMessage, void(const WebString& message)); |
+ MOCK_METHOD2(didReceiveBinaryMessage, |
+ void(const uint8_t* data, size_t length)); |
+ MOCK_METHOD1(didChangeState, void(blink::WebPresentationConnectionState)); |
+ |
+ std::unique_ptr<blink::WebPresentationConnectionProxy> proxy_; |
+}; |
+ |
class TestWebPresentationConnectionCallback |
- : public WebPresentationConnectionCallback { |
+ : public WebPresentationConnectionCallbacks { |
public: |
TestWebPresentationConnectionCallback(WebURL url, WebString id) |
: url_(url), id_(id), callback_called_(false) {} |
@@ -132,14 +150,19 @@ class TestWebPresentationConnectionCallback |
EXPECT_EQ(info.id, id_); |
} |
+ blink::WebPresentationConnection* getConnection() override { |
+ return &connection_; |
+ } |
+ |
private: |
const WebURL url_; |
const WebString id_; |
bool callback_called_; |
+ TestPresentationConnection connection_; |
}; |
class TestWebPresentationConnectionErrorCallback |
- : public WebPresentationConnectionCallback { |
+ : public WebPresentationConnectionCallbacks { |
public: |
TestWebPresentationConnectionErrorCallback( |
WebPresentationError::ErrorType error_type, |
@@ -155,6 +178,8 @@ class TestWebPresentationConnectionErrorCallback |
EXPECT_EQ(error.message, message_); |
} |
+ blink::WebPresentationConnection* getConnection() override { return nullptr; } |
+ |
private: |
const WebPresentationError::ErrorType error_type_; |
const WebString message_; |
@@ -320,7 +345,7 @@ TEST_F(PresentationDispatcherTest, TestSendString) { |
EXPECT_EQ(message.utf8(), message_request->message.value()); |
callback.Run(true); |
})); |
- dispatcher_.sendString(url1_, presentation_id_, message); |
+ dispatcher_.sendString(url1_, presentation_id_, message, nullptr); |
run_loop.RunUntilIdle(); |
} |
@@ -341,7 +366,7 @@ TEST_F(PresentationDispatcherTest, TestSendArrayBuffer) { |
callback.Run(true); |
})); |
dispatcher_.sendArrayBuffer(url1_, presentation_id_, array_buffer_data(), |
- array_buffer_.byteLength()); |
+ array_buffer_.byteLength(), nullptr); |
run_loop.RunUntilIdle(); |
} |
@@ -362,7 +387,7 @@ TEST_F(PresentationDispatcherTest, TestSendBlobData) { |
callback.Run(true); |
})); |
dispatcher_.sendBlobData(url1_, presentation_id_, array_buffer_data(), |
- array_buffer_.byteLength()); |
+ array_buffer_.byteLength(), nullptr); |
run_loop.RunUntilIdle(); |
} |