1 /*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 #include <chrono>
18 #include <cstdlib>
19 #include <type_traits>
20
21 #include "binderRpcTestCommon.h"
22 #include "binderRpcTestFixture.h"
23
24 using namespace std::chrono_literals;
25 using namespace std::placeholders;
26 using testing::AssertionFailure;
27 using testing::AssertionResult;
28 using testing::AssertionSuccess;
29
30 namespace android {
31
32 static_assert(RPC_WIRE_PROTOCOL_VERSION + 1 == RPC_WIRE_PROTOCOL_VERSION_NEXT ||
33 RPC_WIRE_PROTOCOL_VERSION == RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL);
34
TEST(BinderRpcParcel,EntireParcelFormatted)35 TEST(BinderRpcParcel, EntireParcelFormatted) {
36 Parcel p;
37 p.writeInt32(3);
38
39 EXPECT_DEATH_IF_SUPPORTED(p.markForBinder(sp<BBinder>::make()),
40 "format must be set before data is written");
41 }
42
TEST(BinderRpc,CannotUseNextWireVersion)43 TEST(BinderRpc, CannotUseNextWireVersion) {
44 auto session = RpcSession::make();
45 EXPECT_FALSE(session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_NEXT));
46 EXPECT_FALSE(session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_NEXT + 1));
47 EXPECT_FALSE(session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_NEXT + 2));
48 EXPECT_FALSE(session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_NEXT + 15));
49 }
50
51 #ifndef BINDER_RPC_TO_TRUSTY_TEST
TEST(BinderRpc,CanUseExperimentalWireVersion)52 TEST(BinderRpc, CanUseExperimentalWireVersion) {
53 auto session = RpcSession::make();
54 EXPECT_EQ(hasExperimentalRpc(),
55 session->setProtocolVersion(RPC_WIRE_PROTOCOL_VERSION_EXPERIMENTAL));
56 }
57 #endif
58
TEST_P(BinderRpc,Ping)59 TEST_P(BinderRpc, Ping) {
60 auto proc = createRpcTestSocketServerProcess({});
61 ASSERT_NE(proc.rootBinder, nullptr);
62 EXPECT_EQ(OK, proc.rootBinder->pingBinder());
63 }
64
TEST_P(BinderRpc,GetInterfaceDescriptor)65 TEST_P(BinderRpc, GetInterfaceDescriptor) {
66 auto proc = createRpcTestSocketServerProcess({});
67 ASSERT_NE(proc.rootBinder, nullptr);
68 EXPECT_EQ(IBinderRpcTest::descriptor, proc.rootBinder->getInterfaceDescriptor());
69 }
70
TEST_P(BinderRpc,MultipleSessions)71 TEST_P(BinderRpc, MultipleSessions) {
72 if (serverSingleThreaded()) {
73 // Tests with multiple sessions require a multi-threaded service,
74 // but work fine on a single-threaded client
75 GTEST_SKIP() << "This test requires a multi-threaded service";
76 }
77
78 auto proc = createRpcTestSocketServerProcess({.numThreads = 1, .numSessions = 5});
79 for (auto session : proc.proc->sessions) {
80 ASSERT_NE(nullptr, session.root);
81 EXPECT_EQ(OK, session.root->pingBinder());
82 }
83 }
84
TEST_P(BinderRpc,SeparateRootObject)85 TEST_P(BinderRpc, SeparateRootObject) {
86 if (serverSingleThreaded()) {
87 GTEST_SKIP() << "This test requires a multi-threaded service";
88 }
89
90 SocketType type = GetParam().type;
91 if (type == SocketType::PRECONNECTED || type == SocketType::UNIX ||
92 type == SocketType::UNIX_BOOTSTRAP || type == SocketType::UNIX_RAW) {
93 // we can't get port numbers for unix sockets
94 return;
95 }
96
97 auto proc = createRpcTestSocketServerProcess({.numSessions = 2});
98
99 int port1 = 0;
100 EXPECT_OK(proc.rootIface->getClientPort(&port1));
101
102 sp<IBinderRpcTest> rootIface2 = interface_cast<IBinderRpcTest>(proc.proc->sessions.at(1).root);
103 int port2;
104 EXPECT_OK(rootIface2->getClientPort(&port2));
105
106 // we should have a different IBinderRpcTest object created for each
107 // session, because we use setPerSessionRootObject
108 EXPECT_NE(port1, port2);
109 }
110
TEST_P(BinderRpc,TransactionsMustBeMarkedRpc)111 TEST_P(BinderRpc, TransactionsMustBeMarkedRpc) {
112 auto proc = createRpcTestSocketServerProcess({});
113 Parcel data;
114 Parcel reply;
115 EXPECT_EQ(BAD_TYPE, proc.rootBinder->transact(IBinder::PING_TRANSACTION, data, &reply, 0));
116 }
117
TEST_P(BinderRpc,AppendSeparateFormats)118 TEST_P(BinderRpc, AppendSeparateFormats) {
119 if (socketType() == SocketType::TIPC) {
120 GTEST_SKIP() << "Trusty does not support multiple server processes";
121 }
122
123 auto proc1 = createRpcTestSocketServerProcess({});
124 auto proc2 = createRpcTestSocketServerProcess({});
125
126 Parcel pRaw;
127
128 Parcel p1;
129 p1.markForBinder(proc1.rootBinder);
130 p1.writeInt32(3);
131
132 EXPECT_EQ(BAD_TYPE, p1.appendFrom(&pRaw, 0, pRaw.dataSize()));
133 EXPECT_EQ(BAD_TYPE, pRaw.appendFrom(&p1, 0, p1.dataSize()));
134
135 Parcel p2;
136 p2.markForBinder(proc2.rootBinder);
137 p2.writeInt32(7);
138
139 EXPECT_EQ(BAD_TYPE, p1.appendFrom(&p2, 0, p2.dataSize()));
140 EXPECT_EQ(BAD_TYPE, p2.appendFrom(&p1, 0, p1.dataSize()));
141 }
142
TEST_P(BinderRpc,UnknownTransaction)143 TEST_P(BinderRpc, UnknownTransaction) {
144 auto proc = createRpcTestSocketServerProcess({});
145 Parcel data;
146 data.markForBinder(proc.rootBinder);
147 Parcel reply;
148 EXPECT_EQ(UNKNOWN_TRANSACTION, proc.rootBinder->transact(1337, data, &reply, 0));
149 }
150
TEST_P(BinderRpc,SendSomethingOneway)151 TEST_P(BinderRpc, SendSomethingOneway) {
152 auto proc = createRpcTestSocketServerProcess({});
153 EXPECT_OK(proc.rootIface->sendString("asdf"));
154 }
155
TEST_P(BinderRpc,SendAndGetResultBack)156 TEST_P(BinderRpc, SendAndGetResultBack) {
157 auto proc = createRpcTestSocketServerProcess({});
158 std::string doubled;
159 EXPECT_OK(proc.rootIface->doubleString("cool ", &doubled));
160 EXPECT_EQ("cool cool ", doubled);
161 }
162
TEST_P(BinderRpc,SendAndGetResultBackBig)163 TEST_P(BinderRpc, SendAndGetResultBackBig) {
164 auto proc = createRpcTestSocketServerProcess({});
165 // Trusty has a limit of 4096 bytes for the entire RPC Binder message
166 size_t singleLen = socketType() == SocketType::TIPC ? 512 : 4096;
167 std::string single = std::string(singleLen, 'a');
168 std::string doubled;
169 EXPECT_OK(proc.rootIface->doubleString(single, &doubled));
170 EXPECT_EQ(single + single, doubled);
171 }
172
TEST_P(BinderRpc,InvalidNullBinderReturn)173 TEST_P(BinderRpc, InvalidNullBinderReturn) {
174 auto proc = createRpcTestSocketServerProcess({});
175
176 sp<IBinder> outBinder;
177 EXPECT_EQ(proc.rootIface->getNullBinder(&outBinder).transactionError(), UNEXPECTED_NULL);
178 }
179
TEST_P(BinderRpc,CallMeBack)180 TEST_P(BinderRpc, CallMeBack) {
181 auto proc = createRpcTestSocketServerProcess({});
182
183 int32_t pingResult;
184 EXPECT_OK(proc.rootIface->pingMe(new MyBinderRpcSession("foo"), &pingResult));
185 EXPECT_EQ(OK, pingResult);
186
187 EXPECT_EQ(0, MyBinderRpcSession::gNum);
188 }
189
TEST_P(BinderRpc,RepeatBinder)190 TEST_P(BinderRpc, RepeatBinder) {
191 auto proc = createRpcTestSocketServerProcess({});
192
193 sp<IBinder> inBinder = new MyBinderRpcSession("foo");
194 sp<IBinder> outBinder;
195 EXPECT_OK(proc.rootIface->repeatBinder(inBinder, &outBinder));
196 EXPECT_EQ(inBinder, outBinder);
197
198 wp<IBinder> weak = inBinder;
199 inBinder = nullptr;
200 outBinder = nullptr;
201
202 // Force reading a reply, to process any pending dec refs from the other
203 // process (the other process will process dec refs there before processing
204 // the ping here).
205 EXPECT_EQ(OK, proc.rootBinder->pingBinder());
206
207 EXPECT_EQ(nullptr, weak.promote());
208
209 EXPECT_EQ(0, MyBinderRpcSession::gNum);
210 }
211
TEST_P(BinderRpc,RepeatTheirBinder)212 TEST_P(BinderRpc, RepeatTheirBinder) {
213 auto proc = createRpcTestSocketServerProcess({});
214
215 sp<IBinderRpcSession> session;
216 EXPECT_OK(proc.rootIface->openSession("aoeu", &session));
217
218 sp<IBinder> inBinder = IInterface::asBinder(session);
219 sp<IBinder> outBinder;
220 EXPECT_OK(proc.rootIface->repeatBinder(inBinder, &outBinder));
221 EXPECT_EQ(inBinder, outBinder);
222
223 wp<IBinder> weak = inBinder;
224 session = nullptr;
225 inBinder = nullptr;
226 outBinder = nullptr;
227
228 // Force reading a reply, to process any pending dec refs from the other
229 // process (the other process will process dec refs there before processing
230 // the ping here).
231 EXPECT_EQ(OK, proc.rootBinder->pingBinder());
232
233 EXPECT_EQ(nullptr, weak.promote());
234 }
235
TEST_P(BinderRpc,RepeatBinderNull)236 TEST_P(BinderRpc, RepeatBinderNull) {
237 auto proc = createRpcTestSocketServerProcess({});
238
239 sp<IBinder> outBinder;
240 EXPECT_OK(proc.rootIface->repeatBinder(nullptr, &outBinder));
241 EXPECT_EQ(nullptr, outBinder);
242 }
243
TEST_P(BinderRpc,HoldBinder)244 TEST_P(BinderRpc, HoldBinder) {
245 auto proc = createRpcTestSocketServerProcess({});
246
247 IBinder* ptr = nullptr;
248 {
249 sp<IBinder> binder = new BBinder();
250 ptr = binder.get();
251 EXPECT_OK(proc.rootIface->holdBinder(binder));
252 }
253
254 sp<IBinder> held;
255 EXPECT_OK(proc.rootIface->getHeldBinder(&held));
256
257 EXPECT_EQ(held.get(), ptr);
258
259 // stop holding binder, because we test to make sure references are cleaned
260 // up
261 EXPECT_OK(proc.rootIface->holdBinder(nullptr));
262 // and flush ref counts
263 EXPECT_EQ(OK, proc.rootBinder->pingBinder());
264 }
265
266 // START TESTS FOR LIMITATIONS OF SOCKET BINDER
267 // These are behavioral differences form regular binder, where certain usecases
268 // aren't supported.
269
TEST_P(BinderRpc,CannotMixBindersBetweenUnrelatedSocketSessions)270 TEST_P(BinderRpc, CannotMixBindersBetweenUnrelatedSocketSessions) {
271 if (socketType() == SocketType::TIPC) {
272 GTEST_SKIP() << "Trusty does not support multiple server processes";
273 }
274
275 auto proc1 = createRpcTestSocketServerProcess({});
276 auto proc2 = createRpcTestSocketServerProcess({});
277
278 sp<IBinder> outBinder;
279 EXPECT_EQ(INVALID_OPERATION,
280 proc1.rootIface->repeatBinder(proc2.rootBinder, &outBinder).transactionError());
281 }
282
TEST_P(BinderRpc,CannotMixBindersBetweenTwoSessionsToTheSameServer)283 TEST_P(BinderRpc, CannotMixBindersBetweenTwoSessionsToTheSameServer) {
284 if (serverSingleThreaded()) {
285 GTEST_SKIP() << "This test requires a multi-threaded service";
286 }
287
288 auto proc = createRpcTestSocketServerProcess({.numThreads = 1, .numSessions = 2});
289
290 sp<IBinder> outBinder;
291 EXPECT_EQ(INVALID_OPERATION,
292 proc.rootIface->repeatBinder(proc.proc->sessions.at(1).root, &outBinder)
293 .transactionError());
294 }
295
TEST_P(BinderRpc,CannotSendRegularBinderOverSocketBinder)296 TEST_P(BinderRpc, CannotSendRegularBinderOverSocketBinder) {
297 if (!kEnableKernelIpc || noKernel()) {
298 GTEST_SKIP() << "Test disabled because Binder kernel driver was disabled "
299 "at build time.";
300 }
301
302 auto proc = createRpcTestSocketServerProcess({});
303
304 sp<IBinder> someRealBinder = defaultServiceManager()->getService(String16("activity"));
305 ASSERT_NE(someRealBinder, nullptr);
306 sp<IBinder> outBinder;
307 EXPECT_EQ(INVALID_OPERATION,
308 proc.rootIface->repeatBinder(someRealBinder, &outBinder).transactionError());
309 }
310
TEST_P(BinderRpc,CannotSendSocketBinderOverRegularBinder)311 TEST_P(BinderRpc, CannotSendSocketBinderOverRegularBinder) {
312 if (!kEnableKernelIpc || noKernel()) {
313 GTEST_SKIP() << "Test disabled because Binder kernel driver was disabled "
314 "at build time.";
315 }
316
317 auto proc = createRpcTestSocketServerProcess({});
318
319 // for historical reasons, IServiceManager interface only returns the
320 // exception code
321 EXPECT_EQ(binder::Status::EX_TRANSACTION_FAILED,
322 defaultServiceManager()->addService(String16("not_suspicious"), proc.rootBinder));
323 }
324
325 // END TESTS FOR LIMITATIONS OF SOCKET BINDER
326
327 class TestFrozenStateChangeCallback : public IBinder::FrozenStateChangeCallback {
328 public:
onStateChanged(const wp<IBinder> &,State)329 virtual void onStateChanged(const wp<IBinder>&, State) {}
330 };
331
TEST_P(BinderRpc,RpcBinderShouldFailOnFrozenStateCallbacks)332 TEST_P(BinderRpc, RpcBinderShouldFailOnFrozenStateCallbacks) {
333 auto proc = createRpcTestSocketServerProcess({});
334
335 sp<IBinder> a;
336 sp<TestFrozenStateChangeCallback> callback = sp<TestFrozenStateChangeCallback>::make();
337 EXPECT_OK(proc.rootIface->alwaysGiveMeTheSameBinder(&a));
338 EXPECT_DEATH_IF_SUPPORTED(
339 { std::ignore = a->addFrozenStateChangeCallback(callback); },
340 "addFrozenStateChangeCallback\\(\\) is not supported for RPC Binder.");
341 }
342
TEST_P(BinderRpc,RepeatRootObject)343 TEST_P(BinderRpc, RepeatRootObject) {
344 auto proc = createRpcTestSocketServerProcess({});
345
346 sp<IBinder> outBinder;
347 EXPECT_OK(proc.rootIface->repeatBinder(proc.rootBinder, &outBinder));
348 EXPECT_EQ(proc.rootBinder, outBinder);
349 }
350
TEST_P(BinderRpc,NestedTransactions)351 TEST_P(BinderRpc, NestedTransactions) {
352 auto fileDescriptorTransportMode = RpcSession::FileDescriptorTransportMode::UNIX;
353 if (socketType() == SocketType::TIPC) {
354 // TIPC does not support file descriptors yet
355 fileDescriptorTransportMode = RpcSession::FileDescriptorTransportMode::NONE;
356 }
357 auto proc = createRpcTestSocketServerProcess({
358 // Enable FD support because it uses more stack space and so represents
359 // something closer to a worst case scenario.
360 .clientFileDescriptorTransportMode = fileDescriptorTransportMode,
361 .serverSupportedFileDescriptorTransportModes = {fileDescriptorTransportMode},
362 });
363
364 auto nastyNester = sp<MyBinderRpcTestDefault>::make();
365 EXPECT_OK(proc.rootIface->nestMe(nastyNester, 10));
366
367 wp<IBinder> weak = nastyNester;
368 nastyNester = nullptr;
369 EXPECT_EQ(nullptr, weak.promote());
370 }
371
TEST_P(BinderRpc,SameBinderEquality)372 TEST_P(BinderRpc, SameBinderEquality) {
373 auto proc = createRpcTestSocketServerProcess({});
374
375 sp<IBinder> a;
376 EXPECT_OK(proc.rootIface->alwaysGiveMeTheSameBinder(&a));
377
378 sp<IBinder> b;
379 EXPECT_OK(proc.rootIface->alwaysGiveMeTheSameBinder(&b));
380
381 EXPECT_EQ(a, b);
382 }
383
TEST_P(BinderRpc,SameBinderEqualityWeak)384 TEST_P(BinderRpc, SameBinderEqualityWeak) {
385 auto proc = createRpcTestSocketServerProcess({});
386
387 sp<IBinder> a;
388 EXPECT_OK(proc.rootIface->alwaysGiveMeTheSameBinder(&a));
389 wp<IBinder> weak = a;
390 a = nullptr;
391
392 sp<IBinder> b;
393 EXPECT_OK(proc.rootIface->alwaysGiveMeTheSameBinder(&b));
394
395 // this is the wrong behavior, since BpBinder
396 // doesn't implement onIncStrongAttempted
397 // but make sure there is no crash
398 EXPECT_EQ(nullptr, weak.promote());
399
400 GTEST_SKIP() << "Weak binders aren't currently re-promotable for RPC binder.";
401
402 // In order to fix this:
403 // - need to have incStrongAttempted reflected across IPC boundary (wait for
404 // response to promote - round trip...)
405 // - sendOnLastWeakRef, to delete entries out of RpcState table
406 EXPECT_EQ(b, weak.promote());
407 }
408
409 #define EXPECT_SESSIONS(expected, iface) \
410 do { \
411 int session; \
412 EXPECT_OK((iface)->getNumOpenSessions(&session)); \
413 EXPECT_EQ(static_cast<int>(expected), session); \
414 } while (false)
415
TEST_P(BinderRpc,SingleSession)416 TEST_P(BinderRpc, SingleSession) {
417 auto proc = createRpcTestSocketServerProcess({});
418
419 sp<IBinderRpcSession> session;
420 EXPECT_OK(proc.rootIface->openSession("aoeu", &session));
421 std::string out;
422 EXPECT_OK(session->getName(&out));
423 EXPECT_EQ("aoeu", out);
424
425 EXPECT_SESSIONS(1, proc.rootIface);
426 session = nullptr;
427 EXPECT_SESSIONS(0, proc.rootIface);
428 }
429
TEST_P(BinderRpc,ManySessions)430 TEST_P(BinderRpc, ManySessions) {
431 auto proc = createRpcTestSocketServerProcess({});
432
433 std::vector<sp<IBinderRpcSession>> sessions;
434
435 for (size_t i = 0; i < 15; i++) {
436 EXPECT_SESSIONS(i, proc.rootIface);
437 sp<IBinderRpcSession> session;
438 EXPECT_OK(proc.rootIface->openSession(std::to_string(i), &session));
439 sessions.push_back(session);
440 }
441 EXPECT_SESSIONS(sessions.size(), proc.rootIface);
442 for (size_t i = 0; i < sessions.size(); i++) {
443 std::string out;
444 EXPECT_OK(sessions.at(i)->getName(&out));
445 EXPECT_EQ(std::to_string(i), out);
446 }
447 EXPECT_SESSIONS(sessions.size(), proc.rootIface);
448
449 while (!sessions.empty()) {
450 sessions.pop_back();
451 EXPECT_SESSIONS(sessions.size(), proc.rootIface);
452 }
453 EXPECT_SESSIONS(0, proc.rootIface);
454 }
455
TEST_P(BinderRpc,OnewayCallDoesNotWait)456 TEST_P(BinderRpc, OnewayCallDoesNotWait) {
457 constexpr size_t kReallyLongTimeMs = 100;
458 constexpr size_t kSleepMs = kReallyLongTimeMs * 5;
459
460 auto proc = createRpcTestSocketServerProcess({});
461
462 size_t epochMsBefore = epochMillis();
463
464 EXPECT_OK(proc.rootIface->sleepMsAsync(kSleepMs));
465
466 size_t epochMsAfter = epochMillis();
467 EXPECT_LT(epochMsAfter, epochMsBefore + kReallyLongTimeMs);
468 }
469
TEST_P(BinderRpc,Callbacks)470 TEST_P(BinderRpc, Callbacks) {
471 const static std::string kTestString = "good afternoon!";
472
473 for (bool callIsOneway : {true, false}) {
474 for (bool callbackIsOneway : {true, false}) {
475 for (bool delayed : {true, false}) {
476 if (clientOrServerSingleThreaded() &&
477 (callIsOneway || callbackIsOneway || delayed)) {
478 // we have no incoming connections to receive the callback
479 continue;
480 }
481
482 size_t numIncomingConnections = clientOrServerSingleThreaded() ? 0 : 1;
483 auto proc = createRpcTestSocketServerProcess(
484 {.numThreads = 1,
485 .numSessions = 1,
486 .numIncomingConnectionsBySession = {numIncomingConnections}});
487 auto cb = sp<MyBinderRpcCallback>::make();
488
489 if (callIsOneway) {
490 EXPECT_OK(proc.rootIface->doCallbackAsync(cb, callbackIsOneway, delayed,
491 kTestString));
492 } else {
493 EXPECT_OK(
494 proc.rootIface->doCallback(cb, callbackIsOneway, delayed, kTestString));
495 }
496
497 // if both transactions are synchronous and the response is sent back on the
498 // same thread, everything should have happened in a nested call. Otherwise,
499 // the callback will be processed on another thread.
500 if (callIsOneway || callbackIsOneway || delayed) {
501 using std::literals::chrono_literals::operator""s;
502 RpcMutexUniqueLock _l(cb->mMutex);
503 cb->mCv.wait_for(_l, 1s, [&] { return !cb->mValues.empty(); });
504 }
505
506 EXPECT_EQ(cb->mValues.size(), 1UL)
507 << "callIsOneway: " << callIsOneway
508 << " callbackIsOneway: " << callbackIsOneway << " delayed: " << delayed;
509 if (cb->mValues.empty()) continue;
510 EXPECT_EQ(cb->mValues.at(0), kTestString)
511 << "callIsOneway: " << callIsOneway
512 << " callbackIsOneway: " << callbackIsOneway << " delayed: " << delayed;
513
514 proc.forceShutdown();
515 }
516 }
517 }
518 }
519
TEST_P(BinderRpc,OnewayCallbackWithNoThread)520 TEST_P(BinderRpc, OnewayCallbackWithNoThread) {
521 auto proc = createRpcTestSocketServerProcess({});
522 auto cb = sp<MyBinderRpcCallback>::make();
523
524 Status status = proc.rootIface->doCallback(cb, true /*oneway*/, false /*delayed*/, "anything");
525 EXPECT_EQ(WOULD_BLOCK, status.transactionError());
526 }
527
TEST_P(BinderRpc,AidlDelegatorTest)528 TEST_P(BinderRpc, AidlDelegatorTest) {
529 auto proc = createRpcTestSocketServerProcess({});
530 auto myDelegator = sp<IBinderRpcTestDelegator>::make(proc.rootIface);
531 ASSERT_NE(nullptr, myDelegator);
532
533 std::string doubled;
534 EXPECT_OK(myDelegator->doubleString("cool ", &doubled));
535 EXPECT_EQ("cool cool ", doubled);
536 }
537
538 } // namespace android
539