diff options
author | hashimoto <hashimoto@chromium.org> | 2016-01-05 00:48:03 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-05 08:48:48 +0000 |
commit | 067d84f52f2ec47c2614108be6bf0e11552eb34b (patch) | |
tree | 7fd36c6d049284af5bcf59c5dbaf7246f28ca18f /dbus/object_proxy_unittest.cc | |
parent | b2eed16e7e44ed1f57d249b5525def01dd5518fd (diff) | |
download | chromium_src-067d84f52f2ec47c2614108be6bf0e11552eb34b.zip chromium_src-067d84f52f2ec47c2614108be6bf0e11552eb34b.tar.gz chromium_src-067d84f52f2ec47c2614108be6bf0e11552eb34b.tar.bz2 |
dbus: Use randomly generated string as a TestService's service name
To run tests parallelly.
BUG=571274
TEST=dbus_unittests
Review URL: https://codereview.chromium.org/1559873005
Cr-Commit-Position: refs/heads/master@{#367499}
Diffstat (limited to 'dbus/object_proxy_unittest.cc')
-rw-r--r-- | dbus/object_proxy_unittest.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/dbus/object_proxy_unittest.cc b/dbus/object_proxy_unittest.cc index 22130b6..05c1294 100644 --- a/dbus/object_proxy_unittest.cc +++ b/dbus/object_proxy_unittest.cc @@ -20,16 +20,12 @@ class ObjectProxyTest : public testing::Test { bus_options.bus_type = Bus::SESSION; bus_options.connection_type = Bus::PRIVATE; bus_ = new Bus(bus_options); - - object_proxy_ = bus_->GetObjectProxy( - "org.chromium.TestService", ObjectPath("/org/chromium/TestObject")); } void TearDown() override { bus_->ShutdownAndBlock(); } base::MessageLoopForIO message_loop_; scoped_refptr<Bus> bus_; - ObjectProxy* object_proxy_; }; // Used as a WaitForServiceToBeAvailableCallback. @@ -43,14 +39,17 @@ void OnServiceIsAvailable(scoped_ptr<base::RunLoop>* run_loop, TEST_F(ObjectProxyTest, WaitForServiceToBeAvailable) { scoped_ptr<base::RunLoop> run_loop; + TestService::Options options; + TestService test_service(options); + // Callback is not yet called because the service is not available. - object_proxy_->WaitForServiceToBeAvailable( + ObjectProxy* object_proxy = bus_->GetObjectProxy( + test_service.service_name(), ObjectPath("/org/chromium/TestObject")); + object_proxy->WaitForServiceToBeAvailable( base::Bind(&OnServiceIsAvailable, &run_loop)); base::RunLoop().RunUntilIdle(); // Start the service. - TestService::Options options; - TestService test_service(options); ASSERT_TRUE(test_service.StartService()); ASSERT_TRUE(test_service.WaitUntilServiceIsStarted()); ASSERT_TRUE(test_service.has_ownership()); @@ -61,7 +60,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailable) { // Callback is called because the service is already available. run_loop.reset(new base::RunLoop); - object_proxy_->WaitForServiceToBeAvailable( + object_proxy->WaitForServiceToBeAvailable( base::Bind(&OnServiceIsAvailable, &run_loop)); run_loop->Run(); |