Process Alt-Svc headers.
[chromium-blink-merge.git] / content / renderer / media / webrtc / stun_field_trial_unittest.cc
blobb59b768d63cee6b3ef830b212423c821ff731d33
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"
10 namespace content {
12 TEST(StunProbeTrial, VerifyParameterParsing) {
13 std::vector<rtc::SocketAddress> servers;
14 int requests_per_ip;
15 int interval_ms;
16 int shared_socket_mode;
17 std::string params;
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));
28 servers.clear();
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));
36 servers.clear();
38 params = "////";
39 EXPECT_FALSE(ParseStunProbeParameters(params, &requests_per_ip, &interval_ms,
40 &shared_socket_mode, &servers));
43 } // namespace content