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 29 matching lines...) Expand all Loading... |
40 bytes_sent_ += packet->data.size(); | 40 bytes_sent_ += packet->data.size(); |
41 return true; | 41 return true; |
42 } | 42 } |
43 | 43 |
44 virtual int64 GetBytesSent() OVERRIDE { | 44 virtual int64 GetBytesSent() OVERRIDE { |
45 return bytes_sent_; | 45 return bytes_sent_; |
46 } | 46 } |
47 | 47 |
48 void SetPaused(bool paused) { | 48 void SetPaused(bool paused) { |
49 paused_ = paused; | 49 paused_ = paused; |
50 if (!paused && stored_packet_) { | 50 if (!paused && stored_packet_.get()) { |
51 SendPacket(stored_packet_, callback_); | 51 SendPacket(stored_packet_, callback_); |
52 callback_.Run(); | 52 callback_.Run(); |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 int packets_sent() const { return packets_sent_; } | 56 int packets_sent() const { return packets_sent_; } |
57 | 57 |
58 private: | 58 private: |
59 bool paused_; | 59 bool paused_; |
60 base::Closure callback_; | 60 base::Closure callback_; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); | 341 task_runner_->Sleep(base::TimeDelta::FromMilliseconds(2)); |
342 transport_sender_->OnReceivedCastMessage(kVideoSsrc, | 342 transport_sender_->OnReceivedCastMessage(kVideoSsrc, |
343 RtcpCastMessageCallback(), | 343 RtcpCastMessageCallback(), |
344 cast_message); | 344 cast_message); |
345 task_runner_->RunTasks(); | 345 task_runner_->RunTasks(); |
346 EXPECT_EQ(7, transport_.packets_sent()); | 346 EXPECT_EQ(7, transport_.packets_sent()); |
347 } | 347 } |
348 | 348 |
349 } // namespace cast | 349 } // namespace cast |
350 } // namespace media | 350 } // namespace media |
OLD | NEW |