OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "net/websockets/websocket_test_util.h" | 5 #include "net/websockets/websocket_test_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_vector.h" | 11 #include "base/memory/scoped_vector.h" |
12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "net/proxy/proxy_service.h" | 14 #include "net/proxy/proxy_service.h" |
15 #include "net/socket/socket_test_util.h" | 15 #include "net/socket/socket_test_util.h" |
16 #include "url/origin.h" | 16 #include "url/origin.h" |
17 | 17 |
18 namespace net { | 18 namespace net { |
19 | 19 |
20 namespace { | 20 namespace { |
21 const uint64 kA = | 21 const uint64_t kA = (static_cast<uint64_t>(0x5851f42d) << 32) + |
22 (static_cast<uint64>(0x5851f42d) << 32) + static_cast<uint64>(0x4c957f2d); | 22 static_cast<uint64_t>(0x4c957f2d); |
23 const uint64 kC = 12345; | 23 const uint64_t kC = 12345; |
24 const uint64 kM = static_cast<uint64>(1) << 48; | 24 const uint64_t kM = static_cast<uint64_t>(1) << 48; |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 LinearCongruentialGenerator::LinearCongruentialGenerator(uint32 seed) | 28 LinearCongruentialGenerator::LinearCongruentialGenerator(uint32_t seed) |
29 : current_(seed) {} | 29 : current_(seed) {} |
30 | 30 |
31 uint32 LinearCongruentialGenerator::Generate() { | 31 uint32_t LinearCongruentialGenerator::Generate() { |
32 uint64 result = current_; | 32 uint64_t result = current_; |
33 current_ = (current_ * kA + kC) % kM; | 33 current_ = (current_ * kA + kC) % kM; |
34 return static_cast<uint32>(result >> 16); | 34 return static_cast<uint32_t>(result >> 16); |
35 } | 35 } |
36 | 36 |
37 std::string WebSocketStandardRequest(const std::string& path, | 37 std::string WebSocketStandardRequest(const std::string& path, |
38 const std::string& host, | 38 const std::string& host, |
39 const url::Origin& origin, | 39 const url::Origin& origin, |
40 const std::string& extra_headers) { | 40 const std::string& extra_headers) { |
41 return WebSocketStandardRequestWithCookies(path, host, origin, std::string(), | 41 return WebSocketStandardRequestWithCookies(path, host, origin, std::string(), |
42 extra_headers); | 42 extra_headers); |
43 } | 43 } |
44 | 44 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 if (!url_request_context_initialized_) { | 173 if (!url_request_context_initialized_) { |
174 url_request_context_.Init(); | 174 url_request_context_.Init(); |
175 // A Network Delegate is required to make the URLRequest::Delegate work. | 175 // A Network Delegate is required to make the URLRequest::Delegate work. |
176 url_request_context_.set_network_delegate(&network_delegate_); | 176 url_request_context_.set_network_delegate(&network_delegate_); |
177 url_request_context_initialized_ = true; | 177 url_request_context_initialized_ = true; |
178 } | 178 } |
179 return &url_request_context_; | 179 return &url_request_context_; |
180 } | 180 } |
181 | 181 |
182 } // namespace net | 182 } // namespace net |
OLD | NEW |