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

Side by Side Diff: net/spdy/spdy_network_transaction_unittest.cc

Issue 5384002: net: Remove typedef net::URLRequest URLRequest; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 10 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 5 #include <string>
6 #include <vector> 6 #include <vector>
7 7
8 #include "net/base/auth.h" 8 #include "net/base/auth.h"
9 #include "net/base/net_log_unittest.h" 9 #include "net/base/net_log_unittest.h"
10 #include "net/http/http_network_session_peer.h" 10 #include "net/http/http_network_session_peer.h"
(...skipping 2140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 ASSERT_EQ(ERR_IO_PENDING, rv); 2151 ASSERT_EQ(ERR_IO_PENDING, rv);
2152 data->CompleteRead(); 2152 data->CompleteRead();
2153 2153
2154 // Finish running rest of tasks. 2154 // Finish running rest of tasks.
2155 MessageLoop::current()->RunAllPending(); 2155 MessageLoop::current()->RunAllPending();
2156 helper.VerifyDataConsumed(); 2156 helper.VerifyDataConsumed();
2157 } 2157 }
2158 2158
2159 // Send a spdy request to www.google.com that gets redirected to www.foo.com. 2159 // Send a spdy request to www.google.com that gets redirected to www.foo.com.
2160 TEST_P(SpdyNetworkTransactionTest, RedirectGetRequest) { 2160 TEST_P(SpdyNetworkTransactionTest, RedirectGetRequest) {
2161 // These are headers which the URLRequest tacks on. 2161 // These are headers which the net::URLRequest tacks on.
2162 const char* const kExtraHeaders[] = { 2162 const char* const kExtraHeaders[] = {
2163 "accept-charset", 2163 "accept-charset",
2164 "", 2164 "",
2165 "accept-encoding", 2165 "accept-encoding",
2166 "gzip,deflate", 2166 "gzip,deflate",
2167 "accept-language", 2167 "accept-language",
2168 "", 2168 "",
2169 }; 2169 };
2170 const SpdyHeaderInfo kSynStartHeader = make_spdy_header(spdy::SYN_STREAM); 2170 const SpdyHeaderInfo kSynStartHeader = make_spdy_header(spdy::SYN_STREAM);
2171 const char* const kStandardGetHeaders[] = { 2171 const char* const kStandardGetHeaders[] = {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
2229 writes, arraysize(writes))); 2229 writes, arraysize(writes)));
2230 scoped_refptr<OrderedSocketData> data2( 2230 scoped_refptr<OrderedSocketData> data2(
2231 new OrderedSocketData(reads2, arraysize(reads2), 2231 new OrderedSocketData(reads2, arraysize(reads2),
2232 writes2, arraysize(writes2))); 2232 writes2, arraysize(writes2)));
2233 2233
2234 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2234 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2235 HttpStreamFactory::set_force_spdy_over_ssl(false); 2235 HttpStreamFactory::set_force_spdy_over_ssl(false);
2236 HttpStreamFactory::set_force_spdy_always(true); 2236 HttpStreamFactory::set_force_spdy_always(true);
2237 TestDelegate d; 2237 TestDelegate d;
2238 { 2238 {
2239 URLRequest r(GURL("http://www.google.com/"), &d); 2239 net::URLRequest r(GURL("http://www.google.com/"), &d);
2240 SpdyURLRequestContext* spdy_url_request_context = 2240 SpdyURLRequestContext* spdy_url_request_context =
2241 new SpdyURLRequestContext(); 2241 new SpdyURLRequestContext();
2242 r.set_context(spdy_url_request_context); 2242 r.set_context(spdy_url_request_context);
2243 spdy_url_request_context->socket_factory(). 2243 spdy_url_request_context->socket_factory().
2244 AddSocketDataProvider(data.get()); 2244 AddSocketDataProvider(data.get());
2245 spdy_url_request_context->socket_factory(). 2245 spdy_url_request_context->socket_factory().
2246 AddSocketDataProvider(data2.get()); 2246 AddSocketDataProvider(data2.get());
2247 2247
2248 d.set_quit_on_redirect(true); 2248 d.set_quit_on_redirect(true);
2249 r.Start(); 2249 r.Start();
(...skipping 11 matching lines...) Expand all
2261 } 2261 }
2262 EXPECT_TRUE(data->at_read_eof()); 2262 EXPECT_TRUE(data->at_read_eof());
2263 EXPECT_TRUE(data->at_write_eof()); 2263 EXPECT_TRUE(data->at_write_eof());
2264 EXPECT_TRUE(data2->at_read_eof()); 2264 EXPECT_TRUE(data2->at_read_eof());
2265 EXPECT_TRUE(data2->at_write_eof()); 2265 EXPECT_TRUE(data2->at_write_eof());
2266 } 2266 }
2267 2267
2268 // Send a spdy request to www.google.com. Get a pushed stream that redirects to 2268 // Send a spdy request to www.google.com. Get a pushed stream that redirects to
2269 // www.foo.com. 2269 // www.foo.com.
2270 TEST_P(SpdyNetworkTransactionTest, RedirectServerPush) { 2270 TEST_P(SpdyNetworkTransactionTest, RedirectServerPush) {
2271 // These are headers which the URLRequest tacks on. 2271 // These are headers which the net::URLRequest tacks on.
2272 const char* const kExtraHeaders[] = { 2272 const char* const kExtraHeaders[] = {
2273 "accept-charset", 2273 "accept-charset",
2274 "", 2274 "",
2275 "accept-encoding", 2275 "accept-encoding",
2276 "gzip,deflate", 2276 "gzip,deflate",
2277 "accept-language", 2277 "accept-language",
2278 "", 2278 "",
2279 }; 2279 };
2280 const SpdyHeaderInfo kSynStartHeader = make_spdy_header(spdy::SYN_STREAM); 2280 const SpdyHeaderInfo kSynStartHeader = make_spdy_header(spdy::SYN_STREAM);
2281 const char* const kStandardGetHeaders[] = { 2281 const char* const kStandardGetHeaders[] = {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 writes2, arraysize(writes2))); 2349 writes2, arraysize(writes2)));
2350 2350
2351 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN 2351 // TODO(erikchen): Make test support SPDYSSL, SPDYNPN
2352 HttpStreamFactory::set_force_spdy_over_ssl(false); 2352 HttpStreamFactory::set_force_spdy_over_ssl(false);
2353 HttpStreamFactory::set_force_spdy_always(true); 2353 HttpStreamFactory::set_force_spdy_always(true);
2354 TestDelegate d; 2354 TestDelegate d;
2355 TestDelegate d2; 2355 TestDelegate d2;
2356 scoped_refptr<SpdyURLRequestContext> spdy_url_request_context( 2356 scoped_refptr<SpdyURLRequestContext> spdy_url_request_context(
2357 new SpdyURLRequestContext()); 2357 new SpdyURLRequestContext());
2358 { 2358 {
2359 URLRequest r(GURL("http://www.google.com/"), &d); 2359 net::URLRequest r(GURL("http://www.google.com/"), &d);
2360 r.set_context(spdy_url_request_context); 2360 r.set_context(spdy_url_request_context);
2361 spdy_url_request_context->socket_factory(). 2361 spdy_url_request_context->socket_factory().
2362 AddSocketDataProvider(data.get()); 2362 AddSocketDataProvider(data.get());
2363 2363
2364 r.Start(); 2364 r.Start();
2365 MessageLoop::current()->Run(); 2365 MessageLoop::current()->Run();
2366 2366
2367 EXPECT_EQ(0, d.received_redirect_count()); 2367 EXPECT_EQ(0, d.received_redirect_count());
2368 std::string contents("hello!"); 2368 std::string contents("hello!");
2369 EXPECT_EQ(contents, d.data_received()); 2369 EXPECT_EQ(contents, d.data_received());
2370 2370
2371 URLRequest r2(GURL("http://www.google.com/foo.dat"), &d2); 2371 net::URLRequest r2(GURL("http://www.google.com/foo.dat"), &d2);
2372 r2.set_context(spdy_url_request_context); 2372 r2.set_context(spdy_url_request_context);
2373 spdy_url_request_context->socket_factory(). 2373 spdy_url_request_context->socket_factory().
2374 AddSocketDataProvider(data2.get()); 2374 AddSocketDataProvider(data2.get());
2375 2375
2376 d2.set_quit_on_redirect(true); 2376 d2.set_quit_on_redirect(true);
2377 r2.Start(); 2377 r2.Start();
2378 MessageLoop::current()->Run(); 2378 MessageLoop::current()->Run();
2379 EXPECT_EQ(1, d2.received_redirect_count()); 2379 EXPECT_EQ(1, d2.received_redirect_count());
2380 2380
2381 r2.FollowDeferredRedirect(); 2381 r2.FollowDeferredRedirect();
(...skipping 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after
4668 // TODO(cbentzel): This is actually the same response object as before, but 4668 // TODO(cbentzel): This is actually the same response object as before, but
4669 // data has changed. 4669 // data has changed.
4670 const HttpResponseInfo* const response_restart = trans->GetResponseInfo(); 4670 const HttpResponseInfo* const response_restart = trans->GetResponseInfo();
4671 ASSERT_TRUE(response_restart != NULL); 4671 ASSERT_TRUE(response_restart != NULL);
4672 ASSERT_TRUE(response_restart->headers != NULL); 4672 ASSERT_TRUE(response_restart->headers != NULL);
4673 EXPECT_EQ(200, response_restart->headers->response_code()); 4673 EXPECT_EQ(200, response_restart->headers->response_code());
4674 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL); 4674 EXPECT_TRUE(response_restart->auth_challenge.get() == NULL);
4675 } 4675 }
4676 4676
4677 } // namespace net 4677 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698