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

Side by Side Diff: net/url_request/url_request_context_builder_unittest.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | net/url_request/url_request_ftp_job.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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/url_request/url_request_context_builder.h" 5 #include "net/url_request/url_request_context_builder.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "net/test/test_server.h" 8 #include "net/test/test_server.h"
9 #include "net/url_request/url_request.h" 9 #include "net/url_request/url_request.h"
10 #include "net/url_request/url_request_test_util.h" 10 #include "net/url_request/url_request_test_util.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #endif // defined(OS_LINUX) 46 #endif // defined(OS_LINUX)
47 } 47 }
48 48
49 LocalHttpTestServer test_server_; 49 LocalHttpTestServer test_server_;
50 URLRequestContextBuilder builder_; 50 URLRequestContextBuilder builder_;
51 }; 51 };
52 52
53 TEST_F(URLRequestContextBuilderTest, DefaultSettings) { 53 TEST_F(URLRequestContextBuilderTest, DefaultSettings) {
54 ASSERT_TRUE(test_server_.Start()); 54 ASSERT_TRUE(test_server_.Start());
55 55
56 scoped_refptr<URLRequestContext> context = builder_.Build(); 56 scoped_ptr<URLRequestContext> context(builder_.Build());
57 TestDelegate delegate; 57 TestDelegate delegate;
58 URLRequest request(test_server_.GetURL("echoheader?Foo"), &delegate); 58 URLRequest request(test_server_.GetURL("echoheader?Foo"), &delegate);
59 request.set_context(context); 59 request.set_context(context.get());
60 request.set_method("GET"); 60 request.set_method("GET");
61 request.SetExtraRequestHeaderByName("Foo", "Bar", false); 61 request.SetExtraRequestHeaderByName("Foo", "Bar", false);
62 request.Start(); 62 request.Start();
63 MessageLoop::current()->Run(); 63 MessageLoop::current()->Run();
64 EXPECT_EQ("Bar", delegate.data_received()); 64 EXPECT_EQ("Bar", delegate.data_received());
65 } 65 }
66 66
67 TEST_F(URLRequestContextBuilderTest, UserAgent) { 67 TEST_F(URLRequestContextBuilderTest, UserAgent) {
68 ASSERT_TRUE(test_server_.Start()); 68 ASSERT_TRUE(test_server_.Start());
69 69
70 builder_.set_user_agent("Bar"); 70 builder_.set_user_agent("Bar");
71 scoped_refptr<URLRequestContext> context = builder_.Build(); 71 scoped_ptr<URLRequestContext> context(builder_.Build());
72 TestDelegate delegate; 72 TestDelegate delegate;
73 URLRequest request(test_server_.GetURL("echoheader?User-Agent"), &delegate); 73 URLRequest request(test_server_.GetURL("echoheader?User-Agent"), &delegate);
74 request.set_context(context); 74 request.set_context(context.get());
75 request.set_method("GET"); 75 request.set_method("GET");
76 request.Start(); 76 request.Start();
77 MessageLoop::current()->Run(); 77 MessageLoop::current()->Run();
78 EXPECT_EQ("Bar", delegate.data_received()); 78 EXPECT_EQ("Bar", delegate.data_received());
79 } 79 }
80 80
81 } // namespace 81 } // namespace
82 82
83 } // namespace net 83 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_context_builder.cc ('k') | net/url_request/url_request_ftp_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698