summaryrefslogtreecommitdiffstats
path: root/dbus/test_service.cc
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 22:10:24 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-14 22:10:24 +0000
commitdf159b2125d12fcc957c53d0c9822995dfcc8bfd (patch)
treed9a268376675f5416e92c15319c948fc524b21c1 /dbus/test_service.cc
parente941828154d023ebedfbc90197efb80b092c5856 (diff)
downloadchromium_src-df159b2125d12fcc957c53d0c9822995dfcc8bfd.zip
chromium_src-df159b2125d12fcc957c53d0c9822995dfcc8bfd.tar.gz
chromium_src-df159b2125d12fcc957c53d0c9822995dfcc8bfd.tar.bz2
Stop restricting the sender object path for incoming signals.
Restricting the sender path makes it impossible to test signal handling with dbus-send --type=signal, as it uses "/" as the sender object path. For now, let's remove the restriction. We can make this restriction customizable when it becomes necessary. This is for http://codereview.chromium.org/7862020/ TEST=dbus_unittests BUG=none Review URL: http://codereview.chromium.org/7845029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101171 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/test_service.cc')
-rw-r--r--dbus/test_service.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/dbus/test_service.cc b/dbus/test_service.cc
index bc4ec86d..ca0eea3 100644
--- a/dbus/test_service.cc
+++ b/dbus/test_service.cc
@@ -72,6 +72,14 @@ void TestService::SendTestSignal(const std::string& message) {
message));
}
+void TestService::SendTestSignalFromRoot(const std::string& message) {
+ message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&TestService::SendTestSignalFromRootInternal,
+ base::Unretained(this),
+ message));
+}
+
void TestService::SendTestSignalInternal(const std::string& message) {
dbus::Signal signal("org.chromium.TestInterface", "Test");
dbus::MessageWriter writer(&signal);
@@ -79,6 +87,18 @@ void TestService::SendTestSignalInternal(const std::string& message) {
exported_object_->SendSignal(&signal);
}
+void TestService::SendTestSignalFromRootInternal(const std::string& message) {
+ dbus::Signal signal("org.chromium.TestInterface", "Test");
+ dbus::MessageWriter writer(&signal);
+ writer.AppendString(message);
+
+ // Use "/" just like dbus-send does.
+ ExportedObject* root_object =
+ bus_->GetExportedObject("org.chromium.TestService",
+ "/");
+ root_object->SendSignal(&signal);
+}
+
void TestService::OnExported(const std::string& interface_name,
const std::string& method_name,
bool success) {