| 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 7715f7d1826f822f28878f0b327242c7edd36016..cb952f13a68a98c98dc184b4f8e168548e4e7d0b 100644
|
| --- a/dbus/end_to_end_async_unittest.cc
|
| +++ b/dbus/end_to_end_async_unittest.cc
|
| @@ -32,8 +32,7 @@ const int kHugePayloadSize = 64 << 20; // 64 MB
|
| // ExportedObject.
|
| class EndToEndAsyncTest : public testing::Test {
|
| public:
|
| - EndToEndAsyncTest() {
|
| - }
|
| + EndToEndAsyncTest() : on_disconnected_call_count_(0) {}
|
|
|
| virtual void SetUp() {
|
| // Make the main thread not to allow IO.
|
| @@ -125,6 +124,13 @@ class EndToEndAsyncTest : public testing::Test {
|
| test_service_->Stop();
|
| }
|
|
|
| + // Callback function which is called when the connection with dbus-daemon is
|
| + // disconnected.
|
| + void OnDisconnected() {
|
| + message_loop_.Quit();
|
| + ++on_disconnected_call_count_;
|
| + }
|
| +
|
| protected:
|
| // Replaces the bus with a broken one.
|
| void SetUpBrokenBus() {
|
| @@ -260,6 +266,7 @@ class EndToEndAsyncTest : public testing::Test {
|
| std::string test_signal_string_;
|
| // Text message from "Test" signal delivered to root.
|
| std::string root_test_signal_string_;
|
| + int on_disconnected_call_count_;
|
| };
|
|
|
| TEST_F(EndToEndAsyncTest, Echo) {
|
| @@ -572,6 +579,18 @@ TEST_F(EndToEndAsyncTest, TestHugeSignal) {
|
| ASSERT_EQ(kHugeMessage, test_signal_string_);
|
| }
|
|
|
| +TEST_F(EndToEndAsyncTest, DisconnectedSignal) {
|
| + bus_->SetDisconnectedCallback(
|
| + base::Bind(&EndToEndAsyncTest::OnDisconnected,
|
| + base::Unretained(this)));
|
| + bus_->PostTaskToDBusThread(FROM_HERE,
|
| + base::Bind(&dbus::Bus::CloseConnection,
|
| + base::Unretained(bus_.get())));
|
| + // OnDisconnected callback quits message loop.
|
| + message_loop_.Run();
|
| + EXPECT_EQ(1, on_disconnected_call_count_);
|
| +}
|
| +
|
| class SignalReplacementTest : public EndToEndAsyncTest {
|
| public:
|
| SignalReplacementTest() {
|
|
|