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

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

Issue 845593003: Pass ServiceProvider and ServiceProvider& params in Connect (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: use nullptr instead of ServiceProviderPtr(), fix ShellImpl Created 5 years, 11 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/services/public/js/application.js ('k') | shell/context.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 21 matching lines...) Expand all
32 class JSServiceProviderEchoTest : public test::JSApplicationTestBase { 32 class JSServiceProviderEchoTest : public test::JSApplicationTestBase {
33 public: 33 public:
34 JSServiceProviderEchoTest() : JSApplicationTestBase() {} 34 JSServiceProviderEchoTest() : JSApplicationTestBase() {}
35 ~JSServiceProviderEchoTest() override {} 35 ~JSServiceProviderEchoTest() override {}
36 36
37 protected: 37 protected:
38 // ApplicationTestBase: 38 // ApplicationTestBase:
39 void SetUp() override { 39 void SetUp() override {
40 ApplicationTestBase::SetUp(); 40 ApplicationTestBase::SetUp();
41 const std::string& url = JSAppURL("echo.js"); 41 const std::string& url = JSAppURL("echo.js");
42 // TODO(hansmuller): We should be able to pass a null ServiceProviderPtr
43 // here as the third parameter to ConnectToApplication since the parameter
44 // is annotated as nullable in the mojom, but the JS bindings currently
45 // don't correctly handle a null handle. So instead we allocate (and
46 // immediately close) a MessagePipe.
47 mojo::MessagePipe throwaway_pipe;
48 mojo::ServiceProviderPtr exposed_services;
49 exposed_services.Bind(throwaway_pipe.handle0.Pass());
42 application_impl()->shell()->ConnectToApplication( 50 application_impl()->shell()->ConnectToApplication(
43 url, GetProxy(&echo_service_provider_)); 51 url, GetProxy(&echo_service_provider_), exposed_services.Pass());
44 } 52 }
45 53
46 mojo::ServiceProviderPtr echo_service_provider_; 54 mojo::ServiceProviderPtr echo_service_provider_;
47 55
48 private: 56 private:
49 MOJO_DISALLOW_COPY_AND_ASSIGN(JSServiceProviderEchoTest); 57 MOJO_DISALLOW_COPY_AND_ASSIGN(JSServiceProviderEchoTest);
50 }; 58 };
51 59
52 struct EchoStringCallback { 60 struct EchoStringCallback {
53 explicit EchoStringCallback(String *s) : echo_value(s) {} 61 explicit EchoStringCallback(String *s) : echo_value(s) {}
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 String foo; 122 String foo;
115 EchoStringCallback callback(&foo); 123 EchoStringCallback callback(&foo);
116 echo_service->EchoString("foo", callback); 124 echo_service->EchoString("foo", callback);
117 EXPECT_TRUE(echo_service.WaitForIncomingMethodCall()); 125 EXPECT_TRUE(echo_service.WaitForIncomingMethodCall());
118 EXPECT_EQ("foo", foo); 126 EXPECT_EQ("foo", foo);
119 echo_service->Quit(); 127 echo_service->Quit();
120 } 128 }
121 129
122 } // namespace 130 } // namespace
123 } // namespace js 131 } // namespace js
OLDNEW
« no previous file with comments | « mojo/services/public/js/application.js ('k') | shell/context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698