Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: remoting/test/fake_socket_factory.cc

Issue 667123002: Standardize usage of virtual/override/final in remoting/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/test/fake_socket_factory.h ('k') | remoting/test/protocol_perftest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "remoting/test/fake_socket_factory.h" 8 #include "remoting/test/fake_socket_factory.h"
9 9
10 #include <math.h> 10 #include <math.h>
(...skipping 21 matching lines...) Expand all
32 return average + 32 return average +
33 stddev * sqrt(-2.0 * log(1.0 - base::RandDouble())) * 33 stddev * sqrt(-2.0 * log(1.0 - base::RandDouble())) *
34 cos(base::RandDouble() * 2.0 * M_PI); 34 cos(base::RandDouble() * 2.0 * M_PI);
35 } 35 }
36 36
37 class FakeUdpSocket : public rtc::AsyncPacketSocket { 37 class FakeUdpSocket : public rtc::AsyncPacketSocket {
38 public: 38 public:
39 FakeUdpSocket(FakePacketSocketFactory* factory, 39 FakeUdpSocket(FakePacketSocketFactory* factory,
40 scoped_refptr<FakeNetworkDispatcher> dispatcher, 40 scoped_refptr<FakeNetworkDispatcher> dispatcher,
41 const rtc::SocketAddress& local_address); 41 const rtc::SocketAddress& local_address);
42 virtual ~FakeUdpSocket(); 42 ~FakeUdpSocket() override;
43 43
44 void ReceivePacket(const rtc::SocketAddress& from, 44 void ReceivePacket(const rtc::SocketAddress& from,
45 const rtc::SocketAddress& to, 45 const rtc::SocketAddress& to,
46 const scoped_refptr<net::IOBuffer>& data, 46 const scoped_refptr<net::IOBuffer>& data,
47 int data_size); 47 int data_size);
48 48
49 // rtc::AsyncPacketSocket interface. 49 // rtc::AsyncPacketSocket interface.
50 virtual rtc::SocketAddress GetLocalAddress() const override; 50 rtc::SocketAddress GetLocalAddress() const override;
51 virtual rtc::SocketAddress GetRemoteAddress() const override; 51 rtc::SocketAddress GetRemoteAddress() const override;
52 virtual int Send(const void* data, size_t data_size, 52 int Send(const void* data,
53 const rtc::PacketOptions& options) override; 53 size_t data_size,
54 virtual int SendTo(const void* data, size_t data_size, 54 const rtc::PacketOptions& options) override;
55 const rtc::SocketAddress& address, 55 int SendTo(const void* data,
56 const rtc::PacketOptions& options) override; 56 size_t data_size,
57 virtual int Close() override; 57 const rtc::SocketAddress& address,
58 virtual State GetState() const override; 58 const rtc::PacketOptions& options) override;
59 virtual int GetOption(rtc::Socket::Option option, int* value) override; 59 int Close() override;
60 virtual int SetOption(rtc::Socket::Option option, int value) override; 60 State GetState() const override;
61 virtual int GetError() const override; 61 int GetOption(rtc::Socket::Option option, int* value) override;
62 virtual void SetError(int error) override; 62 int SetOption(rtc::Socket::Option option, int value) override;
63 int GetError() const override;
64 void SetError(int error) override;
63 65
64 private: 66 private:
65 FakePacketSocketFactory* factory_; 67 FakePacketSocketFactory* factory_;
66 scoped_refptr<FakeNetworkDispatcher> dispatcher_; 68 scoped_refptr<FakeNetworkDispatcher> dispatcher_;
67 rtc::SocketAddress local_address_; 69 rtc::SocketAddress local_address_;
68 State state_; 70 State state_;
69 71
70 DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket); 72 DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket);
71 }; 73 };
72 74
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 UdpSocketsMap::iterator iter = udp_sockets_.find(packet.to.port()); 321 UdpSocketsMap::iterator iter = udp_sockets_.find(packet.to.port());
320 if (iter == udp_sockets_.end()) { 322 if (iter == udp_sockets_.end()) {
321 // Invalid port number. 323 // Invalid port number.
322 return; 324 return;
323 } 325 }
324 326
325 iter->second.Run(packet.from, packet.to, packet.data, packet.data_size); 327 iter->second.Run(packet.from, packet.to, packet.data, packet.data_size);
326 } 328 }
327 329
328 } // namespace remoting 330 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/test/fake_socket_factory.h ('k') | remoting/test/protocol_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698