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

Side by Side Diff: net/http/http_transaction_winhttp_unittest.cc

Issue 13701: Use automatic memory management for URLRequestContext's members.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « net/http/http_transaction_winhttp.cc ('k') | net/net.xcodeproj/project.pbxproj » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/http/http_transaction_winhttp.h" 5 #include "net/http/http_transaction_winhttp.h"
6 #include "net/http/http_transaction_unittest.h" 6 #include "net/http/http_transaction_unittest.h"
7 #include "net/proxy/proxy_resolver_null.h"
8 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
9 8
10 TEST(HttpTransactionWinHttp, CreateAndDestroy) { 9 TEST(HttpTransactionWinHttp, CreateAndDestroy) {
11 net::ProxyService proxy_service(new net::ProxyResolverNull); 10 net::HttpTransactionWinHttp::Factory factory(net::ProxyService::CreateNull());
12 net::HttpTransactionWinHttp::Factory factory(&proxy_service);
13 11
14 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); 12 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction());
15 } 13 }
16 14
17 TEST(HttpTransactionWinHttp, Suspend) { 15 TEST(HttpTransactionWinHttp, Suspend) {
18 net::ProxyService proxy_service(new net::ProxyResolverNull); 16 net::HttpTransactionWinHttp::Factory factory(net::ProxyService::CreateNull());
19 net::HttpTransactionWinHttp::Factory factory(&proxy_service);
20 17
21 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); 18 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction());
22 trans.reset(); 19 trans.reset();
23 20
24 factory.Suspend(true); 21 factory.Suspend(true);
25 22
26 trans.reset(factory.CreateTransaction()); 23 trans.reset(factory.CreateTransaction());
27 ASSERT_TRUE(trans == NULL); 24 ASSERT_TRUE(trans == NULL);
28 25
29 factory.Suspend(false); 26 factory.Suspend(false);
30 27
31 trans.reset(factory.CreateTransaction()); 28 trans.reset(factory.CreateTransaction());
32 } 29 }
33 30
34 TEST(HttpTransactionWinHttp, GoogleGET) { 31 TEST(HttpTransactionWinHttp, GoogleGET) {
35 net::ProxyService proxy_service(new net::ProxyResolverNull); 32 net::HttpTransactionWinHttp::Factory factory(net::ProxyService::CreateNull());
36 net::HttpTransactionWinHttp::Factory factory(&proxy_service);
37 TestCompletionCallback callback; 33 TestCompletionCallback callback;
38 34
39 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); 35 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction());
40 36
41 net::HttpRequestInfo request_info; 37 net::HttpRequestInfo request_info;
42 request_info.url = GURL("http://www.google.com/"); 38 request_info.url = GURL("http://www.google.com/");
43 request_info.method = "GET"; 39 request_info.method = "GET";
44 request_info.user_agent = "Foo/1.0"; 40 request_info.user_agent = "Foo/1.0";
45 request_info.load_flags = net::LOAD_NORMAL; 41 request_info.load_flags = net::LOAD_NORMAL;
46 42
47 int rv = trans->Start(&request_info, &callback); 43 int rv = trans->Start(&request_info, &callback);
48 if (rv == net::ERR_IO_PENDING) 44 if (rv == net::ERR_IO_PENDING)
49 rv = callback.WaitForResult(); 45 rv = callback.WaitForResult();
50 EXPECT_EQ(net::OK, rv); 46 EXPECT_EQ(net::OK, rv);
51 47
52 std::string contents; 48 std::string contents;
53 rv = ReadTransaction(trans.get(), &contents); 49 rv = ReadTransaction(trans.get(), &contents);
54 EXPECT_EQ(net::OK, rv); 50 EXPECT_EQ(net::OK, rv);
55 } 51 }
56 52
OLDNEW
« no previous file with comments | « net/http/http_transaction_winhttp.cc ('k') | net/net.xcodeproj/project.pbxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698