| 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 "content/browser/renderer_host/p2p/socket_host_udp.h" | 5 #include "content/browser/renderer_host/p2p/socket_host_udp.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // TODO(nisse): We can't currently use rtc::ScopedFakeClock, because | 32 // TODO(nisse): We can't currently use rtc::ScopedFakeClock, because |
| 33 // we don't link with webrtc rtc_base_tests_utils. So roll our own. | 33 // we don't link with webrtc rtc_base_tests_utils. So roll our own. |
| 34 | 34 |
| 35 // Creating an object of this class makes rtc::TimeMicros() and | 35 // Creating an object of this class makes rtc::TimeMicros() and |
| 36 // related functions return zero unless the clock is advanced. | 36 // related functions return zero unless the clock is advanced. |
| 37 class ScopedFakeClock : public rtc::ClockInterface { | 37 class ScopedFakeClock : public rtc::ClockInterface { |
| 38 public: | 38 public: |
| 39 ScopedFakeClock() { prev_clock_ = rtc::SetClockForTesting(this); } | 39 ScopedFakeClock() { prev_clock_ = rtc::SetClockForTesting(this); } |
| 40 ~ScopedFakeClock() override { rtc::SetClockForTesting(prev_clock_); } | 40 ~ScopedFakeClock() override { rtc::SetClockForTesting(prev_clock_); } |
| 41 // ClockInterface implementation. | 41 // ClockInterface implementation. |
| 42 uint64_t TimeNanos() const override { return time_nanos_; } | 42 int64_t TimeNanos() const override { return time_nanos_; } |
| 43 void SetTimeNanos(uint64_t time_nanos) { time_nanos_ = time_nanos; } | 43 void SetTimeNanos(uint64_t time_nanos) { time_nanos_ = time_nanos; } |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 ClockInterface* prev_clock_; | 46 ClockInterface* prev_clock_; |
| 47 uint64_t time_nanos_ = 0; | 47 uint64_t time_nanos_ = 0; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class FakeDatagramServerSocket : public net::DatagramServerSocket { | 50 class FakeDatagramServerSocket : public net::DatagramServerSocket { |
| 51 public: | 51 public: |
| 52 typedef std::pair<net::IPEndPoint, std::vector<char> > UDPPacket; | 52 typedef std::pair<net::IPEndPoint, std::vector<char> > UDPPacket; |
| (...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 std::unique_ptr<P2PSocketHostUdp> socket_host( | 567 std::unique_ptr<P2PSocketHostUdp> socket_host( |
| 568 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); | 568 new P2PSocketHostUdp(&sender, 0, &throttler, fake_socket_factory)); |
| 569 net::IPEndPoint local_address = | 569 net::IPEndPoint local_address = |
| 570 ParseAddress(kTestLocalIpAddress, invalid_port); | 570 ParseAddress(kTestLocalIpAddress, invalid_port); |
| 571 bool rv = socket_host->Init(local_address, min_port, max_port, | 571 bool rv = socket_host->Init(local_address, min_port, max_port, |
| 572 P2PHostAndIPEndPoint()); | 572 P2PHostAndIPEndPoint()); |
| 573 EXPECT_FALSE(rv); | 573 EXPECT_FALSE(rv); |
| 574 } | 574 } |
| 575 | 575 |
| 576 } // namespace content | 576 } // namespace content |
| OLD | NEW |