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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 ~HttpServerAppTest() override {} | 551 ~HttpServerAppTest() override {} |
552 | 552 |
553 protected: | 553 protected: |
554 bool ShouldCreateDefaultRunLoop() override { return false; } | 554 bool ShouldCreateDefaultRunLoop() override { return false; } |
555 | 555 |
556 void SetUp() override { | 556 void SetUp() override { |
557 ApplicationTestBase::SetUp(); | 557 ApplicationTestBase::SetUp(); |
558 | 558 |
559 scoped_ptr<Connection> connection = | 559 scoped_ptr<Connection> connection = |
560 shell()->Connect("mojo:network_service"); | 560 shell()->Connect("mojo:network_service"); |
561 connection->ConnectToService(&network_service_); | 561 connection->GetInterface(&network_service_); |
562 connection->ConnectToService(&web_socket_factory_); | 562 connection->GetInterface(&web_socket_factory_); |
563 } | 563 } |
564 | 564 |
565 void CreateHttpServer(HttpServerDelegatePtr delegate, | 565 void CreateHttpServer(HttpServerDelegatePtr delegate, |
566 NetAddressPtr* out_bound_to) { | 566 NetAddressPtr* out_bound_to) { |
567 network_service_->CreateHttpServer( | 567 network_service_->CreateHttpServer( |
568 GetLocalHostWithAnyPort(), std::move(delegate), | 568 GetLocalHostWithAnyPort(), std::move(delegate), |
569 [out_bound_to](NetworkErrorPtr result, NetAddressPtr bound_to) { | 569 [out_bound_to](NetworkErrorPtr result, NetAddressPtr bound_to) { |
570 ASSERT_EQ(net::OK, result->code); | 570 ASSERT_EQ(net::OK, result->code); |
571 EXPECT_NE(0u, bound_to->ipv4->port); | 571 EXPECT_NE(0u, bound_to->ipv4->port); |
572 *out_bound_to = std::move(bound_to); | 572 *out_bound_to = std::move(bound_to); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 689 |
690 socket_1.Send("How do"); | 690 socket_1.Send("How do"); |
691 socket_1.Send("you do?"); | 691 socket_1.Send("you do?"); |
692 | 692 |
693 socket_0.WaitForMessage(2); | 693 socket_0.WaitForMessage(2); |
694 EXPECT_EQ("How do", socket_0.received_messages()[0]); | 694 EXPECT_EQ("How do", socket_0.received_messages()[0]); |
695 EXPECT_EQ("you do?", socket_0.received_messages()[1]); | 695 EXPECT_EQ("you do?", socket_0.received_messages()[1]); |
696 } | 696 } |
697 | 697 |
698 } // namespace mojo | 698 } // namespace mojo |
OLD | NEW |