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

Side by Side Diff: remoting/protocol/rtp_video_writer_unittest.cc

Issue 8116021: Switch remoting/protocol to new callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/rtp_video_writer.cc ('k') | remoting/protocol/rtp_writer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/message_loop_proxy.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 124
125 scoped_ptr<FakeSession> session_; 125 scoped_ptr<FakeSession> session_;
126 RtpVideoWriter writer_; 126 RtpVideoWriter writer_;
127 127
128 vector<char> data_; 128 vector<char> data_;
129 VideoPacket* packet_; 129 VideoPacket* packet_;
130 }; 130 };
131 131
132 TEST_F(RtpVideoWriterTest, NotFragmented_FirstPacket) { 132 TEST_F(RtpVideoWriterTest, NotFragmented_FirstPacket) {
133 InitPacket(1024, true, false); 133 InitPacket(1024, true, false);
134 writer_.ProcessVideoPacket(packet_, new DeleteTask<VideoPacket>(packet_)); 134 writer_.ProcessVideoPacket(
135 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_));
135 message_loop_.RunAllPending(); 136 message_loop_.RunAllPending();
136 137
137 ExpectedPacket expected[] = { 138 ExpectedPacket expected[] = {
138 { true, Vp8Descriptor::NOT_FRAGMENTED, false } 139 { true, Vp8Descriptor::NOT_FRAGMENTED, false }
139 }; 140 };
140 VerifyResult(expected, arraysize(expected)); 141 VerifyResult(expected, arraysize(expected));
141 } 142 }
142 143
143 TEST_F(RtpVideoWriterTest, NotFragmented_LastPackes) { 144 TEST_F(RtpVideoWriterTest, NotFragmented_LastPackes) {
144 InitPacket(1024, false, true); 145 InitPacket(1024, false, true);
145 writer_.ProcessVideoPacket(packet_, new DeleteTask<VideoPacket>(packet_)); 146 writer_.ProcessVideoPacket(
147 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_));
146 message_loop_.RunAllPending(); 148 message_loop_.RunAllPending();
147 149
148 ExpectedPacket expected[] = { 150 ExpectedPacket expected[] = {
149 { false, Vp8Descriptor::NOT_FRAGMENTED, true } 151 { false, Vp8Descriptor::NOT_FRAGMENTED, true }
150 }; 152 };
151 VerifyResult(expected, arraysize(expected)); 153 VerifyResult(expected, arraysize(expected));
152 } 154 }
153 155
154 TEST_F(RtpVideoWriterTest, TwoFragments_FirstPacket) { 156 TEST_F(RtpVideoWriterTest, TwoFragments_FirstPacket) {
155 InitPacket(2000, true, false); 157 InitPacket(2000, true, false);
156 writer_.ProcessVideoPacket(packet_, new DeleteTask<VideoPacket>(packet_)); 158 writer_.ProcessVideoPacket(
159 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_));
157 message_loop_.RunAllPending(); 160 message_loop_.RunAllPending();
158 161
159 ExpectedPacket expected[] = { 162 ExpectedPacket expected[] = {
160 { true, Vp8Descriptor::FIRST_FRAGMENT, false }, 163 { true, Vp8Descriptor::FIRST_FRAGMENT, false },
161 { false, Vp8Descriptor::LAST_FRAGMENT, false }, 164 { false, Vp8Descriptor::LAST_FRAGMENT, false },
162 }; 165 };
163 VerifyResult(expected, arraysize(expected)); 166 VerifyResult(expected, arraysize(expected));
164 } 167 }
165 168
166 TEST_F(RtpVideoWriterTest, TwoFragments_LastPacket) { 169 TEST_F(RtpVideoWriterTest, TwoFragments_LastPacket) {
167 InitPacket(2000, false, true); 170 InitPacket(2000, false, true);
168 writer_.ProcessVideoPacket(packet_, new DeleteTask<VideoPacket>(packet_)); 171 writer_.ProcessVideoPacket(
172 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_));
169 message_loop_.RunAllPending(); 173 message_loop_.RunAllPending();
170 174
171 ExpectedPacket expected[] = { 175 ExpectedPacket expected[] = {
172 { false, Vp8Descriptor::FIRST_FRAGMENT, false }, 176 { false, Vp8Descriptor::FIRST_FRAGMENT, false },
173 { false, Vp8Descriptor::LAST_FRAGMENT, true }, 177 { false, Vp8Descriptor::LAST_FRAGMENT, true },
174 }; 178 };
175 VerifyResult(expected, arraysize(expected)); 179 VerifyResult(expected, arraysize(expected));
176 } 180 }
177 181
178 TEST_F(RtpVideoWriterTest, ThreeFragments) { 182 TEST_F(RtpVideoWriterTest, ThreeFragments) {
179 InitPacket(3000, true, true); 183 InitPacket(3000, true, true);
180 writer_.ProcessVideoPacket(packet_, new DeleteTask<VideoPacket>(packet_)); 184 writer_.ProcessVideoPacket(
185 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_));
181 message_loop_.RunAllPending(); 186 message_loop_.RunAllPending();
182 187
183 ExpectedPacket expected[] = { 188 ExpectedPacket expected[] = {
184 { true, Vp8Descriptor::FIRST_FRAGMENT, false }, 189 { true, Vp8Descriptor::FIRST_FRAGMENT, false },
185 { false, Vp8Descriptor::MIDDLE_FRAGMENT, false }, 190 { false, Vp8Descriptor::MIDDLE_FRAGMENT, false },
186 { false, Vp8Descriptor::LAST_FRAGMENT, true }, 191 { false, Vp8Descriptor::LAST_FRAGMENT, true },
187 }; 192 };
188 VerifyResult(expected, arraysize(expected)); 193 VerifyResult(expected, arraysize(expected));
189 } 194 }
190 195
191 } // namespace protocol 196 } // namespace protocol
192 } // namespace remoting 197 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/rtp_video_writer.cc ('k') | remoting/protocol/rtp_writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698