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/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 ~ShellHTTPAppTest() override {} | 78 ~ShellHTTPAppTest() override {} |
79 | 79 |
80 protected: | 80 protected: |
81 // ApplicationTestBase: | 81 // ApplicationTestBase: |
82 void SetUp() override { | 82 void SetUp() override { |
83 ApplicationTestBase::SetUp(); | 83 ApplicationTestBase::SetUp(); |
84 | 84 |
85 application_impl()->ConnectToService("mojo:http_server", | 85 application_impl()->ConnectToService("mojo:http_server", |
86 &http_server_factory_); | 86 &http_server_factory_); |
87 | 87 |
88 mojo::NetAddressPtr local_address(mojo::NetAddress::New()); | 88 NetAddressPtr local_address(NetAddress::New()); |
89 local_address->family = mojo::NET_ADDRESS_FAMILY_IPV4; | 89 local_address->family = NET_ADDRESS_FAMILY_IPV4; |
90 local_address->ipv4 = mojo::NetAddressIPv4::New(); | 90 local_address->ipv4 = NetAddressIPv4::New(); |
91 local_address->ipv4->addr.resize(4); | 91 local_address->ipv4->addr.resize(4); |
92 local_address->ipv4->addr[0] = 127; | 92 local_address->ipv4->addr[0] = 127; |
93 local_address->ipv4->addr[1] = 0; | 93 local_address->ipv4->addr[1] = 0; |
94 local_address->ipv4->addr[2] = 0; | 94 local_address->ipv4->addr[2] = 0; |
95 local_address->ipv4->addr[3] = 1; | 95 local_address->ipv4->addr[3] = 1; |
96 local_address->ipv4->port = 0; | 96 local_address->ipv4->port = 0; |
97 http_server_factory_->CreateHttpServer(GetProxy(&http_server_), | 97 http_server_factory_->CreateHttpServer(GetProxy(&http_server_), |
98 local_address.Pass()); | 98 local_address.Pass()); |
99 | 99 |
100 http_server_->GetPort([this](uint16_t p) { port_ = p; }); | 100 http_server_->GetPort([this](uint16_t p) { port_ = p; }); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 EXPECT_TRUE(EndsWith(app_url, "/pingable_app.mojo", true)); | 199 EXPECT_TRUE(EndsWith(app_url, "/pingable_app.mojo", true)); |
200 EXPECT_EQ(app_url.To<std::string>() + "?foo", connection_url); | 200 EXPECT_EQ(app_url.To<std::string>() + "?foo", connection_url); |
201 EXPECT_EQ("hello", message); | 201 EXPECT_EQ("hello", message); |
202 base::MessageLoop::current()->Quit(); | 202 base::MessageLoop::current()->Quit(); |
203 }; | 203 }; |
204 pingable->Ping("hello", callback); | 204 pingable->Ping("hello", callback); |
205 base::RunLoop().Run(); | 205 base::RunLoop().Run(); |
206 } | 206 } |
207 | 207 |
208 } // namespace mojo | 208 } // namespace mojo |
OLD | NEW |