| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/http/http_transaction_winhttp.h" | |
| 6 #include "net/http/http_transaction_unittest.h" | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 | |
| 9 TEST(HttpTransactionWinHttp, CreateAndDestroy) { | |
| 10 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull()); | |
| 11 net::HttpTransactionWinHttp::Factory factory(proxy_service.get()); | |
| 12 | |
| 13 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); | |
| 14 } | |
| 15 | |
| 16 TEST(HttpTransactionWinHttp, Suspend) { | |
| 17 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull()); | |
| 18 net::HttpTransactionWinHttp::Factory factory(proxy_service.get()); | |
| 19 | |
| 20 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); | |
| 21 trans.reset(); | |
| 22 | |
| 23 factory.Suspend(true); | |
| 24 | |
| 25 trans.reset(factory.CreateTransaction()); | |
| 26 ASSERT_TRUE(trans == NULL); | |
| 27 | |
| 28 factory.Suspend(false); | |
| 29 | |
| 30 trans.reset(factory.CreateTransaction()); | |
| 31 } | |
| 32 | |
| 33 TEST(HttpTransactionWinHttp, GoogleGET) { | |
| 34 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull()); | |
| 35 net::HttpTransactionWinHttp::Factory factory(proxy_service.get()); | |
| 36 TestCompletionCallback callback; | |
| 37 | |
| 38 scoped_ptr<net::HttpTransaction> trans(factory.CreateTransaction()); | |
| 39 | |
| 40 net::HttpRequestInfo request_info; | |
| 41 request_info.url = GURL("http://www.google.com/"); | |
| 42 request_info.method = "GET"; | |
| 43 request_info.user_agent = "Foo/1.0"; | |
| 44 request_info.load_flags = net::LOAD_NORMAL; | |
| 45 | |
| 46 int rv = trans->Start(&request_info, &callback); | |
| 47 if (rv == net::ERR_IO_PENDING) | |
| 48 rv = callback.WaitForResult(); | |
| 49 EXPECT_EQ(net::OK, rv); | |
| 50 | |
| 51 std::string contents; | |
| 52 rv = ReadTransaction(trans.get(), &contents); | |
| 53 EXPECT_EQ(net::OK, rv); | |
| 54 } | |
| 55 | |
| OLD | NEW |