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" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 http_server::HttpServerFactoryPtr http_server_factory_; | 108 http_server::HttpServerFactoryPtr http_server_factory_; |
109 mojo::NetworkServicePtr network_service_; | 109 mojo::NetworkServicePtr network_service_; |
110 | 110 |
111 private: | 111 private: |
112 MOJO_DISALLOW_COPY_AND_ASSIGN(HttpServerApplicationTest); | 112 MOJO_DISALLOW_COPY_AND_ASSIGN(HttpServerApplicationTest); |
113 }; | 113 }; |
114 | 114 |
115 http_server::HttpServerPtr HttpServerApplicationTest::CreateHttpServer() { | 115 http_server::HttpServerPtr HttpServerApplicationTest::CreateHttpServer() { |
116 http_server::HttpServerPtr http_server; | 116 http_server::HttpServerPtr http_server; |
117 mojo::NetAddressPtr local_address(mojo::NetAddress::New()); | 117 mojo::NetAddressPtr local_address(mojo::NetAddress::New()); |
118 local_address->family = mojo::NET_ADDRESS_FAMILY_IPV4; | 118 local_address->family = mojo::NetAddressFamily::IPV4; |
119 local_address->ipv4 = mojo::NetAddressIPv4::New(); | 119 local_address->ipv4 = mojo::NetAddressIPv4::New(); |
120 local_address->ipv4->addr.resize(4); | 120 local_address->ipv4->addr.resize(4); |
121 local_address->ipv4->addr[0] = 127; | 121 local_address->ipv4->addr[0] = 127; |
122 local_address->ipv4->addr[1] = 0; | 122 local_address->ipv4->addr[1] = 0; |
123 local_address->ipv4->addr[2] = 0; | 123 local_address->ipv4->addr[2] = 0; |
124 local_address->ipv4->addr[3] = 1; | 124 local_address->ipv4->addr[3] = 1; |
125 local_address->ipv4->port = 0; | 125 local_address->ipv4->port = 0; |
126 http_server_factory_->CreateHttpServer(GetProxy(&http_server).Pass(), | 126 http_server_factory_->CreateHttpServer(GetProxy(&http_server).Pass(), |
127 local_address.Pass()); | 127 local_address.Pass()); |
128 return http_server.Pass(); | 128 return http_server.Pass(); |
(...skipping 59 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 |