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/data_pipe_utils/data_pipe_utils.h" | 8 #include "mojo/data_pipe_utils/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" | 12 #include "mojo/services/http_server/cpp/http_server_util.h" |
13 #include "mojo/services/http_server/public/interfaces/http_server.mojom.h" | 13 #include "mojo/services/http_server/interfaces/http_server.mojom.h" |
14 #include "mojo/services/http_server/public/interfaces/http_server_factory.mojom.
h" | 14 #include "mojo/services/http_server/interfaces/http_server_factory.mojom.h" |
15 #include "mojo/services/network/public/interfaces/net_address.mojom.h" | 15 #include "mojo/services/network/public/interfaces/net_address.mojom.h" |
16 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | 16 #include "mojo/services/network/public/interfaces/network_service.mojom.h" |
17 #include "mojo/services/network/public/interfaces/url_loader.mojom.h" | 17 #include "mojo/services/network/public/interfaces/url_loader.mojom.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) { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 url_request->method = "POST"; | 188 url_request->method = "POST"; |
189 url_request->body.resize(1); | 189 url_request->body.resize(1); |
190 WriteMessageToDataPipe(kExampleMessage, &url_request->body[0]); | 190 WriteMessageToDataPipe(kExampleMessage, &url_request->body[0]); |
191 | 191 |
192 url_loader->Start(url_request.Pass(), base::Bind(&CheckServerResponse)); | 192 url_loader->Start(url_request.Pass(), base::Bind(&CheckServerResponse)); |
193 base::RunLoop run_loop; | 193 base::RunLoop run_loop; |
194 run_loop.Run(); | 194 run_loop.Run(); |
195 } | 195 } |
196 | 196 |
197 } // namespace http_server | 197 } // namespace http_server |
OLD | NEW |