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

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

Issue 15070: Split ProxyResolver into two interfaces:... (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_network_transaction_unittest.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 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull());
12 net::HttpTransactionWinHttp::Factory factory(&proxy_service); 11 net::HttpTransactionWinHttp::Factory factory(proxy_service.get());
13 12
14 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); 13 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction());
15 } 14 }
16 15
17 TEST(HttpTransactionWinHttp, Suspend) { 16 TEST(HttpTransactionWinHttp, Suspend) {
18 net::ProxyService proxy_service(new net::ProxyResolverNull); 17 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull());
19 net::HttpTransactionWinHttp::Factory factory(&proxy_service); 18 net::HttpTransactionWinHttp::Factory factory(proxy_service.get());
20 19
21 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); 20 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction());
22 trans.reset(); 21 trans.reset();
23 22
24 factory.Suspend(true); 23 factory.Suspend(true);
25 24
26 trans.reset(factory.CreateTransaction()); 25 trans.reset(factory.CreateTransaction());
27 ASSERT_TRUE(trans == NULL); 26 ASSERT_TRUE(trans == NULL);
28 27
29 factory.Suspend(false); 28 factory.Suspend(false);
30 29
31 trans.reset(factory.CreateTransaction()); 30 trans.reset(factory.CreateTransaction());
32 } 31 }
33 32
34 TEST(HttpTransactionWinHttp, GoogleGET) { 33 TEST(HttpTransactionWinHttp, GoogleGET) {
35 net::ProxyService proxy_service(new net::ProxyResolverNull); 34 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull());
36 net::HttpTransactionWinHttp::Factory factory(&proxy_service); 35 net::HttpTransactionWinHttp::Factory factory(proxy_service.get());
37 TestCompletionCallback callback; 36 TestCompletionCallback callback;
38 37
39 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); 38 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction());
40 39
41 net::HttpRequestInfo request_info; 40 net::HttpRequestInfo request_info;
42 request_info.url = GURL("http://www.google.com/"); 41 request_info.url = GURL("http://www.google.com/");
43 request_info.method = "GET"; 42 request_info.method = "GET";
44 request_info.user_agent = "Foo/1.0"; 43 request_info.user_agent = "Foo/1.0";
45 request_info.load_flags = net::LOAD_NORMAL; 44 request_info.load_flags = net::LOAD_NORMAL;
46 45
47 int rv = trans->Start(&request_info, &callback); 46 int rv = trans->Start(&request_info, &callback);
48 if (rv == net::ERR_IO_PENDING) 47 if (rv == net::ERR_IO_PENDING)
49 rv = callback.WaitForResult(); 48 rv = callback.WaitForResult();
50 EXPECT_EQ(net::OK, rv); 49 EXPECT_EQ(net::OK, rv);
51 50
52 std::string contents; 51 std::string contents;
53 rv = ReadTransaction(trans.get(), &contents); 52 rv = ReadTransaction(trans.get(), &contents);
54 EXPECT_EQ(net::OK, rv); 53 EXPECT_EQ(net::OK, rv);
55 } 54 }
56 55
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/net.xcodeproj/project.pbxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698