| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 "org.chromium.TestInterface", | 42 "org.chromium.TestInterface", |
| 43 property_changed_callback) { | 43 property_changed_callback) { |
| 44 RegisterProperty("Name", &name); | 44 RegisterProperty("Name", &name); |
| 45 RegisterProperty("Version", &version); | 45 RegisterProperty("Version", &version); |
| 46 RegisterProperty("Methods", &methods); | 46 RegisterProperty("Methods", &methods); |
| 47 RegisterProperty("Objects", &objects); | 47 RegisterProperty("Objects", &objects); |
| 48 RegisterProperty("Bytes", &bytes); | 48 RegisterProperty("Bytes", &bytes); |
| 49 } | 49 } |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 virtual void SetUp() { | 52 void SetUp() override { |
| 53 // Make the main thread not to allow IO. | 53 // Make the main thread not to allow IO. |
| 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. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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, |
| 85 base::Unretained(this)))); | 85 base::Unretained(this)))); |
| 86 properties_->ConnectSignals(); | 86 properties_->ConnectSignals(); |
| 87 properties_->GetAll(); | 87 properties_->GetAll(); |
| 88 } | 88 } |
| 89 | 89 |
| 90 virtual void TearDown() { | 90 void TearDown() override { |
| 91 bus_->ShutdownOnDBusThreadAndBlock(); | 91 bus_->ShutdownOnDBusThreadAndBlock(); |
| 92 | 92 |
| 93 // Shut down the service. | 93 // Shut down the service. |
| 94 test_service_->ShutdownAndBlock(); | 94 test_service_->ShutdownAndBlock(); |
| 95 | 95 |
| 96 // Reset to the default. | 96 // Reset to the default. |
| 97 base::ThreadRestrictions::SetIOAllowed(true); | 97 base::ThreadRestrictions::SetIOAllowed(true); |
| 98 | 98 |
| 99 // Stopping a thread is considered an IO operation, so do this after | 99 // Stopping a thread is considered an IO operation, so do this after |
| 100 // allowing IO. | 100 // allowing IO. |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 "Set")); | 271 "Set")); |
| 272 WaitForCallback("Set"); | 272 WaitForCallback("Set"); |
| 273 | 273 |
| 274 // TestService sends a property update. | 274 // TestService sends a property update. |
| 275 WaitForUpdates(1); | 275 WaitForUpdates(1); |
| 276 | 276 |
| 277 EXPECT_EQ("NewService", properties_->name.value()); | 277 EXPECT_EQ("NewService", properties_->name.value()); |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace dbus | 280 } // namespace dbus |
| OLD | NEW |