summaryrefslogtreecommitdiffstats
path: root/remoting/protocol/message_decoder_unittest.cc
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 21:58:01 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-14 21:58:01 +0000
commit051916e611af748469e61ac32a4ae65eb126deaf (patch)
treec9b52630f0c5b1cf5ab5497d69404a1b351604f9 /remoting/protocol/message_decoder_unittest.cc
parent0a5fb17a569ccc83ecc1d340af9c90279e9e9817 (diff)
downloadchromium_src-051916e611af748469e61ac32a4ae65eb126deaf.zip
chromium_src-051916e611af748469e61ac32a4ae65eb126deaf.tar.gz
chromium_src-051916e611af748469e61ac32a4ae65eb126deaf.tar.bz2
Simplified MessageReader and MessageDecoder classes.
Now these two classes are not templates, and just handle raw data. New ProtobufMessageReader is used to parse messages. BUG=None TEST=Unittests. Review URL: http://codereview.chromium.org/6277003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71497 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol/message_decoder_unittest.cc')
-rw-r--r--remoting/protocol/message_decoder_unittest.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc
index f2ecfcc..81bb699 100644
--- a/remoting/protocol/message_decoder_unittest.cc
+++ b/remoting/protocol/message_decoder_unittest.cc
@@ -69,7 +69,17 @@ void SimulateReadSequence(const int read_sequence[], int sequence_size) {
// And then prepare an IOBuffer for feeding it.
scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(read));
memcpy(buffer->data(), test_data + i, read);
- decoder.ParseMessages(buffer, read, &message_list);
+ decoder.AddData(buffer, read);
+ while (true) {
+ CompoundBuffer message;
+ if (!decoder.GetNextMessage(&message))
+ break;
+
+ EventMessage* event = new EventMessage();
+ CompoundBufferInputStream stream(&message);
+ ASSERT_TRUE(event->ParseFromZeroCopyStream(&stream));
+ message_list.push_back(event);
+ }
i += read;
}