| OLD | NEW |
| 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 "base/ref_counted.h" | 5 #include "base/ref_counted.h" |
| 6 #include "net/base/host_resolver_unittest.h" | 6 #include "net/base/host_resolver_unittest.h" |
| 7 #include "net/http/http_network_layer.h" | 7 #include "net/http/http_network_layer.h" |
| 8 #include "net/http/http_transaction_unittest.h" | 8 #include "net/http/http_transaction_unittest.h" |
| 9 #include "net/proxy/proxy_service.h" | 9 #include "net/proxy/proxy_service.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
| 12 | 12 |
| 13 class HttpNetworkLayerTest : public PlatformTest { | 13 class HttpNetworkLayerTest : public PlatformTest { |
| 14 public: | 14 public: |
| 15 HttpNetworkLayerTest() | 15 HttpNetworkLayerTest() |
| 16 : host_mapper_(new net::RuleBasedHostMapper()), | 16 : host_mapper_(new net::RuleBasedHostMapper()), |
| 17 scoped_host_mapper_(host_mapper_.get()) { | 17 scoped_host_mapper_(host_mapper_.get()) { |
| 18 // TODO(darin): kill this exception once we have a way to test out the | 18 // TODO(darin): kill this exception once we have a way to test out the |
| 19 // HttpNetworkLayer class using loopback connections. | 19 // HttpNetworkLayer class using loopback connections. |
| 20 host_mapper_->AddRule("www.google.com", "www.google.com"); | 20 host_mapper_->AllowDirectLookup("www.google.com"); |
| 21 } | 21 } |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 scoped_refptr<net::RuleBasedHostMapper> host_mapper_; | 24 scoped_refptr<net::RuleBasedHostMapper> host_mapper_; |
| 25 net::ScopedHostMapper scoped_host_mapper_; | 25 net::ScopedHostMapper scoped_host_mapper_; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 TEST_F(HttpNetworkLayerTest, CreateAndDestroy) { | 28 TEST_F(HttpNetworkLayerTest, CreateAndDestroy) { |
| 29 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull()); | 29 scoped_ptr<net::ProxyService> proxy_service(net::ProxyService::CreateNull()); |
| 30 net::HttpNetworkLayer factory(proxy_service.get()); | 30 net::HttpNetworkLayer factory(proxy_service.get()); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 int rv = trans->Start(&request_info, &callback); | 66 int rv = trans->Start(&request_info, &callback); |
| 67 if (rv == net::ERR_IO_PENDING) | 67 if (rv == net::ERR_IO_PENDING) |
| 68 rv = callback.WaitForResult(); | 68 rv = callback.WaitForResult(); |
| 69 EXPECT_EQ(net::OK, rv); | 69 EXPECT_EQ(net::OK, rv); |
| 70 | 70 |
| 71 std::string contents; | 71 std::string contents; |
| 72 rv = ReadTransaction(trans.get(), &contents); | 72 rv = ReadTransaction(trans.get(), &contents); |
| 73 EXPECT_EQ(net::OK, rv); | 73 EXPECT_EQ(net::OK, rv); |
| 74 } | 74 } |
| OLD | NEW |