| 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/gsm_sms_client.h" | 5 #include "chromeos/dbus/gsm_sms_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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const char kExampleText[] = "Hello."; | 62 const char kExampleText[] = "Hello."; |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 | 65 |
| 66 class GsmSMSClientTest : public testing::Test { | 66 class GsmSMSClientTest : public testing::Test { |
| 67 public: | 67 public: |
| 68 GsmSMSClientTest() : expected_index_(0), | 68 GsmSMSClientTest() : expected_index_(0), |
| 69 response_(NULL), | 69 response_(NULL), |
| 70 expected_result_(NULL) {} | 70 expected_result_(NULL) {} |
| 71 | 71 |
| 72 virtual void SetUp() OVERRIDE { | 72 virtual void SetUp() override { |
| 73 // Create a mock bus. | 73 // Create a mock bus. |
| 74 dbus::Bus::Options options; | 74 dbus::Bus::Options options; |
| 75 options.bus_type = dbus::Bus::SYSTEM; | 75 options.bus_type = dbus::Bus::SYSTEM; |
| 76 mock_bus_ = new dbus::MockBus(options); | 76 mock_bus_ = new dbus::MockBus(options); |
| 77 | 77 |
| 78 // Create a mock proxy. | 78 // Create a mock proxy. |
| 79 mock_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), | 79 mock_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), |
| 80 kServiceName, | 80 kServiceName, |
| 81 dbus::ObjectPath(kObjectPath)); | 81 dbus::ObjectPath(kObjectPath)); |
| 82 | 82 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 96 .WillOnce(Return(mock_proxy_.get())); | 96 .WillOnce(Return(mock_proxy_.get())); |
| 97 | 97 |
| 98 // ShutdownAndBlock() will be called in TearDown(). | 98 // ShutdownAndBlock() will be called in TearDown(). |
| 99 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); | 99 EXPECT_CALL(*mock_bus_.get(), ShutdownAndBlock()).WillOnce(Return()); |
| 100 | 100 |
| 101 // Create a client with the mock bus. | 101 // Create a client with the mock bus. |
| 102 client_.reset(GsmSMSClient::Create()); | 102 client_.reset(GsmSMSClient::Create()); |
| 103 client_->Init(mock_bus_.get()); | 103 client_->Init(mock_bus_.get()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 virtual void TearDown() OVERRIDE { | 106 virtual void TearDown() override { |
| 107 mock_bus_->ShutdownAndBlock(); | 107 mock_bus_->ShutdownAndBlock(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Handles Delete method call. | 110 // Handles Delete method call. |
| 111 void OnDelete(dbus::MethodCall* method_call, | 111 void OnDelete(dbus::MethodCall* method_call, |
| 112 int timeout_ms, | 112 int timeout_ms, |
| 113 const dbus::ObjectProxy::ResponseCallback& callback) { | 113 const dbus::ObjectProxy::ResponseCallback& callback) { |
| 114 EXPECT_EQ(modemmanager::kModemManagerSMSInterface, | 114 EXPECT_EQ(modemmanager::kModemManagerSMSInterface, |
| 115 method_call->GetInterface()); | 115 method_call->GetInterface()); |
| 116 EXPECT_EQ(modemmanager::kSMSDeleteFunction, method_call->GetMember()); | 116 EXPECT_EQ(modemmanager::kSMSDeleteFunction, method_call->GetMember()); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // Call List. | 316 // Call List. |
| 317 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), | 317 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), |
| 318 base::Bind(&MockListCallback::Run, | 318 base::Bind(&MockListCallback::Run, |
| 319 base::Unretained(&callback))); | 319 base::Unretained(&callback))); |
| 320 | 320 |
| 321 // Run the message loop. | 321 // Run the message loop. |
| 322 message_loop_.RunUntilIdle(); | 322 message_loop_.RunUntilIdle(); |
| 323 } | 323 } |
| 324 | 324 |
| 325 } // namespace chromeos | 325 } // namespace chromeos |
| OLD | NEW |