Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: dbus/bus_unittest.cc

Issue 7702001: Reuse existing object proxies and exported objects, if these exist. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-upload Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « dbus/bus.cc ('k') | dbus/dbus.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 }
OLDNEW
« no previous file with comments | « dbus/bus.cc ('k') | dbus/dbus.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698