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

Side by Side Diff: net/websockets/websocket_handshake_stream_create_helper_test.cc

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 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
OLDNEW
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_handshake_stream_create_helper.h" 5 #include "net/websockets/websocket_handshake_stream_create_helper.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // The created socket expects |expect_written| to be written to the socket, 42 // The created socket expects |expect_written| to be written to the socket,
43 // and will respond with |return_to_read|. The test will fail if the expected 43 // and will respond with |return_to_read|. The test will fail if the expected
44 // text is not written, or if all the bytes are not read. 44 // text is not written, or if all the bytes are not read.
45 std::unique_ptr<ClientSocketHandle> CreateClientSocketHandle( 45 std::unique_ptr<ClientSocketHandle> CreateClientSocketHandle(
46 const std::string& expect_written, 46 const std::string& expect_written,
47 const std::string& return_to_read) { 47 const std::string& return_to_read) {
48 socket_factory_maker_.SetExpectations(expect_written, return_to_read); 48 socket_factory_maker_.SetExpectations(expect_written, return_to_read);
49 std::unique_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle); 49 std::unique_ptr<ClientSocketHandle> socket_handle(new ClientSocketHandle);
50 socket_handle->Init("a", scoped_refptr<MockTransportSocketParams>(), MEDIUM, 50 socket_handle->Init("a", scoped_refptr<MockTransportSocketParams>(), MEDIUM,
51 ClientSocketPool::RespectLimits::ENABLED, 51 ClientSocketPool::RespectLimits::ENABLED,
52 CompletionCallback(), &pool_, BoundNetLog()); 52 CompletionCallback(), &pool_, NetLogWithSource());
53 return socket_handle; 53 return socket_handle;
54 } 54 }
55 55
56 private: 56 private:
57 WebSocketMockClientSocketFactoryMaker socket_factory_maker_; 57 WebSocketMockClientSocketFactoryMaker socket_factory_maker_;
58 MockTransportClientSocketPool pool_; 58 MockTransportClientSocketPool pool_;
59 59
60 DISALLOW_COPY_AND_ASSIGN(MockClientSocketHandleFactory); 60 DISALLOW_COPY_AND_ASSIGN(MockClientSocketHandleFactory);
61 }; 61 };
62 62
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // If in future the implementation type returned by CreateBasicStream() 112 // If in future the implementation type returned by CreateBasicStream()
113 // changes, this static_cast will be wrong. However, in that case the test 113 // changes, this static_cast will be wrong. However, in that case the test
114 // will fail and AddressSanitizer should identify the issue. 114 // will fail and AddressSanitizer should identify the issue.
115 static_cast<WebSocketBasicHandshakeStream*>(handshake.get()) 115 static_cast<WebSocketBasicHandshakeStream*>(handshake.get())
116 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); 116 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ==");
117 117
118 HttpRequestInfo request_info; 118 HttpRequestInfo request_info;
119 request_info.url = GURL("ws://localhost/"); 119 request_info.url = GURL("ws://localhost/");
120 request_info.method = "GET"; 120 request_info.method = "GET";
121 request_info.load_flags = LOAD_DISABLE_CACHE; 121 request_info.load_flags = LOAD_DISABLE_CACHE;
122 int rv = handshake->InitializeStream( 122 int rv =
123 &request_info, DEFAULT_PRIORITY, BoundNetLog(), CompletionCallback()); 123 handshake->InitializeStream(&request_info, DEFAULT_PRIORITY,
124 NetLogWithSource(), CompletionCallback());
124 EXPECT_THAT(rv, IsOk()); 125 EXPECT_THAT(rv, IsOk());
125 126
126 HttpRequestHeaders headers; 127 HttpRequestHeaders headers;
127 headers.SetHeader("Host", "localhost"); 128 headers.SetHeader("Host", "localhost");
128 headers.SetHeader("Connection", "Upgrade"); 129 headers.SetHeader("Connection", "Upgrade");
129 headers.SetHeader("Pragma", "no-cache"); 130 headers.SetHeader("Pragma", "no-cache");
130 headers.SetHeader("Cache-Control", "no-cache"); 131 headers.SetHeader("Cache-Control", "no-cache");
131 headers.SetHeader("Upgrade", "websocket"); 132 headers.SetHeader("Upgrade", "websocket");
132 headers.SetHeader("Origin", kOrigin); 133 headers.SetHeader("Origin", kOrigin);
133 headers.SetHeader("Sec-WebSocket-Version", "13"); 134 headers.SetHeader("Sec-WebSocket-Version", "13");
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 195
195 EXPECT_EQ( 196 EXPECT_EQ(
196 "permessage-deflate;" 197 "permessage-deflate;"
197 " client_max_window_bits=14; server_max_window_bits=14;" 198 " client_max_window_bits=14; server_max_window_bits=14;"
198 " server_no_context_takeover; client_no_context_takeover", 199 " server_no_context_takeover; client_no_context_takeover",
199 stream->GetExtensions()); 200 stream->GetExtensions());
200 } 201 }
201 202
202 } // namespace 203 } // namespace
203 } // namespace net 204 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698