| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const int64 kStartMillisecond = INT64_C(12345678900000); | 24 const int64 kStartMillisecond = INT64_C(12345678900000); |
| 25 const uint32 kVideoSsrc = 1; | 25 const uint32 kVideoSsrc = 1; |
| 26 const uint32 kAudioSsrc = 2; | 26 const uint32 kAudioSsrc = 2; |
| 27 } // namespace | 27 } // namespace |
| 28 | 28 |
| 29 class FakePacketSender : public PacketSender { | 29 class FakePacketSender : public PacketSender { |
| 30 public: | 30 public: |
| 31 FakePacketSender() | 31 FakePacketSender() |
| 32 : paused_(false), packets_sent_(0), bytes_sent_(0) {} | 32 : paused_(false), packets_sent_(0), bytes_sent_(0) {} |
| 33 | 33 |
| 34 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) OVERRIDE { | 34 virtual bool SendPacket(PacketRef packet, const base::Closure& cb) override { |
| 35 if (paused_) { | 35 if (paused_) { |
| 36 stored_packet_ = packet; | 36 stored_packet_ = packet; |
| 37 callback_ = cb; | 37 callback_ = cb; |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 ++packets_sent_; | 40 ++packets_sent_; |
| 41 bytes_sent_ += packet->data.size(); | 41 bytes_sent_ += packet->data.size(); |
| 42 return true; | 42 return true; |
| 43 } | 43 } |
| 44 | 44 |
| 45 virtual int64 GetBytesSent() OVERRIDE { | 45 virtual int64 GetBytesSent() override { |
| 46 return bytes_sent_; | 46 return bytes_sent_; |
| 47 } | 47 } |
| 48 | 48 |
| 49 void SetPaused(bool paused) { | 49 void SetPaused(bool paused) { |
| 50 paused_ = paused; | 50 paused_ = paused; |
| 51 if (!paused && stored_packet_.get()) { | 51 if (!paused && stored_packet_.get()) { |
| 52 SendPacket(stored_packet_, callback_); | 52 SendPacket(stored_packet_, callback_); |
| 53 callback_.Run(); | 53 callback_.Run(); |
| 54 } | 54 } |
| 55 } | 55 } |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); | 369 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); |
| 370 transport_sender_->OnReceivedCastMessage(kVideoSsrc, | 370 transport_sender_->OnReceivedCastMessage(kVideoSsrc, |
| 371 RtcpCastMessageCallback(), | 371 RtcpCastMessageCallback(), |
| 372 cast_message); | 372 cast_message); |
| 373 task_runner_->RunTasks(); | 373 task_runner_->RunTasks(); |
| 374 EXPECT_EQ(7, transport_.packets_sent()); | 374 EXPECT_EQ(7, transport_.packets_sent()); |
| 375 } | 375 } |
| 376 | 376 |
| 377 } // namespace cast | 377 } // namespace cast |
| 378 } // namespace media | 378 } // namespace media |
| OLD | NEW |