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

Side by Side Diff: services/js/echo_apptest.cc

Issue 1150563003: Rename InterfacePtr's WaitForIncomingMethodCall() -> WaitForIncomingResponse(). (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « services/http_server/http_server_apptest.cc ('k') | services/js/network_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "services/js/test/echo_service.mojom.h" 5 #include "services/js/test/echo_service.mojom.h"
6 #include "services/js/test/js_application_test_base.h" 6 #include "services/js/test/js_application_test_base.h"
7 7
8 using mojo::String; 8 using mojo::String;
9 9
10 namespace js { 10 namespace js {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void Run(bool callback_value) const { 62 void Run(bool callback_value) const {
63 *value = callback_value; 63 *value = callback_value;
64 } 64 }
65 bool *value; 65 bool *value;
66 }; 66 };
67 67
68 TEST_F(JSEchoTest, EchoString) { 68 TEST_F(JSEchoTest, EchoString) {
69 String foo; 69 String foo;
70 EchoStringCallback callback(&foo); 70 EchoStringCallback callback(&foo);
71 echo_service_->EchoString("foo", callback); 71 echo_service_->EchoString("foo", callback);
72 EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall()); 72 EXPECT_TRUE(echo_service_.WaitForIncomingResponse());
73 EXPECT_EQ("foo", foo); 73 EXPECT_EQ("foo", foo);
74 echo_service_->Quit(); 74 echo_service_->Quit();
75 } 75 }
76 76
77 TEST_F(JSEchoTest, EchoEmptyString) { 77 TEST_F(JSEchoTest, EchoEmptyString) {
78 String empty; 78 String empty;
79 EchoStringCallback callback(&empty); 79 EchoStringCallback callback(&empty);
80 echo_service_->EchoString("", callback); 80 echo_service_->EchoString("", callback);
81 EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall()); 81 EXPECT_TRUE(echo_service_.WaitForIncomingResponse());
82 EXPECT_EQ("", empty); 82 EXPECT_EQ("", empty);
83 echo_service_->Quit(); 83 echo_service_->Quit();
84 } 84 }
85 85
86 TEST_F(JSEchoTest, EchoNullString) { 86 TEST_F(JSEchoTest, EchoNullString) {
87 String null; 87 String null;
88 EchoStringCallback callback(&null); 88 EchoStringCallback callback(&null);
89 echo_service_->EchoString(nullptr, callback); 89 echo_service_->EchoString(nullptr, callback);
90 EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall()); 90 EXPECT_TRUE(echo_service_.WaitForIncomingResponse());
91 EXPECT_TRUE(null.is_null()); 91 EXPECT_TRUE(null.is_null());
92 echo_service_->Quit(); 92 echo_service_->Quit();
93 } 93 }
94 94
95 // Verify that a JS app's ServiceProvider can request and provide services. 95 // Verify that a JS app's ServiceProvider can request and provide services.
96 // This test exercises the same code paths as examples/js/share_echo.js. 96 // This test exercises the same code paths as examples/js/share_echo.js.
97 TEST_F(JSEchoTest, ShareEchoService) { 97 TEST_F(JSEchoTest, ShareEchoService) {
98 bool returned_value; 98 bool returned_value;
99 ShareEchoServiceCallback callback(&returned_value); 99 ShareEchoServiceCallback callback(&returned_value);
100 echo_service_->ShareEchoService(callback); 100 echo_service_->ShareEchoService(callback);
101 EXPECT_TRUE(echo_service_.WaitForIncomingMethodCall()); 101 EXPECT_TRUE(echo_service_.WaitForIncomingResponse());
102 EXPECT_TRUE(returned_value); 102 EXPECT_TRUE(returned_value);
103 echo_service_->Quit(); 103 echo_service_->Quit();
104 } 104 }
105 105
106 // Verify that connecting via the echo service application's ServiceProvider 106 // Verify that connecting via the echo service application's ServiceProvider
107 // behaves the same as connecting to the echo service directly. 107 // behaves the same as connecting to the echo service directly.
108 TEST_F(JSServiceProviderEchoTest, UseApplicationServiceProvider) { 108 TEST_F(JSServiceProviderEchoTest, UseApplicationServiceProvider) {
109 mojo::EchoServicePtr echo_service; 109 mojo::EchoServicePtr echo_service;
110 mojo::MessagePipe pipe; 110 mojo::MessagePipe pipe;
111 echo_service.Bind( 111 echo_service.Bind(
112 mojo::InterfacePtrInfo<mojo::EchoService>(pipe.handle0.Pass(), 0u)); 112 mojo::InterfacePtrInfo<mojo::EchoService>(pipe.handle0.Pass(), 0u));
113 echo_service_provider_->ConnectToService( 113 echo_service_provider_->ConnectToService(
114 mojo::EchoService::Name_, pipe.handle1.Pass()); 114 mojo::EchoService::Name_, pipe.handle1.Pass());
115 String foo; 115 String foo;
116 EchoStringCallback callback(&foo); 116 EchoStringCallback callback(&foo);
117 echo_service->EchoString("foo", callback); 117 echo_service->EchoString("foo", callback);
118 EXPECT_TRUE(echo_service.WaitForIncomingMethodCall()); 118 EXPECT_TRUE(echo_service.WaitForIncomingResponse());
119 EXPECT_EQ("foo", foo); 119 EXPECT_EQ("foo", foo);
120 echo_service->Quit(); 120 echo_service->Quit();
121 } 121 }
122 122
123 } // namespace 123 } // namespace
124 } // namespace js 124 } // namespace js
OLDNEW
« no previous file with comments | « services/http_server/http_server_apptest.cc ('k') | services/js/network_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698