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

Side by Side Diff: webrtc/base/autodetectproxy_unittest.cc

Issue 1362503003: Use suffixed {uint,int}{8,16,32,64}_t types. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase + revert basictypes.h (to be landed separately just in case of a revert due to unexpected us… Created 5 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 | « webrtc/base/autodetectproxy.cc ('k') | webrtc/base/bandwidthsmoother.h » ('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 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 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 #include "webrtc/base/autodetectproxy.h" 11 #include "webrtc/base/autodetectproxy.h"
12 #include "webrtc/base/gunit.h" 12 #include "webrtc/base/gunit.h"
13 #include "webrtc/base/httpcommon.h" 13 #include "webrtc/base/httpcommon.h"
14 #include "webrtc/base/httpcommon-inl.h" 14 #include "webrtc/base/httpcommon-inl.h"
15 #include "webrtc/test/testsupport/gtest_disable.h" 15 #include "webrtc/test/testsupport/gtest_disable.h"
16 16
17 namespace rtc { 17 namespace rtc {
18 18
19 static const char kUserAgent[] = ""; 19 static const char kUserAgent[] = "";
20 static const char kPath[] = "/"; 20 static const char kPath[] = "/";
21 static const char kHost[] = "relay.google.com"; 21 static const char kHost[] = "relay.google.com";
22 static const uint16 kPort = 443; 22 static const uint16_t kPort = 443;
23 static const bool kSecure = true; 23 static const bool kSecure = true;
24 // At most, AutoDetectProxy should take ~6 seconds. Each connect step is 24 // At most, AutoDetectProxy should take ~6 seconds. Each connect step is
25 // allotted 2 seconds, with the initial resolution + connect given an 25 // allotted 2 seconds, with the initial resolution + connect given an
26 // extra 2 seconds. The slowest case is: 26 // extra 2 seconds. The slowest case is:
27 // 1) Resolution + HTTPS takes full 4 seconds and fails (but resolution 27 // 1) Resolution + HTTPS takes full 4 seconds and fails (but resolution
28 // succeeds). 28 // succeeds).
29 // 2) SOCKS5 takes the full 2 seconds. 29 // 2) SOCKS5 takes the full 2 seconds.
30 // Socket creation time seems unbounded, and has been observed to take >1 second 30 // Socket creation time seems unbounded, and has been observed to take >1 second
31 // on a linux machine under load. As such, we allow for 10 seconds for timeout, 31 // on a linux machine under load. As such, we allow for 10 seconds for timeout,
32 // though could still end up with some flakiness. 32 // though could still end up with some flakiness.
33 static const int kTimeoutMs = 10000; 33 static const int kTimeoutMs = 10000;
34 34
35 class AutoDetectProxyTest : public testing::Test, public sigslot::has_slots<> { 35 class AutoDetectProxyTest : public testing::Test, public sigslot::has_slots<> {
36 public: 36 public:
37 AutoDetectProxyTest() : auto_detect_proxy_(NULL), done_(false) {} 37 AutoDetectProxyTest() : auto_detect_proxy_(NULL), done_(false) {}
38 38
39 protected: 39 protected:
40 bool Create(const std::string &user_agent, 40 bool Create(const std::string& user_agent,
41 const std::string &path, 41 const std::string& path,
42 const std::string &host, 42 const std::string& host,
43 uint16 port, 43 uint16_t port,
44 bool secure, 44 bool secure,
45 bool startnow) { 45 bool startnow) {
46 auto_detect_proxy_ = new AutoDetectProxy(user_agent); 46 auto_detect_proxy_ = new AutoDetectProxy(user_agent);
47 EXPECT_TRUE(auto_detect_proxy_ != NULL); 47 EXPECT_TRUE(auto_detect_proxy_ != NULL);
48 if (!auto_detect_proxy_) { 48 if (!auto_detect_proxy_) {
49 return false; 49 return false;
50 } 50 }
51 Url<char> host_url(path, host, port); 51 Url<char> host_url(path, host, port);
52 host_url.set_secure(secure); 52 host_url.set_secure(secure);
53 auto_detect_proxy_->set_server_url(host_url.url()); 53 auto_detect_proxy_->set_server_url(host_url.url());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 ASSERT_TRUE(Create(kUserAgent, 123 ASSERT_TRUE(Create(kUserAgent,
124 kPath, 124 kPath,
125 kHost, 125 kHost,
126 kPort, 126 kPort,
127 kSecure, 127 kSecure,
128 true)); 128 true));
129 ASSERT_TRUE(Run(kTimeoutMs)); 129 ASSERT_TRUE(Run(kTimeoutMs));
130 } 130 }
131 131
132 } // namespace rtc 132 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/autodetectproxy.cc ('k') | webrtc/base/bandwidthsmoother.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698