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

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

Issue 272323003: Mojo: Implement support for |Foo&| mojom syntax (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
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 "mojo/public/cpp/environment/environment.h" 5 #include "mojo/public/cpp/environment/environment.h"
6 #include "mojo/public/cpp/test_support/test_utils.h" 6 #include "mojo/public/cpp/test_support/test_utils.h"
7 #include "mojo/public/cpp/utility/run_loop.h" 7 #include "mojo/public/cpp/utility/run_loop.h"
8 #include "mojo/public/interfaces/bindings/tests/sample_import.mojom.h" 8 #include "mojo/public/interfaces/bindings/tests/sample_import.mojom.h"
9 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h" 9 #include "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 virtual void EchoEnum(sample::Enum a, 44 virtual void EchoEnum(sample::Enum a,
45 const Callback<void(sample::Enum)>& callback) 45 const Callback<void(sample::Enum)>& callback)
46 MOJO_OVERRIDE { 46 MOJO_OVERRIDE {
47 callback.Run(a); 47 callback.Run(a);
48 } 48 }
49 }; 49 };
50 50
51 class StringRecorder { 51 class StringRecorder {
52 public: 52 public:
53 StringRecorder(std::string* buf) : buf_(buf) { 53 explicit StringRecorder(std::string* buf) : buf_(buf) {
54 } 54 }
55 void Run(const String& a) const { 55 void Run(const String& a) const {
56 *buf_ = a; 56 *buf_ = a;
57 } 57 }
58 void Run(const String& a, const String& b) const { 58 void Run(const String& a, const String& b) const {
59 *buf_ = a.get() + b.get(); 59 *buf_ = a.get() + b.get();
60 } 60 }
61 private: 61 private:
62 std::string* buf_; 62 std::string* buf_;
63 }; 63 };
64 64
65 class EnumRecorder { 65 class EnumRecorder {
66 public: 66 public:
67 EnumRecorder(sample::Enum* value) : value_(value) { 67 explicit EnumRecorder(sample::Enum* value) : value_(value) {
68 } 68 }
69 void Run(sample::Enum a) const { 69 void Run(sample::Enum a) const {
70 *value_ = a; 70 *value_ = a;
71 } 71 }
72 private: 72 private:
73 sample::Enum* value_; 73 sample::Enum* value_;
74 }; 74 };
75 75
76 class MessagePipeWriter { 76 class MessagePipeWriter {
77 public: 77 public:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 provider->EchoEnum(sample::ENUM_VALUE, EnumRecorder(&value)); 148 provider->EchoEnum(sample::ENUM_VALUE, EnumRecorder(&value));
149 149
150 PumpMessages(); 150 PumpMessages();
151 151
152 EXPECT_EQ(sample::ENUM_VALUE, value); 152 EXPECT_EQ(sample::ENUM_VALUE, value);
153 } 153 }
154 154
155 } // namespace 155 } // namespace
156 } // namespace test 156 } // namespace test
157 } // namespace mojo 157 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/handle_passing_unittest.cc ('k') | mojo/public/cpp/bindings/tests/sample_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698