diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-20 01:07:17 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-20 01:07:17 +0000 |
commit | 12f9766f28712f8ec3755db4558dba4db5bd8a70 (patch) | |
tree | 6ab911b0b85b1851bef201f25825911d4a66849e /dbus/end_to_end_sync_unittest.cc | |
parent | 940895b5308ace929396a87bd13cf0764f0c16e2 (diff) | |
download | chromium_src-12f9766f28712f8ec3755db4558dba4db5bd8a70.zip chromium_src-12f9766f28712f8ec3755db4558dba4db5bd8a70.tar.gz chromium_src-12f9766f28712f8ec3755db4558dba4db5bd8a70.tar.bz2 |
Rework TestService using asynchronos API of ExportedObject.
This change is to to exercise asynchronos API of ExportedObject.
The asynchronos API is implemented on top the synchronos API,
hence the synchronos API code is also covered.
Along the way, change EndToEndAsyncTest to use the D-Bus thread.
Simplified the test code per phajdan.jr's comments as well.
TEST=dbus_unittests
BUG=90036
Review URL: http://codereview.chromium.org/7671028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97540 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/end_to_end_sync_unittest.cc')
-rw-r--r-- | dbus/end_to_end_sync_unittest.cc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/dbus/end_to_end_sync_unittest.cc b/dbus/end_to_end_sync_unittest.cc index 2f81878..704845e 100644 --- a/dbus/end_to_end_sync_unittest.cc +++ b/dbus/end_to_end_sync_unittest.cc @@ -20,9 +20,11 @@ class EndToEndSyncTest : public testing::Test { void SetUp() { // Start the test service; - test_service_.reset(new dbus::TestService); - test_service_->StartService(); - test_service_->WaitUntilServiceIsStarted(); + dbus::TestService::Options options; + test_service_.reset(new dbus::TestService(options)); + ASSERT_TRUE(test_service_->StartService()); + ASSERT_TRUE(test_service_->WaitUntilServiceIsStarted()); + ASSERT_FALSE(test_service_->HasDBusThread()); // Create the client. dbus::Bus::Options client_bus_options; @@ -31,9 +33,12 @@ class EndToEndSyncTest : public testing::Test { client_bus_ = new dbus::Bus(client_bus_options); object_proxy_ = client_bus_->GetObjectProxy("org.chromium.TestService", "/org/chromium/TestObject"); + ASSERT_FALSE(client_bus_->HasDBusThread()); } void TearDown() { + test_service_->Shutdown(); + ASSERT_TRUE(test_service_->WaitUntilServiceIsShutdown()); test_service_->Stop(); client_bus_->ShutdownAndBlock(); } @@ -74,9 +79,9 @@ TEST_F(EndToEndSyncTest, Timeout) { dbus::MessageWriter writer(&method_call); writer.AppendString(kHello); - // Call the method with timeout smaller than TestService::kSlowEchoSleepMs. + // Call the method with timeout of 0ms. dbus::Response response; - const int timeout_ms = dbus::TestService::kSlowEchoSleepMs / 10; + const int timeout_ms = 0; const bool success = object_proxy_->CallMethodAndBlock(&method_call, timeout_ms, &response); // Should fail because of timeout. |