diff options
author | adamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 21:45:23 +0000 |
---|---|---|
committer | adamk@chromium.org <adamk@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 21:45:23 +0000 |
commit | 20bed01e980a5853dd87d4c0d65d4912697f22ae (patch) | |
tree | ba248e80e0792a777a7c3ab96f319bc98f6ef025 /dbus/bus_unittest.cc | |
parent | e84efb11971bfbddfaff7b97f1fe8bb21fa82028 (diff) | |
download | chromium_src-20bed01e980a5853dd87d4c0d65d4912697f22ae.zip chromium_src-20bed01e980a5853dd87d4c0d65d4912697f22ae.tar.gz chromium_src-20bed01e980a5853dd87d4c0d65d4912697f22ae.tar.bz2 |
Allow dbus clients to silence logging when a service is unavailable.
BUG=109696
Review URL: https://chromiumcodereview.appspot.com/9373039
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/bus_unittest.cc')
-rw-r--r-- | dbus/bus_unittest.cc | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/dbus/bus_unittest.cc b/dbus/bus_unittest.cc index bbd2a4c..c21044b 100644 --- a/dbus/bus_unittest.cc +++ b/dbus/bus_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -50,6 +50,38 @@ TEST(BusTest, GetObjectProxy) { bus->ShutdownAndBlock(); } +TEST(BusTest, GetObjectProxyIgnoreUnknownService) { + dbus::Bus::Options options; + scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); + + dbus::ObjectProxy* object_proxy1 = + bus->GetObjectProxyWithOptions( + "org.chromium.TestService", + "/org/chromium/TestObject", + dbus::ObjectProxy::IGNORE_SERVICE_UNKNOWN_ERRORS); + ASSERT_TRUE(object_proxy1); + + // This should return the same object. + dbus::ObjectProxy* object_proxy2 = + bus->GetObjectProxyWithOptions( + "org.chromium.TestService", + "/org/chromium/TestObject", + dbus::ObjectProxy::IGNORE_SERVICE_UNKNOWN_ERRORS); + ASSERT_TRUE(object_proxy2); + EXPECT_EQ(object_proxy1, object_proxy2); + + // This should not. + dbus::ObjectProxy* object_proxy3 = + bus->GetObjectProxyWithOptions( + "org.chromium.TestService", + "/org/chromium/DifferentTestObject", + dbus::ObjectProxy::IGNORE_SERVICE_UNKNOWN_ERRORS); + ASSERT_TRUE(object_proxy3); + EXPECT_NE(object_proxy1, object_proxy3); + + bus->ShutdownAndBlock(); +} + TEST(BusTest, GetExportedObject) { dbus::Bus::Options options; scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); |