Commit 3bbeb5c8 authored by Ryo Hashimoto's avatar Ryo Hashimoto Committed by Commit Bot

dbus: Stop timing out in TestService::WaitUntilServiceIsStarted()

Removing the timeout to have one less sources of flakiness.

BUG=872732
TEST=dbus_unittests

Change-Id: I7ca390a19a77686df268332850e3951e6d13d3d1
Reviewed-on: https://chromium-review.googlesource.com/1170719
Commit-Queue: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: default avatarSatoru Takabayashi <satorux@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582506}
parent b3af3b31
...@@ -55,7 +55,7 @@ class EndToEndAsyncTest : public testing::Test { ...@@ -55,7 +55,7 @@ class EndToEndAsyncTest : public testing::Test {
options.dbus_task_runner = dbus_thread_->task_runner(); options.dbus_task_runner = dbus_thread_->task_runner();
test_service_.reset(new TestService(options)); test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService()); ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread()); ASSERT_TRUE(test_service_->HasDBusThread());
// Create the client, using the D-Bus thread. // Create the client, using the D-Bus thread.
......
...@@ -26,7 +26,7 @@ class EndToEndSyncTest : public testing::Test { ...@@ -26,7 +26,7 @@ class EndToEndSyncTest : public testing::Test {
TestService::Options options; TestService::Options options;
test_service_.reset(new TestService(options)); test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService()); ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); test_service_->WaitUntilServiceIsStarted();
ASSERT_FALSE(test_service_->HasDBusThread()); ASSERT_FALSE(test_service_->HasDBusThread());
// Create the client. // Create the client.
......
...@@ -76,7 +76,7 @@ class ObjectManagerTest ...@@ -76,7 +76,7 @@ class ObjectManagerTest
options.dbus_task_runner = dbus_thread_->task_runner(); options.dbus_task_runner = dbus_thread_->task_runner();
test_service_.reset(new TestService(options)); test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService()); ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread()); ASSERT_TRUE(test_service_->HasDBusThread());
// Create the client, using the D-Bus thread. // Create the client, using the D-Bus thread.
......
...@@ -68,7 +68,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableRunOnce) { ...@@ -68,7 +68,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableRunOnce) {
// Start the service. The callback should be called asynchronously. // Start the service. The callback should be called asynchronously.
ASSERT_TRUE(test_service.StartService()); ASSERT_TRUE(test_service.StartService());
ASSERT_TRUE(test_service.WaitUntilServiceIsStarted()); test_service.WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service.has_ownership()); ASSERT_TRUE(test_service.has_ownership());
num_calls = 0; num_calls = 0;
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
...@@ -96,7 +96,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableAlreadyRunning) { ...@@ -96,7 +96,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableAlreadyRunning) {
test_service.service_name(), ObjectPath("/org/chromium/TestObject")); test_service.service_name(), ObjectPath("/org/chromium/TestObject"));
ASSERT_TRUE(test_service.StartService()); ASSERT_TRUE(test_service.StartService());
ASSERT_TRUE(test_service.WaitUntilServiceIsStarted()); test_service.WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service.has_ownership()); ASSERT_TRUE(test_service.has_ownership());
// Since the service is already running, the callback should be invoked // Since the service is already running, the callback should be invoked
...@@ -132,7 +132,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableMultipleCallbacks) { ...@@ -132,7 +132,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableMultipleCallbacks) {
// Start the service and confirm that both callbacks are invoked. // Start the service and confirm that both callbacks are invoked.
ASSERT_TRUE(test_service.StartService()); ASSERT_TRUE(test_service.StartService());
ASSERT_TRUE(test_service.WaitUntilServiceIsStarted()); test_service.WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service.has_ownership()); ASSERT_TRUE(test_service.has_ownership());
num_calls_1 = 0; num_calls_1 = 0;
num_calls_2 = 0; num_calls_2 = 0;
......
...@@ -68,7 +68,7 @@ class PropertyTest : public testing::Test { ...@@ -68,7 +68,7 @@ class PropertyTest : public testing::Test {
options.dbus_task_runner = dbus_thread_->task_runner(); options.dbus_task_runner = dbus_thread_->task_runner();
test_service_.reset(new TestService(options)); test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService()); ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread()); ASSERT_TRUE(test_service_->HasDBusThread());
// Create the client, using the D-Bus thread. // Create the client, using the D-Bus thread.
......
...@@ -75,7 +75,7 @@ class SignalSenderVerificationTest : public testing::Test { ...@@ -75,7 +75,7 @@ class SignalSenderVerificationTest : public testing::Test {
// Start the test service. // Start the test service.
ASSERT_TRUE(test_service_->StartService()); ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread()); ASSERT_TRUE(test_service_->HasDBusThread());
ASSERT_TRUE(test_service_->has_ownership()); ASSERT_TRUE(test_service_->has_ownership());
...@@ -84,7 +84,7 @@ class SignalSenderVerificationTest : public testing::Test { ...@@ -84,7 +84,7 @@ class SignalSenderVerificationTest : public testing::Test {
options.service_name = test_service_->service_name(); options.service_name = test_service_->service_name();
test_service2_.reset(new TestService(options)); test_service2_.reset(new TestService(options));
ASSERT_TRUE(test_service2_->StartService()); ASSERT_TRUE(test_service2_->StartService());
ASSERT_TRUE(test_service2_->WaitUntilServiceIsStarted()); test_service2_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service2_->HasDBusThread()); ASSERT_TRUE(test_service2_->HasDBusThread());
ASSERT_FALSE(test_service2_->has_ownership()); ASSERT_FALSE(test_service2_->has_ownership());
...@@ -275,7 +275,7 @@ TEST_F(SignalSenderVerificationTest, DISABLED_TestOwnerStealing) { ...@@ -275,7 +275,7 @@ TEST_F(SignalSenderVerificationTest, DISABLED_TestOwnerStealing) {
options.service_name = test_service_->service_name(); options.service_name = test_service_->service_name();
TestService stealable_test_service(options); TestService stealable_test_service(options);
ASSERT_TRUE(stealable_test_service.StartService()); ASSERT_TRUE(stealable_test_service.StartService());
ASSERT_TRUE(stealable_test_service.WaitUntilServiceIsStarted()); stealable_test_service.WaitUntilServiceIsStarted();
ASSERT_TRUE(stealable_test_service.HasDBusThread()); ASSERT_TRUE(stealable_test_service.HasDBusThread());
ASSERT_TRUE(stealable_test_service.has_ownership()); ASSERT_TRUE(stealable_test_service.has_ownership());
......
...@@ -23,6 +23,6 @@ int main(int argc, char** argv) { ...@@ -23,6 +23,6 @@ int main(int argc, char** argv) {
options.dbus_task_runner = dbus_thread.task_runner(); options.dbus_task_runner = dbus_thread.task_runner();
dbus::TestService* test_service = new dbus::TestService(options); dbus::TestService* test_service = new dbus::TestService(options);
CHECK(test_service->StartService()); CHECK(test_service->StartService());
CHECK(test_service->WaitUntilServiceIsStarted()); test_service->WaitUntilServiceIsStarted();
CHECK(test_service->HasDBusThread()); CHECK(test_service->HasDBusThread());
} }
...@@ -63,10 +63,9 @@ bool TestService::StartService() { ...@@ -63,10 +63,9 @@ bool TestService::StartService() {
return StartWithOptions(thread_options); return StartWithOptions(thread_options);
} }
bool TestService::WaitUntilServiceIsStarted() { void TestService::WaitUntilServiceIsStarted() {
const base::TimeDelta timeout(TestTimeouts::action_max_timeout());
// Wait until the ownership of the service name is obtained. // Wait until the ownership of the service name is obtained.
return on_name_obtained_.TimedWait(timeout); on_name_obtained_.Wait();
} }
void TestService::ShutdownAndBlock() { void TestService::ShutdownAndBlock() {
......
...@@ -56,8 +56,7 @@ class TestService : public base::Thread { ...@@ -56,8 +56,7 @@ class TestService : public base::Thread {
bool StartService(); bool StartService();
// Waits until the service is started (i.e. all methods are exported). // Waits until the service is started (i.e. all methods are exported).
// Returns true on success. void WaitUntilServiceIsStarted();
bool WaitUntilServiceIsStarted() WARN_UNUSED_RESULT;
// Shuts down the service and blocks until it's done. // Shuts down the service and blocks until it's done.
void ShutdownAndBlock(); void ShutdownAndBlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment