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

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

Issue 1916233002: Mark ApplicationImpl::ConnectTo{Application,Service}() as deprecated. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 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
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/js_application_test_base.h" 5 #include "services/js/test/js_application_test_base.h"
6 #include "services/js/test/pingpong_service.mojom.h" 6 #include "services/js/test/pingpong_service.mojom.h"
7 7
8 namespace js { 8 namespace js {
9 namespace { 9 namespace {
10 10
(...skipping 27 matching lines...) Expand all
38 class JSPingPongTest : public test::JSApplicationTestBase { 38 class JSPingPongTest : public test::JSApplicationTestBase {
39 public: 39 public:
40 JSPingPongTest() : JSApplicationTestBase() {} 40 JSPingPongTest() : JSApplicationTestBase() {}
41 ~JSPingPongTest() override {} 41 ~JSPingPongTest() override {}
42 42
43 protected: 43 protected:
44 // ApplicationTestBase: 44 // ApplicationTestBase:
45 void SetUp() override { 45 void SetUp() override {
46 ApplicationTestBase::SetUp(); 46 ApplicationTestBase::SetUp();
47 const std::string& url = JSAppURL("pingpong.js"); 47 const std::string& url = JSAppURL("pingpong.js");
48 application_impl()->ConnectToService(url, &pingpong_service_); 48 application_impl()->ConnectToServiceDeprecated(url, &pingpong_service_);
49 PingPongClientPtr client_ptr; 49 PingPongClientPtr client_ptr;
50 pingpong_client_.Bind(GetProxy(&client_ptr)); 50 pingpong_client_.Bind(GetProxy(&client_ptr));
51 pingpong_service_->SetClient(client_ptr.Pass()); 51 pingpong_service_->SetClient(client_ptr.Pass());
52 } 52 }
53 53
54 PingPongServicePtr pingpong_service_; 54 PingPongServicePtr pingpong_service_;
55 PingPongClientImpl pingpong_client_; 55 PingPongClientImpl pingpong_client_;
56 56
57 private: 57 private:
58 MOJO_DISALLOW_COPY_AND_ASSIGN(JSPingPongTest); 58 MOJO_DISALLOW_COPY_AND_ASSIGN(JSPingPongTest);
(...skipping 26 matching lines...) Expand all
85 pingpong_service_->PingTargetURL(JSAppURL("pingpong_target.js"), 9, callback); 85 pingpong_service_->PingTargetURL(JSAppURL("pingpong_target.js"), 9, callback);
86 EXPECT_TRUE(pingpong_service_.WaitForIncomingResponse()); 86 EXPECT_TRUE(pingpong_service_.WaitForIncomingResponse());
87 EXPECT_TRUE(returned_value); 87 EXPECT_TRUE(returned_value);
88 pingpong_service_->Quit(); 88 pingpong_service_->Quit();
89 } 89 }
90 90
91 // Same as the previous test except that instead of providing the 91 // Same as the previous test except that instead of providing the
92 // pingpong-target.js URL, we provide a connection to its PingPongService. 92 // pingpong-target.js URL, we provide a connection to its PingPongService.
93 TEST_F(JSPingPongTest, PingTargetService) { 93 TEST_F(JSPingPongTest, PingTargetService) {
94 PingPongServicePtr target; 94 PingPongServicePtr target;
95 application_impl()->ConnectToService(JSAppURL("pingpong_target.js"), &target); 95 application_impl()->ConnectToServiceDeprecated(JSAppURL("pingpong_target.js"),
96 &target);
96 bool returned_value = false; 97 bool returned_value = false;
97 PingTargetCallback callback(&returned_value); 98 PingTargetCallback callback(&returned_value);
98 pingpong_service_->PingTargetService(target.Pass(), 9, callback); 99 pingpong_service_->PingTargetService(target.Pass(), 9, callback);
99 EXPECT_TRUE(pingpong_service_.WaitForIncomingResponse()); 100 EXPECT_TRUE(pingpong_service_.WaitForIncomingResponse());
100 EXPECT_TRUE(returned_value); 101 EXPECT_TRUE(returned_value);
101 pingpong_service_->Quit(); 102 pingpong_service_->Quit();
102 } 103 }
103 104
104 // Verify that JS can implement an interface& "request" parameter. 105 // Verify that JS can implement an interface& "request" parameter.
105 TEST_F(JSPingPongTest, GetTargetService) { 106 TEST_F(JSPingPongTest, GetTargetService) {
106 PingPongServicePtr target; 107 PingPongServicePtr target;
107 PingPongClientImpl client; 108 PingPongClientImpl client;
108 pingpong_service_->GetPingPongService(GetProxy(&target)); 109 pingpong_service_->GetPingPongService(GetProxy(&target));
109 PingPongClientPtr client_ptr; 110 PingPongClientPtr client_ptr;
110 client.Bind(GetProxy(&client_ptr)); 111 client.Bind(GetProxy(&client_ptr));
111 target->SetClient(client_ptr.Pass()); 112 target->SetClient(client_ptr.Pass());
112 target->Ping(1); 113 target->Ping(1);
113 EXPECT_EQ(2, client.WaitForPongValue()); 114 EXPECT_EQ(2, client.WaitForPongValue());
114 target->Ping(100); 115 target->Ping(100);
115 EXPECT_EQ(101, client.WaitForPongValue()); 116 EXPECT_EQ(101, client.WaitForPongValue());
116 target->Quit(); 117 target->Quit();
117 pingpong_service_->Quit(); 118 pingpong_service_->Quit();
118 } 119 }
119 120
120 121
121 } // namespace 122 } // namespace
122 } // namespace js 123 } // namespace js
OLDNEW
« no previous file with comments | « services/js/network_apptest.cc ('k') | services/media/factory_service/audio_track_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698