Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: mojo/services/network/http_server_apptest.cc

Issue 1254383016: ApplicationConnection lifetime management changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/mojo_base.gyp ('k') | mojo/services/network/udp_socket_apptest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/mojo_base.gyp ('k') | mojo/services/network/udp_socket_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698