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

Side by Side Diff: webrtc/tools/network_tester/test_controller.h

Issue 2790513002: Add packet logger and server (Closed)
Patch Set: Created 3 years, 8 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 | « webrtc/tools/network_tester/server.cc ('k') | webrtc/tools/network_tester/test_controller.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 /* 1 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #ifndef WEBRTC_TOOLS_NETWORK_TESTER_TEST_CONTROLLER_H_ 11 #ifndef WEBRTC_TOOLS_NETWORK_TESTER_TEST_CONTROLLER_H_
12 #define WEBRTC_TOOLS_NETWORK_TESTER_TEST_CONTROLLER_H_ 12 #define WEBRTC_TOOLS_NETWORK_TESTER_TEST_CONTROLLER_H_
13 13
14 #include <array> 14 #include <array>
15 #include <limits> 15 #include <limits>
16 #include <memory> 16 #include <memory>
17 #include <string> 17 #include <string>
18 #include <utility> 18 #include <utility>
19 19
20 #include "webrtc/base/constructormagic.h"
20 #include "webrtc/base/ignore_wundef.h" 21 #include "webrtc/base/ignore_wundef.h"
21 #include "webrtc/p2p/base/basicpacketsocketfactory.h" 22 #include "webrtc/p2p/base/basicpacketsocketfactory.h"
22 #include "webrtc/p2p/base/udptransport.h" 23 #include "webrtc/p2p/base/udptransport.h"
24 #include "webrtc/tools/network_tester/packet_logger.h"
23 #include "webrtc/tools/network_tester/packet_sender.h" 25 #include "webrtc/tools/network_tester/packet_sender.h"
24 26
25 #ifdef WEBRTC_NETWORK_TESTER_PROTO 27 #ifdef WEBRTC_NETWORK_TESTER_PROTO
26 RTC_PUSH_IGNORING_WUNDEF() 28 RTC_PUSH_IGNORING_WUNDEF()
27 #include "webrtc/tools/network_tester/network_tester_packet.pb.h" 29 #include "webrtc/tools/network_tester/network_tester_packet.pb.h"
28 RTC_POP_IGNORING_WUNDEF() 30 RTC_POP_IGNORING_WUNDEF()
29 using webrtc::network_tester::packet::NetworkTesterPacket; 31 using webrtc::network_tester::packet::NetworkTesterPacket;
30 #else 32 #else
31 class NetworkTesterPacket; 33 class NetworkTesterPacket;
32 #endif // WEBRTC_NETWORK_TESTER_PROTO 34 #endif // WEBRTC_NETWORK_TESTER_PROTO
33 35
34 namespace webrtc { 36 namespace webrtc {
35 37
36 class TestController : public sigslot::has_slots<> { 38 class TestController : public sigslot::has_slots<> {
37 public: 39 public:
38 TestController(int min_port, 40 TestController(int min_port,
39 int max_port, 41 int max_port,
40 const std::string& config_file_path); 42 const std::string& config_file_path,
43 const std::string& log_file_path);
41 44
42 void Run(); 45 void Run();
43 46
44 void SendConnectTo(const std::string& hostname, int port); 47 void SendConnectTo(const std::string& hostname, int port);
45 48
46 void OnReadPacket(rtc::AsyncPacketSocket* socket, 49 void OnReadPacket(rtc::AsyncPacketSocket* socket,
47 const char* data, 50 const char* data,
48 size_t len, 51 size_t len,
49 const rtc::SocketAddress& remote_addr, 52 const rtc::SocketAddress& remote_addr,
50 const rtc::PacketTime& packet_time); 53 const rtc::PacketTime& packet_time);
51 54
52 void SendData(const NetworkTesterPacket& packet, 55 void SendData(const NetworkTesterPacket& packet,
53 rtc::Optional<size_t> data_size); 56 rtc::Optional<size_t> data_size);
54 57
55 void OnTestDone(); 58 void OnTestDone();
56 59
57 bool IsTestDone() { return local_test_done_ && remote_test_done_; } 60 bool IsTestDone() { return local_test_done_ && remote_test_done_; }
58 61
59 private: 62 private:
60 rtc::BasicPacketSocketFactory socket_factory_; 63 rtc::BasicPacketSocketFactory socket_factory_;
61 std::unique_ptr<cricket::UdpTransport> udp_transport_; 64 std::unique_ptr<cricket::UdpTransport> udp_transport_;
62 std::unique_ptr<PacketSender> packet_sender_; 65 std::unique_ptr<PacketSender> packet_sender_;
63 const std::string config_file_path_; 66 const std::string config_file_path_;
67 PacketLogger packet_logger_;
64 bool local_test_done_; 68 bool local_test_done_;
65 bool remote_test_done_; 69 bool remote_test_done_;
66 std::array<char, 15000> send_data_; 70 std::array<char, 15000> send_data_;
71 RTC_DISALLOW_COPY_AND_ASSIGN(TestController);
stefan-webrtc 2017/03/30 09:22:25 New line above
michaelt 2017/04/06 07:35:07 Done.
67 }; 72 };
68 73
69 } // namespace webrtc 74 } // namespace webrtc
70 75
71 #endif // WEBRTC_TOOLS_NETWORK_TESTER_TEST_CONTROLLER_H_ 76 #endif // WEBRTC_TOOLS_NETWORK_TESTER_TEST_CONTROLLER_H_
OLDNEW
« no previous file with comments | « webrtc/tools/network_tester/server.cc ('k') | webrtc/tools/network_tester/test_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698