| 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/test/embedded_test_server/embedded_test_server.h" | 5 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
| 9 #include "net/http/http_response_headers.h" | 9 #include "net/http/http_response_headers.h" |
| 10 #include "net/test/embedded_test_server/http_request.h" | 10 #include "net/test/embedded_test_server/http_request.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 HttpStatusCode code, | 88 HttpStatusCode code, |
| 89 const HttpRequest& request) { | 89 const HttpRequest& request) { |
| 90 request_relative_url_ = request.relative_url; | 90 request_relative_url_ = request.relative_url; |
| 91 | 91 |
| 92 GURL absolute_url = server_->GetURL(request.relative_url); | 92 GURL absolute_url = server_->GetURL(request.relative_url); |
| 93 if (absolute_url.path() == path) { | 93 if (absolute_url.path() == path) { |
| 94 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse); | 94 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse); |
| 95 http_response->set_code(code); | 95 http_response->set_code(code); |
| 96 http_response->set_content(content); | 96 http_response->set_content(content); |
| 97 http_response->set_content_type(content_type); | 97 http_response->set_content_type(content_type); |
| 98 return http_response.PassAs<HttpResponse>(); | 98 return http_response.Pass(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 return scoped_ptr<HttpResponse>(); | 101 return nullptr; |
| 102 } | 102 } |
| 103 | 103 |
| 104 protected: | 104 protected: |
| 105 int num_responses_received_; | 105 int num_responses_received_; |
| 106 int num_responses_expected_; | 106 int num_responses_expected_; |
| 107 std::string request_relative_url_; | 107 std::string request_relative_url_; |
| 108 base::Thread io_thread_; | 108 base::Thread io_thread_; |
| 109 scoped_refptr<TestURLRequestContextGetter> request_context_getter_; | 109 scoped_refptr<TestURLRequestContextGetter> request_context_getter_; |
| 110 scoped_ptr<EmbeddedTestServer> server_; | 110 scoped_ptr<EmbeddedTestServer> server_; |
| 111 }; | 111 }; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 ASSERT_TRUE(base::PlatformThread::Create(0, &delegate, &thread_handle)); | 320 ASSERT_TRUE(base::PlatformThread::Create(0, &delegate, &thread_handle)); |
| 321 base::PlatformThread::Join(thread_handle); | 321 base::PlatformThread::Join(thread_handle); |
| 322 } | 322 } |
| 323 | 323 |
| 324 INSTANTIATE_TEST_CASE_P(EmbeddedTestServerThreadingTestInstantiation, | 324 INSTANTIATE_TEST_CASE_P(EmbeddedTestServerThreadingTestInstantiation, |
| 325 EmbeddedTestServerThreadingTest, | 325 EmbeddedTestServerThreadingTest, |
| 326 testing::Combine(testing::Bool(), testing::Bool())); | 326 testing::Combine(testing::Bool(), testing::Bool())); |
| 327 | 327 |
| 328 } // namespace test_server | 328 } // namespace test_server |
| 329 } // namespace net | 329 } // namespace net |
| OLD | NEW |