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

Unified Diff: dbus/end_to_end_async_unittest.cc

Issue 14333009: D-Bus: allow multiple signal handlers for a signal (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dbus/object_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/end_to_end_async_unittest.cc
diff --git a/dbus/end_to_end_async_unittest.cc b/dbus/end_to_end_async_unittest.cc
index 6943494546fd27f309be5ad5d6f6cc013b93f464..7ef172543c3b94dd981adb3d27bcb9259343466d 100644
--- a/dbus/end_to_end_async_unittest.cc
+++ b/dbus/end_to_end_async_unittest.cc
@@ -587,24 +587,24 @@ TEST_F(EndToEndAsyncTest, DisconnectedSignal) {
EXPECT_EQ(1, on_disconnected_call_count_);
}
-class SignalReplacementTest : public EndToEndAsyncTest {
+class SignalMultipleHandlerTest : public EndToEndAsyncTest {
public:
- SignalReplacementTest() {
+ SignalMultipleHandlerTest() {
}
virtual void SetUp() {
// Set up base class.
EndToEndAsyncTest::SetUp();
- // Reconnect the root object proxy's signal handler to a new handler
+ // Connect the root object proxy's signal handler to a new handler
// so that we can verify that a second call to ConnectSignal() delivers
- // to our new handler and not the old.
+ // to both our new handler and the old.
object_proxy_->ConnectToSignal(
"org.chromium.TestInterface",
"Test",
- base::Bind(&SignalReplacementTest::OnReplacementTestSignal,
+ base::Bind(&SignalMultipleHandlerTest::OnAdditionalTestSignal,
base::Unretained(this)),
- base::Bind(&SignalReplacementTest::OnReplacementConnected,
+ base::Bind(&SignalMultipleHandlerTest::OnAdditionalConnected,
base::Unretained(this)));
// Wait until the object proxy is connected to the signal.
message_loop_.Run();
@@ -612,33 +612,33 @@ class SignalReplacementTest : public EndToEndAsyncTest {
protected:
// Called when the "Test" signal is received, in the main thread.
- // Copy the string payload to |replacement_test_signal_string_|.
- void OnReplacementTestSignal(dbus::Signal* signal) {
+ // Copy the string payload to |additional_test_signal_string_|.
+ void OnAdditionalTestSignal(dbus::Signal* signal) {
dbus::MessageReader reader(signal);
- ASSERT_TRUE(reader.PopString(&replacement_test_signal_string_));
+ ASSERT_TRUE(reader.PopString(&additional_test_signal_string_));
message_loop_.Quit();
}
// Called when connected to the signal.
- void OnReplacementConnected(const std::string& interface_name,
- const std::string& signal_name,
- bool success) {
+ void OnAdditionalConnected(const std::string& interface_name,
+ const std::string& signal_name,
+ bool success) {
ASSERT_TRUE(success);
message_loop_.Quit();
}
- // Text message from "Test" signal delivered to replacement handler.
- std::string replacement_test_signal_string_;
+ // Text message from "Test" signal delivered to additional handler.
+ std::string additional_test_signal_string_;
};
-TEST_F(SignalReplacementTest, TestSignalReplacement) {
+TEST_F(SignalMultipleHandlerTest, TestMultipleHandlers) {
const char kMessage[] = "hello, world";
// Send the test signal from the exported object.
test_service_->SendTestSignal(kMessage);
// Receive the signal with the object proxy.
WaitForTestSignal();
- // Verify the string WAS NOT received by the original handler.
- ASSERT_TRUE(test_signal_string_.empty());
- // Verify the signal WAS received by the replacement handler.
- ASSERT_EQ(kMessage, replacement_test_signal_string_);
+ // Verify the string WAS received by the original handler.
+ ASSERT_EQ(kMessage, test_signal_string_);
+ // Verify the signal WAS ALSO received by the additional handler.
+ ASSERT_EQ(kMessage, additional_test_signal_string_);
}
« no previous file with comments | « no previous file | dbus/object_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698