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/logging.h" | 5 #include "base/logging.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/linked_ptr.h" | 7 #include "base/memory/linked_ptr.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 ~HttpServerAppTest() override {} | 546 ~HttpServerAppTest() override {} |
547 | 547 |
548 protected: | 548 protected: |
549 bool ShouldCreateDefaultRunLoop() override { return false; } | 549 bool ShouldCreateDefaultRunLoop() override { return false; } |
550 | 550 |
551 void SetUp() override { | 551 void SetUp() override { |
552 ApplicationTestBase::SetUp(); | 552 ApplicationTestBase::SetUp(); |
553 | 553 |
554 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 554 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
555 request->url = mojo::String::From("mojo:network_service"); | 555 request->url = mojo::String::From("mojo:network_service"); |
556 ApplicationConnection* connection = | 556 scoped_ptr<ApplicationConnection> connection = |
557 application_impl()->ConnectToApplication(request.Pass()); | 557 application_impl()->ConnectToApplication(request.Pass()); |
558 connection->ConnectToService(&network_service_); | 558 connection->ConnectToService(&network_service_); |
559 } | 559 } |
560 | 560 |
561 void CreateHttpServer(HttpServerDelegatePtr delegate, | 561 void CreateHttpServer(HttpServerDelegatePtr delegate, |
562 NetAddressPtr* out_bound_to) { | 562 NetAddressPtr* out_bound_to) { |
563 network_service_->CreateHttpServer( | 563 network_service_->CreateHttpServer( |
564 GetLocalHostWithAnyPort(), delegate.Pass(), | 564 GetLocalHostWithAnyPort(), delegate.Pass(), |
565 [out_bound_to](NetworkErrorPtr result, NetAddressPtr bound_to) { | 565 [out_bound_to](NetworkErrorPtr result, NetAddressPtr bound_to) { |
566 ASSERT_EQ(net::OK, result->code); | 566 ASSERT_EQ(net::OK, result->code); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 682 |
683 socket_1.Send("How do"); | 683 socket_1.Send("How do"); |
684 socket_1.Send("you do?"); | 684 socket_1.Send("you do?"); |
685 | 685 |
686 socket_0.WaitForMessage(2); | 686 socket_0.WaitForMessage(2); |
687 EXPECT_EQ("How do", socket_0.received_messages()[0]); | 687 EXPECT_EQ("How do", socket_0.received_messages()[0]); |
688 EXPECT_EQ("you do?", socket_0.received_messages()[1]); | 688 EXPECT_EQ("you do?", socket_0.received_messages()[1]); |
689 } | 689 } |
690 | 690 |
691 } // namespace mojo | 691 } // namespace mojo |
OLD | NEW |