OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/message_loop_proxy.h" |
10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
11 #include "remoting/base/constants.h" | 12 #include "remoting/base/constants.h" |
12 #include "remoting/proto/video.pb.h" | 13 #include "remoting/proto/video.pb.h" |
13 #include "remoting/protocol/fake_session.h" | 14 #include "remoting/protocol/fake_session.h" |
14 #include "remoting/protocol/rtp_reader.h" | 15 #include "remoting/protocol/rtp_reader.h" |
15 #include "remoting/protocol/rtp_utils.h" | 16 #include "remoting/protocol/rtp_utils.h" |
16 #include "remoting/protocol/rtp_video_writer.h" | 17 #include "remoting/protocol/rtp_video_writer.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 using net::IOBuffer; | 20 using net::IOBuffer; |
(...skipping 30 matching lines...) Expand all Loading... |
50 } // namespace | 51 } // namespace |
51 | 52 |
52 class RtpVideoWriterTest : public testing::Test { | 53 class RtpVideoWriterTest : public testing::Test { |
53 protected: | 54 protected: |
54 struct ExpectedPacket { | 55 struct ExpectedPacket { |
55 bool first; | 56 bool first; |
56 Vp8Descriptor::FragmentationInfo fragmentation_info; | 57 Vp8Descriptor::FragmentationInfo fragmentation_info; |
57 bool last; | 58 bool last; |
58 }; | 59 }; |
59 | 60 |
| 61 RtpVideoWriterTest() |
| 62 : writer_(base::MessageLoopProxy::CreateForCurrentThread()) { |
| 63 } |
| 64 |
60 virtual void SetUp() { | 65 virtual void SetUp() { |
61 session_.reset(new FakeSession()); | 66 session_.reset(new FakeSession()); |
62 writer_.Init(session_.get(), | 67 writer_.Init(session_.get(), |
63 base::Bind(&RtpVideoWriterTest::OnWriterInitialized, | 68 base::Bind(&RtpVideoWriterTest::OnWriterInitialized, |
64 base::Unretained(this))); | 69 base::Unretained(this))); |
65 } | 70 } |
66 | 71 |
67 void OnWriterInitialized(bool success) { | 72 void OnWriterInitialized(bool success) { |
68 ASSERT_TRUE(success); | 73 ASSERT_TRUE(success); |
69 } | 74 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 ExpectedPacket expected[] = { | 183 ExpectedPacket expected[] = { |
179 { true, Vp8Descriptor::FIRST_FRAGMENT, false }, | 184 { true, Vp8Descriptor::FIRST_FRAGMENT, false }, |
180 { false, Vp8Descriptor::MIDDLE_FRAGMENT, false }, | 185 { false, Vp8Descriptor::MIDDLE_FRAGMENT, false }, |
181 { false, Vp8Descriptor::LAST_FRAGMENT, true }, | 186 { false, Vp8Descriptor::LAST_FRAGMENT, true }, |
182 }; | 187 }; |
183 VerifyResult(expected, arraysize(expected)); | 188 VerifyResult(expected, arraysize(expected)); |
184 } | 189 } |
185 | 190 |
186 } // namespace protocol | 191 } // namespace protocol |
187 } // namespace remoting | 192 } // namespace remoting |
OLD | NEW |