| 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 "dbus/property.h" | 5 #include "dbus/property.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 base::ThreadRestrictions::SetIOAllowed(false); | 54 base::ThreadRestrictions::SetIOAllowed(false); |
| 55 | 55 |
| 56 // Start the D-Bus thread. | 56 // Start the D-Bus thread. |
| 57 dbus_thread_.reset(new base::Thread("D-Bus Thread")); | 57 dbus_thread_.reset(new base::Thread("D-Bus Thread")); |
| 58 base::Thread::Options thread_options; | 58 base::Thread::Options thread_options; |
| 59 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; | 59 thread_options.message_loop_type = base::MessageLoop::TYPE_IO; |
| 60 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options)); | 60 ASSERT_TRUE(dbus_thread_->StartWithOptions(thread_options)); |
| 61 | 61 |
| 62 // Start the test service, using the D-Bus thread. | 62 // Start the test service, using the D-Bus thread. |
| 63 TestService::Options options; | 63 TestService::Options options; |
| 64 options.dbus_task_runner = dbus_thread_->message_loop_proxy(); | 64 options.dbus_task_runner = dbus_thread_->task_runner(); |
| 65 test_service_.reset(new TestService(options)); | 65 test_service_.reset(new TestService(options)); |
| 66 ASSERT_TRUE(test_service_->StartService()); | 66 ASSERT_TRUE(test_service_->StartService()); |
| 67 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); | 67 ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); |
| 68 ASSERT_TRUE(test_service_->HasDBusThread()); | 68 ASSERT_TRUE(test_service_->HasDBusThread()); |
| 69 | 69 |
| 70 // Create the client, using the D-Bus thread. | 70 // Create the client, using the D-Bus thread. |
| 71 Bus::Options bus_options; | 71 Bus::Options bus_options; |
| 72 bus_options.bus_type = Bus::SESSION; | 72 bus_options.bus_type = Bus::SESSION; |
| 73 bus_options.connection_type = Bus::PRIVATE; | 73 bus_options.connection_type = Bus::PRIVATE; |
| 74 bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); | 74 bus_options.dbus_task_runner = dbus_thread_->task_runner(); |
| 75 bus_ = new Bus(bus_options); | 75 bus_ = new Bus(bus_options); |
| 76 object_proxy_ = bus_->GetObjectProxy( | 76 object_proxy_ = bus_->GetObjectProxy( |
| 77 "org.chromium.TestService", | 77 "org.chromium.TestService", |
| 78 ObjectPath("/org/chromium/TestObject")); | 78 ObjectPath("/org/chromium/TestObject")); |
| 79 ASSERT_TRUE(bus_->HasDBusThread()); | 79 ASSERT_TRUE(bus_->HasDBusThread()); |
| 80 | 80 |
| 81 // Create the properties structure | 81 // Create the properties structure |
| 82 properties_.reset(new Properties( | 82 properties_.reset(new Properties( |
| 83 object_proxy_, | 83 object_proxy_, |
| 84 base::Bind(&PropertyTest::OnPropertyChanged, | 84 base::Bind(&PropertyTest::OnPropertyChanged, |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 Property<std::vector<std::pair<std::vector<uint8>, uint16>>> ip_list; | 422 Property<std::vector<std::pair<std::vector<uint8>, uint16>>> ip_list; |
| 423 ip_list.ReplaceSetValueForTesting(test_list); | 423 ip_list.ReplaceSetValueForTesting(test_list); |
| 424 ip_list.AppendSetValueToWriter(&writer); | 424 ip_list.AppendSetValueToWriter(&writer); |
| 425 | 425 |
| 426 MessageReader reader(message.get()); | 426 MessageReader reader(message.get()); |
| 427 EXPECT_TRUE(ip_list.PopValueFromReader(&reader)); | 427 EXPECT_TRUE(ip_list.PopValueFromReader(&reader)); |
| 428 EXPECT_EQ(test_list, ip_list.value()); | 428 EXPECT_EQ(test_list, ip_list.value()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 } // namespace dbus | 431 } // namespace dbus |
| OLD | NEW |