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

Unified Diff: remoting/protocol/client_video_dispatcher_unittest.cc

Issue 1654513003: Simplify message parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no_done
Patch Set: Created 4 years, 11 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
« no previous file with comments | « remoting/protocol/client_video_dispatcher.cc ('k') | remoting/protocol/host_control_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/client_video_dispatcher_unittest.cc
diff --git a/remoting/protocol/client_video_dispatcher_unittest.cc b/remoting/protocol/client_video_dispatcher_unittest.cc
index 732fecbf92a16d270fd3e43194205648c1c6dbaa..bc31d1a7d92825040d9c8f910ee4d234efc8e19e 100644
--- a/remoting/protocol/client_video_dispatcher_unittest.cc
+++ b/remoting/protocol/client_video_dispatcher_unittest.cc
@@ -35,7 +35,7 @@ class ClientVideoDispatcherTest : public testing::Test,
ErrorCode error) override;
protected:
- void OnVideoAck(scoped_ptr<VideoAck> ack);
+ void OnMessageReceived(scoped_ptr<CompoundBuffer> buffer);
void OnReadError(int error);
base::MessageLoop message_loop_;
@@ -50,7 +50,6 @@ class ClientVideoDispatcherTest : public testing::Test,
// Host side.
FakeStreamSocket host_socket_;
MessageReader reader_;
- ProtobufMessageParser<VideoAck> parser_;
BufferedSocketWriter writer_;
ScopedVector<VideoPacket> video_packets_;
@@ -61,16 +60,15 @@ class ClientVideoDispatcherTest : public testing::Test,
ClientVideoDispatcherTest::ClientVideoDispatcherTest()
: initialized_(false),
- dispatcher_(this),
- parser_(base::Bind(&ClientVideoDispatcherTest::OnVideoAck,
- base::Unretained(this)),
- &reader_) {
+ dispatcher_(this) {
dispatcher_.Init(&client_channel_factory_, this);
base::RunLoop().RunUntilIdle();
DCHECK(initialized_);
host_socket_.PairWith(
client_channel_factory_.GetFakeChannel(kVideoChannelName));
reader_.StartReading(&host_socket_,
+ base::Bind(&ClientVideoDispatcherTest::OnMessageReceived,
+ base::Unretained(this)),
base::Bind(&ClientVideoDispatcherTest::OnReadError,
base::Unretained(this)));
writer_.Start(
@@ -97,7 +95,10 @@ void ClientVideoDispatcherTest::OnChannelError(
FAIL();
}
-void ClientVideoDispatcherTest::OnVideoAck(scoped_ptr<VideoAck> ack) {
+void ClientVideoDispatcherTest::OnMessageReceived(
+ scoped_ptr<CompoundBuffer> buffer) {
+ scoped_ptr<VideoAck> ack = ParseMessage<VideoAck>(buffer.get());
+ EXPECT_TRUE(ack);
ack_messages_.push_back(ack.release());
}
« no previous file with comments | « remoting/protocol/client_video_dispatcher.cc ('k') | remoting/protocol/host_control_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698