| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 ++num_responses_received_; | 156 ++num_responses_received_; |
| 157 if (num_responses_received_ == num_responses_expected_) | 157 if (num_responses_received_ == num_responses_expected_) |
| 158 base::MessageLoop::current()->QuitWhenIdle(); | 158 base::MessageLoop::current()->QuitWhenIdle(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Waits until the specified number of responses are received. | 161 // Waits until the specified number of responses are received. |
| 162 void WaitForResponses(int num_responses) { | 162 void WaitForResponses(int num_responses) { |
| 163 num_responses_received_ = 0; | 163 num_responses_received_ = 0; |
| 164 num_responses_expected_ = num_responses; | 164 num_responses_expected_ = num_responses; |
| 165 // Will be terminated in OnURLFetchComplete(). | 165 // Will be terminated in OnURLFetchComplete(). |
| 166 base::MessageLoop::current()->Run(); | 166 base::RunLoop().Run(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Handles |request| sent to |path| and returns the response per |content|, | 169 // Handles |request| sent to |path| and returns the response per |content|, |
| 170 // |content type|, and |code|. Saves the request URL for verification. | 170 // |content type|, and |code|. Saves the request URL for verification. |
| 171 std::unique_ptr<HttpResponse> HandleRequest(const std::string& path, | 171 std::unique_ptr<HttpResponse> HandleRequest(const std::string& path, |
| 172 const std::string& content, | 172 const std::string& content, |
| 173 const std::string& content_type, | 173 const std::string& content_type, |
| 174 HttpStatusCode code, | 174 HttpStatusCode code, |
| 175 const HttpRequest& request) { | 175 const HttpRequest& request) { |
| 176 request_relative_url_ = request.relative_url; | 176 request_relative_url_ = request.relative_url; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 INSTANTIATE_TEST_CASE_P( | 593 INSTANTIATE_TEST_CASE_P( |
| 594 EmbeddedTestServerThreadingTestInstantiation, | 594 EmbeddedTestServerThreadingTestInstantiation, |
| 595 EmbeddedTestServerThreadingTest, | 595 EmbeddedTestServerThreadingTest, |
| 596 testing::Combine(testing::Bool(), | 596 testing::Combine(testing::Bool(), |
| 597 testing::Bool(), | 597 testing::Bool(), |
| 598 testing::Values(EmbeddedTestServer::TYPE_HTTP, | 598 testing::Values(EmbeddedTestServer::TYPE_HTTP, |
| 599 EmbeddedTestServer::TYPE_HTTPS))); | 599 EmbeddedTestServer::TYPE_HTTPS))); |
| 600 | 600 |
| 601 } // namespace test_server | 601 } // namespace test_server |
| 602 } // namespace net | 602 } // namespace net |
| OLD | NEW |