OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> |
8 #include <string> | 9 #include <string> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/test/test_timeouts.h" | 17 #include "base/test/test_timeouts.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "base/threading/thread_restrictions.h" | 19 #include "base/threading/thread_restrictions.h" |
20 #include "dbus/bus.h" | 20 #include "dbus/bus.h" |
21 #include "dbus/message.h" | 21 #include "dbus/message.h" |
22 #include "dbus/object_path.h" | 22 #include "dbus/object_path.h" |
23 #include "dbus/object_proxy.h" | 23 #include "dbus/object_proxy.h" |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 248 } |
249 | 249 |
250 // Wait for the hey signal to be received. | 250 // Wait for the hey signal to be received. |
251 void WaitForTestSignal() { | 251 void WaitForTestSignal() { |
252 // OnTestSignal() will quit the message loop. | 252 // OnTestSignal() will quit the message loop. |
253 run_loop_.reset(new base::RunLoop); | 253 run_loop_.reset(new base::RunLoop); |
254 run_loop_->Run(); | 254 run_loop_->Run(); |
255 } | 255 } |
256 | 256 |
257 base::MessageLoop message_loop_; | 257 base::MessageLoop message_loop_; |
258 scoped_ptr<base::RunLoop> run_loop_; | 258 std::unique_ptr<base::RunLoop> run_loop_; |
259 std::vector<std::string> response_strings_; | 259 std::vector<std::string> response_strings_; |
260 std::vector<std::string> error_names_; | 260 std::vector<std::string> error_names_; |
261 scoped_ptr<base::Thread> dbus_thread_; | 261 std::unique_ptr<base::Thread> dbus_thread_; |
262 scoped_refptr<Bus> bus_; | 262 scoped_refptr<Bus> bus_; |
263 ObjectProxy* object_proxy_; | 263 ObjectProxy* object_proxy_; |
264 ObjectProxy* root_object_proxy_; | 264 ObjectProxy* root_object_proxy_; |
265 scoped_ptr<TestService> test_service_; | 265 std::unique_ptr<TestService> test_service_; |
266 // Text message from "Test" signal. | 266 // Text message from "Test" signal. |
267 std::string test_signal_string_; | 267 std::string test_signal_string_; |
268 // Text message from "Test" signal delivered to root. | 268 // Text message from "Test" signal delivered to root. |
269 std::string root_test_signal_string_; | 269 std::string root_test_signal_string_; |
270 }; | 270 }; |
271 | 271 |
272 TEST_F(EndToEndAsyncTest, Echo) { | 272 TEST_F(EndToEndAsyncTest, Echo) { |
273 const char* kHello = "hello"; | 273 const char* kHello = "hello"; |
274 | 274 |
275 // Create the method call. | 275 // Create the method call. |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 test_service_->SendTestSignal(kMessage); | 658 test_service_->SendTestSignal(kMessage); |
659 // Receive the signal with the object proxy. | 659 // Receive the signal with the object proxy. |
660 WaitForTestSignal(); | 660 WaitForTestSignal(); |
661 // Verify the string WAS received by the original handler. | 661 // Verify the string WAS received by the original handler. |
662 ASSERT_EQ(kMessage, test_signal_string_); | 662 ASSERT_EQ(kMessage, test_signal_string_); |
663 // Verify the signal WAS ALSO received by the additional handler. | 663 // Verify the signal WAS ALSO received by the additional handler. |
664 ASSERT_EQ(kMessage, additional_test_signal_string_); | 664 ASSERT_EQ(kMessage, additional_test_signal_string_); |
665 } | 665 } |
666 | 666 |
667 } // namespace dbus | 667 } // namespace dbus |
OLD | NEW |