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

Side by Side Diff: mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc

Issue 828373008: Allow constructing {Interface,Struct}Ptr from nullptr (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "mojo/public/cpp/bindings/binding.h" 5 #include "mojo/public/cpp/bindings/binding.h"
6 #include "mojo/public/cpp/bindings/error_handler.h" 6 #include "mojo/public/cpp/bindings/error_handler.h"
7 #include "mojo/public/cpp/bindings/strong_binding.h" 7 #include "mojo/public/cpp/bindings/strong_binding.h"
8 #include "mojo/public/cpp/environment/environment.h" 8 #include "mojo/public/cpp/environment/environment.h"
9 #include "mojo/public/cpp/utility/run_loop.h" 9 #include "mojo/public/cpp/utility/run_loop.h"
10 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h" 10 #include "mojo/public/interfaces/bindings/tests/math_calculator.mojom.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 PumpMessages(); 321 PumpMessages();
322 322
323 EXPECT_EQ(0, SelfDestructingMathCalculatorUIImpl::num_instances()); 323 EXPECT_EQ(0, SelfDestructingMathCalculatorUIImpl::num_instances());
324 } 324 }
325 325
326 TEST_F(InterfacePtrTest, ReentrantWaitForIncomingMethodCall) { 326 TEST_F(InterfacePtrTest, ReentrantWaitForIncomingMethodCall) {
327 sample::ServicePtr proxy; 327 sample::ServicePtr proxy;
328 ReentrantServiceImpl* impl = BindToProxy(new ReentrantServiceImpl(), &proxy); 328 ReentrantServiceImpl* impl = BindToProxy(new ReentrantServiceImpl(), &proxy);
329 329
330 proxy->Frobinate(sample::FooPtr(), 330 proxy->Frobinate(nullptr, sample::Service::BAZ_OPTIONS_REGULAR, nullptr);
jamesr 2015/01/13 23:27:05 this is the example use. The first parameter to th
331 sample::Service::BAZ_OPTIONS_REGULAR, 331 proxy->Frobinate(nullptr, sample::Service::BAZ_OPTIONS_REGULAR, nullptr);
332 sample::PortPtr());
333 proxy->Frobinate(sample::FooPtr(),
334 sample::Service::BAZ_OPTIONS_REGULAR,
335 sample::PortPtr());
336 332
337 PumpMessages(); 333 PumpMessages();
338 334
339 EXPECT_EQ(2, impl->max_call_depth()); 335 EXPECT_EQ(2, impl->max_call_depth());
340 } 336 }
341 337
342 class StrongMathCalculatorImpl : public math::Calculator, public ErrorHandler { 338 class StrongMathCalculatorImpl : public math::Calculator, public ErrorHandler {
343 public: 339 public:
344 StrongMathCalculatorImpl(ScopedMessagePipeHandle handle, 340 StrongMathCalculatorImpl(ScopedMessagePipeHandle handle,
345 bool* error_received, 341 bool* error_received,
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 } 473 }
478 474
479 loop.RunUntilIdle(); 475 loop.RunUntilIdle();
480 EXPECT_TRUE(error_received); 476 EXPECT_TRUE(error_received);
481 EXPECT_FALSE(destroyed); 477 EXPECT_FALSE(destroyed);
482 } 478 }
483 479
484 } // namespace 480 } // namespace
485 } // namespace test 481 } // namespace test
486 } // namespace mojo 482 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698