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 {
options.dbus_task_runner = dbus_thread_->task_runner();
test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted());
test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread());
// Create the client, using the D-Bus thread.
......
......@@ -26,7 +26,7 @@ class EndToEndSyncTest : public testing::Test {
TestService::Options options;
test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted());
test_service_->WaitUntilServiceIsStarted();
ASSERT_FALSE(test_service_->HasDBusThread());
// Create the client.
......
......@@ -76,7 +76,7 @@ class ObjectManagerTest
options.dbus_task_runner = dbus_thread_->task_runner();
test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted());
test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread());
// Create the client, using the D-Bus thread.
......
......@@ -68,7 +68,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableRunOnce) {
// Start the service. The callback should be called asynchronously.
ASSERT_TRUE(test_service.StartService());
ASSERT_TRUE(test_service.WaitUntilServiceIsStarted());
test_service.WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service.has_ownership());
num_calls = 0;
base::RunLoop().RunUntilIdle();
......@@ -96,7 +96,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableAlreadyRunning) {
test_service.service_name(), ObjectPath("/org/chromium/TestObject"));
ASSERT_TRUE(test_service.StartService());
ASSERT_TRUE(test_service.WaitUntilServiceIsStarted());
test_service.WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service.has_ownership());
// Since the service is already running, the callback should be invoked
......@@ -132,7 +132,7 @@ TEST_F(ObjectProxyTest, WaitForServiceToBeAvailableMultipleCallbacks) {
// Start the service and confirm that both callbacks are invoked.
ASSERT_TRUE(test_service.StartService());
ASSERT_TRUE(test_service.WaitUntilServiceIsStarted());
test_service.WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service.has_ownership());
num_calls_1 = 0;
num_calls_2 = 0;
......
......@@ -68,7 +68,7 @@ class PropertyTest : public testing::Test {
options.dbus_task_runner = dbus_thread_->task_runner();
test_service_.reset(new TestService(options));
ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted());
test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread());
// Create the client, using the D-Bus thread.
......
......@@ -75,7 +75,7 @@ class SignalSenderVerificationTest : public testing::Test {
// Start the test service.
ASSERT_TRUE(test_service_->StartService());
ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted());
test_service_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service_->HasDBusThread());
ASSERT_TRUE(test_service_->has_ownership());
......@@ -84,7 +84,7 @@ class SignalSenderVerificationTest : public testing::Test {
options.service_name = test_service_->service_name();
test_service2_.reset(new TestService(options));
ASSERT_TRUE(test_service2_->StartService());
ASSERT_TRUE(test_service2_->WaitUntilServiceIsStarted());
test_service2_->WaitUntilServiceIsStarted();
ASSERT_TRUE(test_service2_->HasDBusThread());
ASSERT_FALSE(test_service2_->has_ownership());
......@@ -275,7 +275,7 @@ TEST_F(SignalSenderVerificationTest, DISABLED_TestOwnerStealing) {
options.service_name = test_service_->service_name();
TestService stealable_test_service(options);
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.has_ownership());
......
......@@ -23,6 +23,6 @@ int main(int argc, char** argv) {
options.dbus_task_runner = dbus_thread.task_runner();
dbus::TestService* test_service = new dbus::TestService(options);
CHECK(test_service->StartService());
CHECK(test_service->WaitUntilServiceIsStarted());
test_service->WaitUntilServiceIsStarted();
CHECK(test_service->HasDBusThread());
}
......@@ -63,10 +63,9 @@ bool TestService::StartService() {
return StartWithOptions(thread_options);
}
bool TestService::WaitUntilServiceIsStarted() {
const base::TimeDelta timeout(TestTimeouts::action_max_timeout());
void TestService::WaitUntilServiceIsStarted() {
// Wait until the ownership of the service name is obtained.
return on_name_obtained_.TimedWait(timeout);
on_name_obtained_.Wait();
}
void TestService::ShutdownAndBlock() {
......
......@@ -56,8 +56,7 @@ class TestService : public base::Thread {
bool StartService();
// Waits until the service is started (i.e. all methods are exported).
// Returns true on success.
bool WaitUntilServiceIsStarted() WARN_UNUSED_RESULT;
void WaitUntilServiceIsStarted();
// Shuts down the service and blocks until it's done.
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