| 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/modem_messaging_client.h" | 5 #include "chromeos/dbus/modem_messaging_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 // D-Bus object path used by test. | 47 // D-Bus object path used by test. |
| 48 const char kObjectPath[] = "/object/path"; | 48 const char kObjectPath[] = "/object/path"; |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 class ModemMessagingClientTest : public testing::Test { | 52 class ModemMessagingClientTest : public testing::Test { |
| 53 public: | 53 public: |
| 54 ModemMessagingClientTest() : response_(NULL), | 54 ModemMessagingClientTest() : response_(NULL), |
| 55 expected_result_(NULL) {} | 55 expected_result_(NULL) {} |
| 56 | 56 |
| 57 virtual void SetUp() OVERRIDE { | 57 virtual void SetUp() override { |
| 58 // Create a mock bus. | 58 // Create a mock bus. |
| 59 dbus::Bus::Options options; | 59 dbus::Bus::Options options; |
| 60 options.bus_type = dbus::Bus::SYSTEM; | 60 options.bus_type = dbus::Bus::SYSTEM; |
| 61 mock_bus_ = new dbus::MockBus(options); | 61 mock_bus_ = new dbus::MockBus(options); |
| 62 | 62 |
| 63 // Create a mock proxy. | 63 // Create a mock proxy. |
| 64 mock_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), | 64 mock_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), |
| 65 kServiceName, | 65 kServiceName, |
| 66 dbus::ObjectPath(kObjectPath)); | 66 dbus::ObjectPath(kObjectPath)); |
| 67 | 67 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 82 .WillOnce(Return(mock_proxy_.get())); | 82 .WillOnce(Return(mock_proxy_.get())); |
| 83 | 83 |
| 84 // ShutdownAndBlock() will be called in TearDown(). | 84 // ShutdownAndBlock() will be called in TearDown(). |
| 85 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); | 85 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); |
| 86 | 86 |
| 87 // Create a client with the mock bus. | 87 // Create a client with the mock bus. |
| 88 client_.reset(ModemMessagingClient::Create()); | 88 client_.reset(ModemMessagingClient::Create()); |
| 89 client_->Init(mock_bus_.get()); | 89 client_->Init(mock_bus_.get()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 virtual void TearDown() OVERRIDE { | 92 virtual void TearDown() override { |
| 93 mock_bus_->ShutdownAndBlock(); | 93 mock_bus_->ShutdownAndBlock(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 // Handles Delete method call. | 96 // Handles Delete method call. |
| 97 void OnDelete(dbus::MethodCall* method_call, | 97 void OnDelete(dbus::MethodCall* method_call, |
| 98 int timeout_ms, | 98 int timeout_ms, |
| 99 const dbus::ObjectProxy::ResponseCallback& callback) { | 99 const dbus::ObjectProxy::ResponseCallback& callback) { |
| 100 EXPECT_EQ(modemmanager::kModemManager1MessagingInterface, | 100 EXPECT_EQ(modemmanager::kModemManager1MessagingInterface, |
| 101 method_call->GetInterface()); | 101 method_call->GetInterface()); |
| 102 EXPECT_EQ(modemmanager::kSMSDeleteFunction, method_call->GetMember()); | 102 EXPECT_EQ(modemmanager::kSMSDeleteFunction, method_call->GetMember()); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // Call List. | 233 // Call List. |
| 234 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), | 234 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), |
| 235 base::Bind(&MockListCallback::Run, | 235 base::Bind(&MockListCallback::Run, |
| 236 base::Unretained(&callback))); | 236 base::Unretained(&callback))); |
| 237 | 237 |
| 238 // Run the message loop. | 238 // Run the message loop. |
| 239 message_loop_.RunUntilIdle(); | 239 message_loop_.RunUntilIdle(); |
| 240 } | 240 } |
| 241 | 241 |
| 242 } // namespace chromeos | 242 } // namespace chromeos |
| OLD | NEW |