OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "blimp/net/blimp_message_output_buffer.h" | 5 #include "blimp/net/blimp_message_output_buffer.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 using testing::SaveArg; | 22 using testing::SaveArg; |
23 | 23 |
24 namespace blimp { | 24 namespace blimp { |
25 namespace { | 25 namespace { |
26 | 26 |
27 class BlimpMessageOutputBufferTest : public testing::Test { | 27 class BlimpMessageOutputBufferTest : public testing::Test { |
28 public: | 28 public: |
29 BlimpMessageOutputBufferTest() {} | 29 BlimpMessageOutputBufferTest() {} |
30 | 30 |
31 void SetUp() override { | 31 void SetUp() override { |
32 input_msg_.set_type(BlimpMessage::INPUT); | 32 input_msg_.mutable_input(); |
33 input_msg_.set_message_id(1); | 33 input_msg_.set_message_id(1); |
34 compositor_msg_.set_type(BlimpMessage::COMPOSITOR); | 34 compositor_msg_.mutable_compositor(); |
35 compositor_msg_.set_message_id(2); | 35 compositor_msg_.set_message_id(2); |
36 | 36 |
37 // Buffer should only have space for two unacknowledged messages | 37 // Buffer should only have space for two unacknowledged messages |
38 // (with message IDs). | 38 // (with message IDs). |
39 ASSERT_EQ(input_msg_.ByteSize(), compositor_msg_.ByteSize()); | 39 ASSERT_EQ(input_msg_.ByteSize(), compositor_msg_.ByteSize()); |
40 buffer_.reset(new BlimpMessageOutputBuffer(2 * input_msg_.GetCachedSize())); | 40 buffer_.reset(new BlimpMessageOutputBuffer(2 * input_msg_.GetCachedSize())); |
41 } | 41 } |
42 | 42 |
43 protected: | 43 protected: |
44 void AddOutputExpectation(const BlimpMessage& msg) { | 44 void AddOutputExpectation(const BlimpMessage& msg) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 254 |
255 // Remote end acknowledges #1, buffer should be empty. | 255 // Remote end acknowledges #1, buffer should be empty. |
256 buffer_->OnMessageCheckpoint(2); | 256 buffer_->OnMessageCheckpoint(2); |
257 ASSERT_EQ(0, buffer_->GetBufferByteSizeForTest()); | 257 ASSERT_EQ(0, buffer_->GetBufferByteSizeForTest()); |
258 ASSERT_EQ(0, buffer_->GetUnacknowledgedMessageCountForTest()); | 258 ASSERT_EQ(0, buffer_->GetUnacknowledgedMessageCountForTest()); |
259 EXPECT_EQ(net::OK, complete_cb_2.WaitForResult()); | 259 EXPECT_EQ(net::OK, complete_cb_2.WaitForResult()); |
260 } | 260 } |
261 | 261 |
262 } // namespace | 262 } // namespace |
263 } // namespace blimp | 263 } // namespace blimp |
OLD | NEW |