| OLD | NEW |
| 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_fetcher_impl.h" | 5 #include "net/url_request/url_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 #include "net/base/upload_file_element_reader.h" | 37 #include "net/base/upload_file_element_reader.h" |
| 38 #include "net/dns/mock_host_resolver.h" | 38 #include "net/dns/mock_host_resolver.h" |
| 39 #include "net/http/http_response_headers.h" | 39 #include "net/http/http_response_headers.h" |
| 40 #include "net/test/embedded_test_server/embedded_test_server.h" | 40 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 41 #include "net/url_request/url_fetcher_delegate.h" | 41 #include "net/url_request/url_fetcher_delegate.h" |
| 42 #include "net/url_request/url_request_context_getter.h" | 42 #include "net/url_request/url_request_context_getter.h" |
| 43 #include "net/url_request/url_request_test_util.h" | 43 #include "net/url_request/url_request_test_util.h" |
| 44 #include "net/url_request/url_request_throttler_manager.h" | 44 #include "net/url_request/url_request_throttler_manager.h" |
| 45 #include "testing/gtest/include/gtest/gtest.h" | 45 #include "testing/gtest/include/gtest/gtest.h" |
| 46 | 46 |
| 47 #if defined(USE_NSS_VERIFIER) | 47 #if defined(USE_NSS_CERTS) |
| 48 #include "net/cert_net/nss_ocsp.h" | 48 #include "net/cert_net/nss_ocsp.h" |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 namespace net { | 51 namespace net { |
| 52 | 52 |
| 53 using base::Time; | 53 using base::Time; |
| 54 using base::TimeDelta; | 54 using base::TimeDelta; |
| 55 | 55 |
| 56 // TODO(eroman): Add a regression test for http://crbug.com/40505. | 56 // TODO(eroman): Add a regression test for http://crbug.com/40505. |
| 57 | 57 |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 void SetUp() override { | 417 void SetUp() override { |
| 418 SetUpServer(); | 418 SetUpServer(); |
| 419 ASSERT_TRUE(test_server_->Start()); | 419 ASSERT_TRUE(test_server_->Start()); |
| 420 | 420 |
| 421 // URL that will hang when lookups reach the host resolver. | 421 // URL that will hang when lookups reach the host resolver. |
| 422 hanging_url_ = GURL(base::StringPrintf( | 422 hanging_url_ = GURL(base::StringPrintf( |
| 423 "http://example.com:%d%s", test_server_->host_port_pair().port(), | 423 "http://example.com:%d%s", test_server_->host_port_pair().port(), |
| 424 kDefaultResponsePath)); | 424 kDefaultResponsePath)); |
| 425 ASSERT_TRUE(hanging_url_.is_valid()); | 425 ASSERT_TRUE(hanging_url_.is_valid()); |
| 426 | 426 |
| 427 #if defined(USE_NSS_VERIFIER) | 427 #if defined(USE_NSS_CERTS) |
| 428 crypto::EnsureNSSInit(); | 428 crypto::EnsureNSSInit(); |
| 429 EnsureNSSHttpIOInit(); | 429 EnsureNSSHttpIOInit(); |
| 430 #endif | 430 #endif |
| 431 } | 431 } |
| 432 | 432 |
| 433 void TearDown() override { | 433 void TearDown() override { |
| 434 #if defined(USE_NSS_VERIFIER) | 434 #if defined(USE_NSS_CERTS) |
| 435 ShutdownNSSHttpIO(); | 435 ShutdownNSSHttpIO(); |
| 436 #endif | 436 #endif |
| 437 } | 437 } |
| 438 | 438 |
| 439 // Initializes |test_server_| without starting it. Allows subclasses to use | 439 // Initializes |test_server_| without starting it. Allows subclasses to use |
| 440 // their own server configuration. | 440 // their own server configuration. |
| 441 virtual void SetUpServer() { | 441 virtual void SetUpServer() { |
| 442 test_server_.reset(new EmbeddedTestServer); | 442 test_server_.reset(new EmbeddedTestServer); |
| 443 test_server_->AddDefaultHandlers(base::FilePath(kDocRoot)); | 443 test_server_->AddDefaultHandlers(base::FilePath(kDocRoot)); |
| 444 } | 444 } |
| (...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1522 EXPECT_EQ(-1, delegate.fetcher()->GetResponseCode()); | 1522 EXPECT_EQ(-1, delegate.fetcher()->GetResponseCode()); |
| 1523 EXPECT_TRUE(delegate.fetcher()->GetCookies().empty()); | 1523 EXPECT_TRUE(delegate.fetcher()->GetCookies().empty()); |
| 1524 std::string data; | 1524 std::string data; |
| 1525 EXPECT_TRUE(delegate.fetcher()->GetResponseAsString(&data)); | 1525 EXPECT_TRUE(delegate.fetcher()->GetResponseAsString(&data)); |
| 1526 EXPECT_TRUE(data.empty()); | 1526 EXPECT_TRUE(data.empty()); |
| 1527 } | 1527 } |
| 1528 | 1528 |
| 1529 } // namespace | 1529 } // namespace |
| 1530 | 1530 |
| 1531 } // namespace net | 1531 } // namespace net |
| OLD | NEW |