| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "mojo/common/data_pipe_utils.h" | 8 #include "mojo/common/data_pipe_utils.h" |
| 9 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
| 10 #include "mojo/public/cpp/application/application_test_base.h" | 10 #include "mojo/public/cpp/application/application_test_base.h" |
| 11 #include "mojo/public/cpp/system/macros.h" | 11 #include "mojo/public/cpp/system/macros.h" |
| 12 #include "mojo/services/http_server/public/cpp/http_server_util.h" |
| 13 #include "mojo/services/http_server/public/interfaces/http_server.mojom.h" |
| 14 #include "mojo/services/http_server/public/interfaces/http_server_factory.mojom.
h" |
| 12 #include "mojo/services/network/public/interfaces/net_address.mojom.h" | 15 #include "mojo/services/network/public/interfaces/net_address.mojom.h" |
| 13 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | 16 #include "mojo/services/network/public/interfaces/network_service.mojom.h" |
| 14 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 17 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" |
| 15 #include "services/http_server/public/http_server.mojom.h" | |
| 16 #include "services/http_server/public/http_server_factory.mojom.h" | |
| 17 #include "services/http_server/public/http_server_util.h" | |
| 18 | 18 |
| 19 namespace http_server { | 19 namespace http_server { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 void WriteMessageToDataPipe( | 22 void WriteMessageToDataPipe( |
| 23 const std::string message, | 23 const std::string message, |
| 24 mojo::ScopedDataPipeConsumerHandle* data_pipe_consumer) { | 24 mojo::ScopedDataPipeConsumerHandle* data_pipe_consumer) { |
| 25 mojo::ScopedDataPipeProducerHandle producer_handle_; | 25 mojo::ScopedDataPipeProducerHandle producer_handle_; |
| 26 MojoCreateDataPipeOptions options = {sizeof(MojoCreateDataPipeOptions), | 26 MojoCreateDataPipeOptions options = {sizeof(MojoCreateDataPipeOptions), |
| 27 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, | 27 MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 url_request->method = "POST"; | 196 url_request->method = "POST"; |
| 197 url_request->body.resize(1); | 197 url_request->body.resize(1); |
| 198 WriteMessageToDataPipe(kExampleMessage, &url_request->body[0]); | 198 WriteMessageToDataPipe(kExampleMessage, &url_request->body[0]); |
| 199 | 199 |
| 200 url_loader->Start(url_request.Pass(), base::Bind(&CheckServerResponse)); | 200 url_loader->Start(url_request.Pass(), base::Bind(&CheckServerResponse)); |
| 201 base::RunLoop run_loop; | 201 base::RunLoop run_loop; |
| 202 run_loop.Run(); | 202 run_loop.Run(); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace http_server | 205 } // namespace http_server |
| OLD | NEW |