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

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

Issue 2515873003: Mojo C++ Bindings: Introduce mojo::SupportsStrongBinding
Patch Set: . Created 4 years, 1 month 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 <stdint.h> 5 #include <stdint.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "mojo/public/cpp/bindings/binding.h" 10 #include "mojo/public/cpp/bindings/binding.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 static int do_something_count() { return do_something_count_; } 48 static int do_something_count() { return do_something_count_; }
49 49
50 private: 50 private:
51 static int do_something_count_; 51 static int do_something_count_;
52 Binding<ImportedInterface> binding_; 52 Binding<ImportedInterface> binding_;
53 base::Closure closure_; 53 base::Closure closure_;
54 }; 54 };
55 int ImportedInterfaceImpl::do_something_count_ = 0; 55 int ImportedInterfaceImpl::do_something_count_ = 0;
56 56
57 class SampleNamedObjectImpl : public sample::NamedObject { 57 class SampleNamedObjectImpl
58 : public SupportsStrongBinding<sample::NamedObject> {
58 public: 59 public:
59 SampleNamedObjectImpl() {} 60 SampleNamedObjectImpl() {}
60 61
61 void SetName(const std::string& name) override { name_ = name; } 62 void SetName(const std::string& name) override { name_ = name; }
62 63
63 void GetName(const GetNameCallback& callback) override { 64 void GetName(const GetNameCallback& callback) override {
64 callback.Run(name_); 65 callback.Run(name_);
65 } 66 }
66 67
67 private: 68 private:
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 run_loop.Run(); 350 run_loop.Run();
350 run_loop2.Run(); 351 run_loop2.Run();
351 352
352 EXPECT_EQ(std::string("object1"), name1); 353 EXPECT_EQ(std::string("object1"), name1);
353 EXPECT_EQ(std::string("object2"), name2); 354 EXPECT_EQ(std::string("object2"), name2);
354 } 355 }
355 356
356 } // namespace 357 } // namespace
357 } // namespace test 358 } // namespace test
358 } // namespace mojo 359 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698