1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/renderer/media/webrtc/stun_field_trial.h"
7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "third_party/webrtc/base/socketaddress.h"
12 TEST(StunProbeTrial
, VerifyParameterParsing
) {
13 std::vector
<rtc::SocketAddress
> servers
;
16 int shared_socket_mode
;
19 params
= "20/500/1/server:3478/server2:3478";
20 EXPECT_TRUE(ParseStunProbeParameters(params
, &requests_per_ip
, &interval_ms
,
21 &shared_socket_mode
, &servers
));
22 EXPECT_EQ(requests_per_ip
, 20);
23 EXPECT_EQ(interval_ms
, 100);
24 EXPECT_EQ(shared_socket_mode
, 1);
25 EXPECT_EQ(servers
.size(), 2u);
26 EXPECT_EQ(servers
[0], rtc::SocketAddress("server", 3478));
27 EXPECT_EQ(servers
[1], rtc::SocketAddress("server2", 3478));
30 params
= "///server:3478";
31 EXPECT_TRUE(ParseStunProbeParameters(params
, &requests_per_ip
, &interval_ms
,
32 &shared_socket_mode
, &servers
));
33 EXPECT_EQ(requests_per_ip
, 10);
34 EXPECT_EQ(servers
.size(), 1u);
35 EXPECT_EQ(servers
[0], rtc::SocketAddress("server", 3478));
39 EXPECT_FALSE(ParseStunProbeParameters(params
, &requests_per_ip
, &interval_ms
,
40 &shared_socket_mode
, &servers
));
43 } // namespace content