| OLD | NEW | 
|---|
| (Empty) |  | 
|  | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 
|  | 2 // Use of this source code is governed by a BSD-style license that can be | 
|  | 3 // found in the LICENSE file. | 
|  | 4 | 
|  | 5 #include "dbus/bus.h" | 
|  | 6 | 
|  | 7 #include "base/memory/ref_counted.h" | 
|  | 8 #include "dbus/exported_object.h" | 
|  | 9 #include "dbus/object_proxy.h" | 
|  | 10 | 
|  | 11 #include "testing/gtest/include/gtest/gtest.h" | 
|  | 12 | 
|  | 13 TEST(BusTest, GetObjectProxy) { | 
|  | 14   dbus::Bus::Options options; | 
|  | 15   scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); | 
|  | 16 | 
|  | 17   dbus::ObjectProxy* object_proxy1 = | 
|  | 18       bus->GetObjectProxy("org.chromium.TestService", | 
|  | 19                           "/org/chromium/TestObject"); | 
|  | 20   ASSERT_TRUE(object_proxy1); | 
|  | 21 | 
|  | 22   // This should return the same object. | 
|  | 23   dbus::ObjectProxy* object_proxy2 = | 
|  | 24       bus->GetObjectProxy("org.chromium.TestService", | 
|  | 25                           "/org/chromium/TestObject"); | 
|  | 26   ASSERT_TRUE(object_proxy2); | 
|  | 27   EXPECT_EQ(object_proxy1, object_proxy2); | 
|  | 28 | 
|  | 29   // This should not. | 
|  | 30   dbus::ObjectProxy* object_proxy3 = | 
|  | 31       bus->GetObjectProxy("org.chromium.TestService", | 
|  | 32                           "/org/chromium/DifferentTestObject"); | 
|  | 33   ASSERT_TRUE(object_proxy3); | 
|  | 34   EXPECT_NE(object_proxy1, object_proxy3); | 
|  | 35 } | 
|  | 36 | 
|  | 37 TEST(BusTest, GetExportedObject) { | 
|  | 38   dbus::Bus::Options options; | 
|  | 39   scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); | 
|  | 40 | 
|  | 41   dbus::ExportedObject* object_proxy1 = | 
|  | 42       bus->GetExportedObject("org.chromium.TestService", | 
|  | 43                              "/org/chromium/TestObject"); | 
|  | 44   ASSERT_TRUE(object_proxy1); | 
|  | 45 | 
|  | 46   // This should return the same object. | 
|  | 47   dbus::ExportedObject* object_proxy2 = | 
|  | 48       bus->GetExportedObject("org.chromium.TestService", | 
|  | 49                              "/org/chromium/TestObject"); | 
|  | 50   ASSERT_TRUE(object_proxy2); | 
|  | 51   EXPECT_EQ(object_proxy1, object_proxy2); | 
|  | 52 | 
|  | 53   // This should not. | 
|  | 54   dbus::ExportedObject* object_proxy3 = | 
|  | 55       bus->GetExportedObject("org.chromium.TestService", | 
|  | 56                              "/org/chromium/DifferentTestObject"); | 
|  | 57   ASSERT_TRUE(object_proxy3); | 
|  | 58   EXPECT_NE(object_proxy1, object_proxy3); | 
|  | 59 } | 
| OLD | NEW | 
|---|