OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <deque> | 5 #include <deque> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 EncoderTester(EncoderMessageTester* message_tester) | 204 EncoderTester(EncoderMessageTester* message_tester) |
205 : message_tester_(message_tester), | 205 : message_tester_(message_tester), |
206 decoder_tester_(NULL), | 206 decoder_tester_(NULL), |
207 data_available_(0) { | 207 data_available_(0) { |
208 } | 208 } |
209 | 209 |
210 ~EncoderTester() { | 210 ~EncoderTester() { |
211 EXPECT_GT(data_available_, 0); | 211 EXPECT_GT(data_available_, 0); |
212 } | 212 } |
213 | 213 |
214 void DataAvailable(VideoPacket *packet) { | 214 void DataAvailable(scoped_ptr<VideoPacket> packet) { |
215 ++data_available_; | 215 ++data_available_; |
216 message_tester_->ReceivedPacket(packet); | 216 message_tester_->ReceivedPacket(packet.get()); |
217 | 217 |
218 // Send the message to the DecoderTester. | 218 // Send the message to the DecoderTester. |
219 if (decoder_tester_) { | 219 if (decoder_tester_) { |
220 decoder_tester_->ReceivedPacket(packet); | 220 decoder_tester_->ReceivedPacket(packet.get()); |
221 } | 221 } |
222 | |
223 delete packet; | |
224 } | 222 } |
225 | 223 |
226 void AddRects(const SkIRect* rects, int count) { | 224 void AddRects(const SkIRect* rects, int count) { |
227 message_tester_->AddRects(rects, count); | 225 message_tester_->AddRects(rects, count); |
228 } | 226 } |
229 | 227 |
230 void set_decoder_tester(DecoderTester* decoder_tester) { | 228 void set_decoder_tester(DecoderTester* decoder_tester) { |
231 decoder_tester_ = decoder_tester; | 229 decoder_tester_ = decoder_tester; |
232 } | 230 } |
233 | 231 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 kTestRects, 1); | 341 kTestRects, 1); |
344 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, | 342 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, |
345 kTestRects + 1, 1); | 343 kTestRects + 1, 1); |
346 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, | 344 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, |
347 kTestRects + 2, 1); | 345 kTestRects + 2, 1); |
348 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, | 346 TestEncodeDecodeRects(encoder, &encoder_tester, &decoder_tester, data, |
349 kTestRects + 3, 2); | 347 kTestRects + 3, 2); |
350 } | 348 } |
351 | 349 |
352 } // namespace remoting | 350 } // namespace remoting |
OLD | NEW |