| OLD | NEW |
| 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 "chromeos/dbus/blocking_method_caller.h" | 5 #include "chromeos/dbus/blocking_method_caller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Set an expectation so mock_bus's GetObjectProxy() for the given | 65 // Set an expectation so mock_bus's GetObjectProxy() for the given |
| 66 // service name and the object path will return mock_proxy_. | 66 // service name and the object path will return mock_proxy_. |
| 67 EXPECT_CALL(*mock_bus_.get(), | 67 EXPECT_CALL(*mock_bus_.get(), |
| 68 GetObjectProxy("org.chromium.TestService", | 68 GetObjectProxy("org.chromium.TestService", |
| 69 dbus::ObjectPath("/org/chromium/TestObject"))) | 69 dbus::ObjectPath("/org/chromium/TestObject"))) |
| 70 .WillOnce(Return(mock_proxy_.get())); | 70 .WillOnce(Return(mock_proxy_.get())); |
| 71 | 71 |
| 72 // Set an expectation so mock_bus's GetDBusTaskRunner will return the fake | 72 // Set an expectation so mock_bus's GetDBusTaskRunner will return the fake |
| 73 // task runner. | 73 // task runner. |
| 74 EXPECT_CALL(*mock_bus_.get(), GetDBusTaskRunner()) | 74 EXPECT_CALL(*mock_bus_.get(), GetDBusTaskRunner()) |
| 75 .WillRepeatedly(Return(task_runner_)); | 75 .WillRepeatedly(Return(task_runner_.get())); |
| 76 | 76 |
| 77 // ShutdownAndBlock() will be called in TearDown(). | 77 // ShutdownAndBlock() will be called in TearDown(). |
| 78 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); | 78 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); |
| 79 } | 79 } |
| 80 | 80 |
| 81 virtual void TearDown() { | 81 virtual void TearDown() { |
| 82 mock_bus_->ShutdownAndBlock(); | 82 mock_bus_->ShutdownAndBlock(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 protected: | 85 protected: |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Check the response. | 129 // Check the response. |
| 130 ASSERT_TRUE(response.get()); | 130 ASSERT_TRUE(response.get()); |
| 131 dbus::MessageReader reader(response.get()); | 131 dbus::MessageReader reader(response.get()); |
| 132 std::string text_message; | 132 std::string text_message; |
| 133 ASSERT_TRUE(reader.PopString(&text_message)); | 133 ASSERT_TRUE(reader.PopString(&text_message)); |
| 134 // The text message should be echo'ed back. | 134 // The text message should be echo'ed back. |
| 135 EXPECT_EQ(kHello, text_message); | 135 EXPECT_EQ(kHello, text_message); |
| 136 } | 136 } |
| 137 | 137 |
| 138 } // namespace chromeos | 138 } // namespace chromeos |
| OLD | NEW |