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

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

Issue 9114020: Remove task.h and finish base::Bind() migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/rtp_video_writer.cc ('k') | remoting/protocol/util.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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 134 writer_.ProcessVideoPacket(
135 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_)); 135 packet_, base::Bind(&base::DeletePointer<VideoPacket>, packet_));
136 message_loop_.RunAllPending(); 136 message_loop_.RunAllPending();
137 137
138 ExpectedPacket expected[] = { 138 ExpectedPacket expected[] = {
139 { true, Vp8Descriptor::NOT_FRAGMENTED, false } 139 { true, Vp8Descriptor::NOT_FRAGMENTED, false }
140 }; 140 };
141 VerifyResult(expected, arraysize(expected)); 141 VerifyResult(expected, arraysize(expected));
142 } 142 }
143 143
144 TEST_F(RtpVideoWriterTest, NotFragmented_LastPackes) { 144 TEST_F(RtpVideoWriterTest, NotFragmented_LastPackes) {
145 InitPacket(1024, false, true); 145 InitPacket(1024, false, true);
146 writer_.ProcessVideoPacket( 146 writer_.ProcessVideoPacket(
147 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_)); 147 packet_, base::Bind(&base::DeletePointer<VideoPacket>, packet_));
148 message_loop_.RunAllPending(); 148 message_loop_.RunAllPending();
149 149
150 ExpectedPacket expected[] = { 150 ExpectedPacket expected[] = {
151 { false, Vp8Descriptor::NOT_FRAGMENTED, true } 151 { false, Vp8Descriptor::NOT_FRAGMENTED, true }
152 }; 152 };
153 VerifyResult(expected, arraysize(expected)); 153 VerifyResult(expected, arraysize(expected));
154 } 154 }
155 155
156 TEST_F(RtpVideoWriterTest, TwoFragments_FirstPacket) { 156 TEST_F(RtpVideoWriterTest, TwoFragments_FirstPacket) {
157 InitPacket(2000, true, false); 157 InitPacket(2000, true, false);
158 writer_.ProcessVideoPacket( 158 writer_.ProcessVideoPacket(
159 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_)); 159 packet_, base::Bind(&base::DeletePointer<VideoPacket>, packet_));
160 message_loop_.RunAllPending(); 160 message_loop_.RunAllPending();
161 161
162 ExpectedPacket expected[] = { 162 ExpectedPacket expected[] = {
163 { true, Vp8Descriptor::FIRST_FRAGMENT, false }, 163 { true, Vp8Descriptor::FIRST_FRAGMENT, false },
164 { false, Vp8Descriptor::LAST_FRAGMENT, false }, 164 { false, Vp8Descriptor::LAST_FRAGMENT, false },
165 }; 165 };
166 VerifyResult(expected, arraysize(expected)); 166 VerifyResult(expected, arraysize(expected));
167 } 167 }
168 168
169 TEST_F(RtpVideoWriterTest, TwoFragments_LastPacket) { 169 TEST_F(RtpVideoWriterTest, TwoFragments_LastPacket) {
170 InitPacket(2000, false, true); 170 InitPacket(2000, false, true);
171 writer_.ProcessVideoPacket( 171 writer_.ProcessVideoPacket(
172 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_)); 172 packet_, base::Bind(&base::DeletePointer<VideoPacket>, packet_));
173 message_loop_.RunAllPending(); 173 message_loop_.RunAllPending();
174 174
175 ExpectedPacket expected[] = { 175 ExpectedPacket expected[] = {
176 { false, Vp8Descriptor::FIRST_FRAGMENT, false }, 176 { false, Vp8Descriptor::FIRST_FRAGMENT, false },
177 { false, Vp8Descriptor::LAST_FRAGMENT, true }, 177 { false, Vp8Descriptor::LAST_FRAGMENT, true },
178 }; 178 };
179 VerifyResult(expected, arraysize(expected)); 179 VerifyResult(expected, arraysize(expected));
180 } 180 }
181 181
182 TEST_F(RtpVideoWriterTest, ThreeFragments) { 182 TEST_F(RtpVideoWriterTest, ThreeFragments) {
183 InitPacket(3000, true, true); 183 InitPacket(3000, true, true);
184 writer_.ProcessVideoPacket( 184 writer_.ProcessVideoPacket(
185 packet_, base::Bind(&DeletePointer<VideoPacket>, packet_)); 185 packet_, base::Bind(&base::DeletePointer<VideoPacket>, packet_));
186 message_loop_.RunAllPending(); 186 message_loop_.RunAllPending();
187 187
188 ExpectedPacket expected[] = { 188 ExpectedPacket expected[] = {
189 { true, Vp8Descriptor::FIRST_FRAGMENT, false }, 189 { true, Vp8Descriptor::FIRST_FRAGMENT, false },
190 { false, Vp8Descriptor::MIDDLE_FRAGMENT, false }, 190 { false, Vp8Descriptor::MIDDLE_FRAGMENT, false },
191 { false, Vp8Descriptor::LAST_FRAGMENT, true }, 191 { false, Vp8Descriptor::LAST_FRAGMENT, true },
192 }; 192 };
193 VerifyResult(expected, arraysize(expected)); 193 VerifyResult(expected, arraysize(expected));
194 } 194 }
195 195
196 } // namespace protocol 196 } // namespace protocol
197 } // namespace remoting 197 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/rtp_video_writer.cc ('k') | remoting/protocol/util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698