OLD | NEW |
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" |
11 | 11 |
12 namespace mojo { | 12 namespace mojo { |
13 namespace test { | 13 namespace test { |
14 namespace { | 14 namespace { |
15 | 15 |
16 class ProviderImpl : public InterfaceImpl<sample::Provider> { | 16 class ProviderImpl : public InterfaceImpl<sample::Provider> { |
17 public: | 17 public: |
18 virtual void OnConnectionError() MOJO_OVERRIDE { | |
19 delete this; | |
20 } | |
21 | |
22 virtual void EchoString( | 18 virtual void EchoString( |
23 const String& a, | 19 const String& a, |
24 const Callback<void(String)>& callback) MOJO_OVERRIDE { | 20 const Callback<void(String)>& callback) MOJO_OVERRIDE { |
25 Callback<void(String)> callback_copy; | 21 Callback<void(String)> callback_copy; |
26 // Make sure operator= is used. | 22 // Make sure operator= is used. |
27 callback_copy = callback; | 23 callback_copy = callback; |
28 callback_copy.Run(a); | 24 callback_copy.Run(a); |
29 } | 25 } |
30 | 26 |
31 virtual void EchoStrings( | 27 virtual void EchoStrings( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 provider->EchoEnum(sample::ENUM_VALUE, EnumRecorder(&value)); | 144 provider->EchoEnum(sample::ENUM_VALUE, EnumRecorder(&value)); |
149 | 145 |
150 PumpMessages(); | 146 PumpMessages(); |
151 | 147 |
152 EXPECT_EQ(sample::ENUM_VALUE, value); | 148 EXPECT_EQ(sample::ENUM_VALUE, value); |
153 } | 149 } |
154 | 150 |
155 } // namespace | 151 } // namespace |
156 } // namespace test | 152 } // namespace test |
157 } // namespace mojo | 153 } // namespace mojo |
OLD | NEW |