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