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

Side by Side Diff: dbus/end_to_end_async_unittest.cc

Issue 1179163002: Migrate callers of message_loop_proxy() to task_runner() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 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
« no previous file with comments | « dbus/bus_unittest.cc ('k') | dbus/object_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 29 matching lines...) Expand all
40 base::ThreadRestrictions::SetIOAllowed(false); 40 base::ThreadRestrictions::SetIOAllowed(false);
41 41
42 // Start the D-Bus thread. 42 // Start the D-Bus thread.
43 dbus_thread_.reset(new base::Thread("D-Bus Thread")); 43 dbus_thread_.reset(new base::Thread("D-Bus Thread"));
44 base::Thread::Options thread_options; 44 base::Thread::Options thread_options;
45 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; 45 thread_options.message_loop_type = base::MessageLoop::TYPE_IO;
46 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options)); 46 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options));
47 47
48 // Start the test service, using the D-Bus thread. 48 // Start the test service, using the D-Bus thread.
49 TestService::Options options; 49 TestService::Options options;
50 options.dbus_task_runner = dbus_thread_->message_loop_proxy(); 50 options.dbus_task_runner = dbus_thread_->task_runner();
51 test_service_.reset(new TestService(options)); 51 test_service_.reset(new TestService(options));
52 ASSERT_TRUE(test_service_->StartService()); 52 ASSERT_TRUE(test_service_->StartService());
53 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); 53 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted());
54 ASSERT_TRUE(test_service_->HasDBusThread()); 54 ASSERT_TRUE(test_service_->HasDBusThread());
55 55
56 // Create the client, using the D-Bus thread. 56 // Create the client, using the D-Bus thread.
57 Bus::Options bus_options; 57 Bus::Options bus_options;
58 bus_options.bus_type = Bus::SESSION; 58 bus_options.bus_type = Bus::SESSION;
59 bus_options.connection_type = Bus::PRIVATE; 59 bus_options.connection_type = Bus::PRIVATE;
60 bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); 60 bus_options.dbus_task_runner = dbus_thread_->task_runner();
61 bus_ = new Bus(bus_options); 61 bus_ = new Bus(bus_options);
62 object_proxy_ = bus_->GetObjectProxy( 62 object_proxy_ = bus_->GetObjectProxy(
63 "org.chromium.TestService", 63 "org.chromium.TestService",
64 ObjectPath("/org/chromium/TestObject")); 64 ObjectPath("/org/chromium/TestObject"));
65 ASSERT_TRUE(bus_->HasDBusThread()); 65 ASSERT_TRUE(bus_->HasDBusThread());
66 66
67 // Connect to the "Test" signal of "org.chromium.TestInterface" from 67 // Connect to the "Test" signal of "org.chromium.TestInterface" from
68 // the remote object. 68 // the remote object.
69 object_proxy_->ConnectToSignal( 69 object_proxy_->ConnectToSignal(
70 "org.chromium.TestInterface", 70 "org.chromium.TestInterface",
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 void SetUpBrokenBus() { 131 void SetUpBrokenBus() {
132 // Shut down the existing bus. 132 // Shut down the existing bus.
133 bus_->ShutdownOnDBusThreadAndBlock(); 133 bus_->ShutdownOnDBusThreadAndBlock();
134 134
135 // Create new bus with invalid address. 135 // Create new bus with invalid address.
136 const char kInvalidAddress[] = ""; 136 const char kInvalidAddress[] = "";
137 Bus::Options bus_options; 137 Bus::Options bus_options;
138 bus_options.bus_type = Bus::CUSTOM_ADDRESS; 138 bus_options.bus_type = Bus::CUSTOM_ADDRESS;
139 bus_options.address = kInvalidAddress; 139 bus_options.address = kInvalidAddress;
140 bus_options.connection_type = Bus::PRIVATE; 140 bus_options.connection_type = Bus::PRIVATE;
141 bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); 141 bus_options.dbus_task_runner = dbus_thread_->task_runner();
142 bus_ = new Bus(bus_options); 142 bus_ = new Bus(bus_options);
143 ASSERT_TRUE(bus_->HasDBusThread()); 143 ASSERT_TRUE(bus_->HasDBusThread());
144 144
145 // Create new object proxy. 145 // Create new object proxy.
146 object_proxy_ = bus_->GetObjectProxy( 146 object_proxy_ = bus_->GetObjectProxy(
147 "org.chromium.TestService", 147 "org.chromium.TestService",
148 ObjectPath("/org/chromium/TestObject")); 148 ObjectPath("/org/chromium/TestObject"));
149 } 149 }
150 150
151 // Calls the method asynchronously. OnResponse() will be called once the 151 // Calls the method asynchronously. OnResponse() will be called once the
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 test_service_->SendTestSignal(kMessage); 655 test_service_->SendTestSignal(kMessage);
656 // Receive the signal with the object proxy. 656 // Receive the signal with the object proxy.
657 WaitForTestSignal(); 657 WaitForTestSignal();
658 // Verify the string WAS received by the original handler. 658 // Verify the string WAS received by the original handler.
659 ASSERT_EQ(kMessage, test_signal_string_); 659 ASSERT_EQ(kMessage, test_signal_string_);
660 // Verify the signal WAS ALSO received by the additional handler. 660 // Verify the signal WAS ALSO received by the additional handler.
661 ASSERT_EQ(kMessage, additional_test_signal_string_); 661 ASSERT_EQ(kMessage, additional_test_signal_string_);
662 } 662 }
663 663
664 } // namespace dbus 664 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/bus_unittest.cc ('k') | dbus/object_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698