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

Side by Side Diff: dbus/bus_unittest.cc

Issue 9668018: dbus: remove service name from ExportedObject (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: pay more attention when fixing mock Created 8 years, 9 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/exported_object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "dbus/bus.h" 5 #include "dbus/bus.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 EXPECT_NE(object_proxy1, object_proxy3); 82 EXPECT_NE(object_proxy1, object_proxy3);
83 83
84 bus->ShutdownAndBlock(); 84 bus->ShutdownAndBlock();
85 } 85 }
86 86
87 TEST(BusTest, GetExportedObject) { 87 TEST(BusTest, GetExportedObject) {
88 dbus::Bus::Options options; 88 dbus::Bus::Options options;
89 scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); 89 scoped_refptr<dbus::Bus> bus = new dbus::Bus(options);
90 90
91 dbus::ExportedObject* object_proxy1 = 91 dbus::ExportedObject* object_proxy1 =
92 bus->GetExportedObject("org.chromium.TestService", 92 bus->GetExportedObject(dbus::ObjectPath("/org/chromium/TestObject"));
93 dbus::ObjectPath("/org/chromium/TestObject"));
94 ASSERT_TRUE(object_proxy1); 93 ASSERT_TRUE(object_proxy1);
95 94
96 // This should return the same object. 95 // This should return the same object.
97 dbus::ExportedObject* object_proxy2 = 96 dbus::ExportedObject* object_proxy2 =
98 bus->GetExportedObject("org.chromium.TestService", 97 bus->GetExportedObject(dbus::ObjectPath("/org/chromium/TestObject"));
99 dbus::ObjectPath("/org/chromium/TestObject"));
100 ASSERT_TRUE(object_proxy2); 98 ASSERT_TRUE(object_proxy2);
101 EXPECT_EQ(object_proxy1, object_proxy2); 99 EXPECT_EQ(object_proxy1, object_proxy2);
102 100
103 // This should not. 101 // This should not.
104 dbus::ExportedObject* object_proxy3 = 102 dbus::ExportedObject* object_proxy3 =
105 bus->GetExportedObject( 103 bus->GetExportedObject(
106 "org.chromium.TestService",
107 dbus::ObjectPath("/org/chromium/DifferentTestObject")); 104 dbus::ObjectPath("/org/chromium/DifferentTestObject"));
108 ASSERT_TRUE(object_proxy3); 105 ASSERT_TRUE(object_proxy3);
109 EXPECT_NE(object_proxy1, object_proxy3); 106 EXPECT_NE(object_proxy1, object_proxy3);
110 107
111 bus->ShutdownAndBlock(); 108 bus->ShutdownAndBlock();
112 } 109 }
113 110
114 TEST(BusTest, ShutdownAndBlock) { 111 TEST(BusTest, ShutdownAndBlock) {
115 dbus::Bus::Options options; 112 dbus::Bus::Options options;
116 scoped_refptr<dbus::Bus> bus = new dbus::Bus(options); 113 scoped_refptr<dbus::Bus> bus = new dbus::Bus(options);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 ASSERT_FALSE(bus->AddFilterFunction(&DummyHandler, &data1)); 150 ASSERT_FALSE(bus->AddFilterFunction(&DummyHandler, &data1));
154 // Can add the same function with different data. 151 // Can add the same function with different data.
155 ASSERT_TRUE(bus->AddFilterFunction(&DummyHandler, &data2)); 152 ASSERT_TRUE(bus->AddFilterFunction(&DummyHandler, &data2));
156 153
157 ASSERT_TRUE(bus->RemoveFilterFunction(&DummyHandler, &data1)); 154 ASSERT_TRUE(bus->RemoveFilterFunction(&DummyHandler, &data1));
158 ASSERT_FALSE(bus->RemoveFilterFunction(&DummyHandler, &data1)); 155 ASSERT_FALSE(bus->RemoveFilterFunction(&DummyHandler, &data1));
159 ASSERT_TRUE(bus->RemoveFilterFunction(&DummyHandler, &data2)); 156 ASSERT_TRUE(bus->RemoveFilterFunction(&DummyHandler, &data2));
160 157
161 bus->ShutdownAndBlock(); 158 bus->ShutdownAndBlock();
162 } 159 }
OLDNEW
« no previous file with comments | « dbus/bus.cc ('k') | dbus/exported_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698