| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 class VideoDecoderTester { | 55 class VideoDecoderTester { |
| 56 public: | 56 public: |
| 57 VideoDecoderTester(VideoDecoder* decoder, | 57 VideoDecoderTester(VideoDecoder* decoder, |
| 58 const DesktopSize& screen_size, | 58 const DesktopSize& screen_size, |
| 59 const DesktopSize& view_size) | 59 const DesktopSize& view_size) |
| 60 : screen_size_(screen_size), | 60 : screen_size_(screen_size), |
| 61 view_size_(view_size), | 61 view_size_(view_size), |
| 62 strict_(false), | 62 strict_(false), |
| 63 decoder_(decoder), | 63 decoder_(decoder), |
| 64 frame_(NULL) { | 64 frame_(nullptr) { |
| 65 image_data_.reset(new uint8[ | 65 image_data_.reset(new uint8[ |
| 66 view_size_.width() * view_size_.height() * kBytesPerPixel]); | 66 view_size_.width() * view_size_.height() * kBytesPerPixel]); |
| 67 EXPECT_TRUE(image_data_.get()); | 67 EXPECT_TRUE(image_data_.get()); |
| 68 decoder_->Initialize( | 68 decoder_->Initialize( |
| 69 DesktopSize(screen_size_.width(), screen_size_.height())); | 69 DesktopSize(screen_size_.width(), screen_size_.height())); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void Reset() { | 72 void Reset() { |
| 73 expected_region_.Clear(); | 73 expected_region_.Clear(); |
| 74 update_region_.Clear(); | 74 update_region_.Clear(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 scoped_ptr<uint8[]> image_data_; | 198 scoped_ptr<uint8[]> image_data_; |
| 199 DesktopFrame* frame_; | 199 DesktopFrame* frame_; |
| 200 | 200 |
| 201 DISALLOW_COPY_AND_ASSIGN(VideoDecoderTester); | 201 DISALLOW_COPY_AND_ASSIGN(VideoDecoderTester); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 // The VideoEncoderTester provides a hook for retrieving the data, and passing | 204 // The VideoEncoderTester provides a hook for retrieving the data, and passing |
| 205 // the message to other subprograms for validaton. | 205 // the message to other subprograms for validaton. |
| 206 class VideoEncoderTester { | 206 class VideoEncoderTester { |
| 207 public: | 207 public: |
| 208 VideoEncoderTester() | 208 VideoEncoderTester() : decoder_tester_(nullptr), data_available_(0) {} |
| 209 : decoder_tester_(NULL), | |
| 210 data_available_(0) { | |
| 211 } | |
| 212 | 209 |
| 213 ~VideoEncoderTester() { | 210 ~VideoEncoderTester() { |
| 214 EXPECT_GT(data_available_, 0); | 211 EXPECT_GT(data_available_, 0); |
| 215 } | 212 } |
| 216 | 213 |
| 217 void DataAvailable(scoped_ptr<VideoPacket> packet) { | 214 void DataAvailable(scoped_ptr<VideoPacket> packet) { |
| 218 ++data_available_; | 215 ++data_available_; |
| 219 // Send the message to the VideoDecoderTester. | 216 // Send the message to the VideoDecoderTester. |
| 220 if (decoder_tester_) { | 217 if (decoder_tester_) { |
| 221 decoder_tester_->ReceivedPacket(packet.get()); | 218 decoder_tester_->ReceivedPacket(packet.get()); |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 | 439 |
| 443 if (frame_count >= kWarmUpFrameCount) { | 440 if (frame_count >= kWarmUpFrameCount) { |
| 444 elapsed = base::TimeTicks::Now() - start_time; | 441 elapsed = base::TimeTicks::Now() - start_time; |
| 445 } | 442 } |
| 446 } | 443 } |
| 447 | 444 |
| 448 return (frame_count * base::TimeDelta::FromSeconds(1)) / elapsed; | 445 return (frame_count * base::TimeDelta::FromSeconds(1)) / elapsed; |
| 449 } | 446 } |
| 450 | 447 |
| 451 } // namespace remoting | 448 } // namespace remoting |
| OLD | NEW |