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/modem_messaging_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
11 #include "dbus/mock_bus.h" | 11 #include "dbus/mock_bus.h" |
12 #include "dbus/mock_object_proxy.h" | 12 #include "dbus/mock_object_proxy.h" |
13 #include "dbus/object_path.h" | 13 #include "dbus/object_path.h" |
14 #include "dbus/values_util.h" | 14 #include "dbus/values_util.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "third_party/cros_system_api/dbus/service_constants.h" | 17 #include "third_party/cros_system_api/dbus/service_constants.h" |
18 | 18 |
19 using ::testing::_; | 19 using ::testing::_; |
20 using ::testing::Invoke; | 20 using ::testing::Invoke; |
21 using ::testing::Return; | 21 using ::testing::Return; |
22 | 22 |
23 namespace chromeos { | 23 namespace chromeos { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // A mock SmsReceivedHandler. | 27 // A mock SmsReceivedHandler. |
28 class MockSmsReceivedHandler { | 28 class MockSmsReceivedHandler { |
29 public: | 29 public: |
30 MOCK_METHOD2(Run, void(uint32 index, bool complete)); | 30 MOCK_METHOD2(Run, void(const dbus::ObjectPath &sms, bool complete)); |
31 }; | 31 }; |
32 | 32 |
33 // A mock DeleteCallback. | 33 // A mock DeleteCallback. |
34 class MockDeleteCallback { | 34 class MockDeleteCallback { |
35 public: | 35 public: |
36 MOCK_METHOD0(Run, void()); | 36 MOCK_METHOD0(Run, void()); |
37 }; | 37 }; |
38 | 38 |
39 // A mock GetCallback. | |
40 class MockGetCallback { | |
41 public: | |
42 MOCK_METHOD1(Run, void(const base::DictionaryValue& sms)); | |
43 }; | |
44 | |
45 // A mock ListCallback. | 39 // A mock ListCallback. |
46 class MockListCallback { | 40 class MockListCallback { |
47 public: | 41 public: |
48 MOCK_METHOD1(Run, void(const base::ListValue& result)); | 42 MOCK_METHOD1(Run, void(const std::vector<dbus::ObjectPath>& result)); |
49 }; | 43 }; |
50 | 44 |
51 // D-Bus service name used by test. | 45 // D-Bus service name used by test. |
52 const char kServiceName[] = "service.name"; | 46 const char kServiceName[] = "service.name"; |
53 // D-Bus object path used by test. | 47 // D-Bus object path used by test. |
54 const char kObjectPath[] = "/object/path"; | 48 const char kObjectPath[] = "/object/path"; |
55 | 49 |
56 // Keys of SMS dictionary. | 50 // Keys of SMS dictionary. |
57 const char kNumberKey[] = "number"; | 51 const char kNumberKey[] = "number"; |
58 const char kTextKey[] = "text"; | 52 const char kTextKey[] = "text"; |
59 | 53 |
60 // Example values of SMS dictionary. | 54 // Example values of SMS dictionary. |
61 const char kExampleNumber[] = "00012345678"; | 55 const char kExampleNumber[] = "00012345678"; |
62 const char kExampleText[] = "Hello."; | 56 const char kExampleText[] = "Hello."; |
63 | 57 |
64 } // namespace | 58 } // namespace |
65 | 59 |
66 class GsmSMSClientTest : public testing::Test { | 60 class ModemMessagingClientTest : public testing::Test { |
67 public: | 61 public: |
68 GsmSMSClientTest() : expected_index_(0), | 62 ModemMessagingClientTest() : response_(NULL), |
69 response_(NULL), | 63 expected_result_(NULL) {} |
70 expected_result_(NULL) {} | |
71 | 64 |
72 virtual void SetUp() OVERRIDE { | 65 virtual void SetUp() OVERRIDE { |
73 // Create a mock bus. | 66 // Create a mock bus. |
74 dbus::Bus::Options options; | 67 dbus::Bus::Options options; |
75 options.bus_type = dbus::Bus::SYSTEM; | 68 options.bus_type = dbus::Bus::SYSTEM; |
76 mock_bus_ = new dbus::MockBus(options); | 69 mock_bus_ = new dbus::MockBus(options); |
77 | 70 |
78 // Create a mock proxy. | 71 // Create a mock proxy. |
79 mock_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), | 72 mock_proxy_ = new dbus::MockObjectProxy(mock_bus_.get(), |
80 kServiceName, | 73 kServiceName, |
81 dbus::ObjectPath(kObjectPath)); | 74 dbus::ObjectPath(kObjectPath)); |
82 | 75 |
83 // Set an expectation so mock_proxy's ConnectToSignal() will use | 76 // Set an expectation so mock_proxy's ConnectToSignal() will use |
84 // OnConnectToSignal() to run the callback. | 77 // OnConnectToSignal() to run the callback. |
85 EXPECT_CALL(*mock_proxy_, ConnectToSignal( | 78 EXPECT_CALL(*mock_proxy_, ConnectToSignal( |
86 modemmanager::kModemManagerSMSInterface, | 79 modemmanager::kModemManager1MessagingInterface, |
87 modemmanager::kSMSReceivedSignal, _, _)) | 80 modemmanager::kSMSAdded, _, _)) |
88 .WillRepeatedly(Invoke(this, &GsmSMSClientTest::OnConnectToSignal)); | 81 .WillRepeatedly( |
82 Invoke(this, &ModemMessagingClientTest::OnConnectToSignal)); | |
89 | 83 |
90 // Set an expectation so mock_bus's GetObjectProxy() for the given | 84 // Set an expectation so mock_bus's GetObjectProxy() for the given |
91 // service name and the object path will return mock_proxy_. | 85 // service name and the object path will return mock_proxy_. |
92 EXPECT_CALL(*mock_bus_, GetObjectProxy(kServiceName, | 86 EXPECT_CALL(*mock_bus_, GetObjectProxy(kServiceName, |
93 dbus::ObjectPath(kObjectPath))) | 87 dbus::ObjectPath(kObjectPath))) |
94 .WillOnce(Return(mock_proxy_.get())); | 88 .WillOnce(Return(mock_proxy_.get())); |
95 | 89 |
96 // ShutdownAndBlock() will be called in TearDown(). | 90 // ShutdownAndBlock() will be called in TearDown(). |
97 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); | 91 EXPECT_CALL(*mock_bus_, ShutdownAndBlock()).WillOnce(Return()); |
98 | 92 |
99 // Create a client with the mock bus. | 93 // Create a client with the mock bus. |
100 client_.reset(GsmSMSClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, | 94 client_.reset(ModemMessagingClient::Create(REAL_DBUS_CLIENT_IMPLEMENTATION, |
101 mock_bus_)); | 95 mock_bus_)); |
102 } | 96 } |
103 | 97 |
104 virtual void TearDown() OVERRIDE { | 98 virtual void TearDown() OVERRIDE { |
105 mock_bus_->ShutdownAndBlock(); | 99 mock_bus_->ShutdownAndBlock(); |
106 } | 100 } |
107 | 101 |
108 // Handles Delete method call. | 102 // Handles Delete method call. |
109 void OnDelete(dbus::MethodCall* method_call, | 103 void OnDelete(dbus::MethodCall* method_call, |
110 int timeout_ms, | 104 int timeout_ms, |
111 const dbus::ObjectProxy::ResponseCallback& callback) { | 105 const dbus::ObjectProxy::ResponseCallback& callback) { |
112 EXPECT_EQ(modemmanager::kModemManagerSMSInterface, | 106 EXPECT_EQ(modemmanager:kModemManager1MessagingInterface, |
113 method_call->GetInterface()); | 107 method_call->GetInterface()); |
114 EXPECT_EQ(modemmanager::kSMSDeleteFunction, method_call->GetMember()); | 108 EXPECT_EQ(modemmanager::kSMSDeleteFunction, method_call->GetMember()); |
115 uint32 index = 0; | 109 dbus::ObjectPath sms_path; |
116 dbus::MessageReader reader(method_call); | 110 dbus::MessageReader reader(method_call); |
117 EXPECT_TRUE(reader.PopUint32(&index)); | 111 EXPECT_TRUE(reader.PopObjectPath(&sms_path)); |
118 EXPECT_EQ(expected_index_, index); | 112 EXPECT_EQ(expected_sms_path_, sms_path); |
119 EXPECT_FALSE(reader.HasMoreData()); | 113 EXPECT_FALSE(reader.HasMoreData()); |
120 | 114 |
121 message_loop_.PostTask(FROM_HERE, base::Bind(callback, response_)); | 115 message_loop_.PostTask(FROM_HERE, base::Bind(callback, response_)); |
122 } | |
123 | |
124 // Handles Get method call. | |
125 void OnGet(dbus::MethodCall* method_call, | |
126 int timeout_ms, | |
127 const dbus::ObjectProxy::ResponseCallback& callback) { | |
128 EXPECT_EQ(modemmanager::kModemManagerSMSInterface, | |
129 method_call->GetInterface()); | |
130 EXPECT_EQ(modemmanager::kSMSGetFunction, method_call->GetMember()); | |
131 uint32 index = 0; | |
132 dbus::MessageReader reader(method_call); | |
133 EXPECT_TRUE(reader.PopUint32(&index)); | |
134 EXPECT_EQ(expected_index_, index); | |
135 EXPECT_FALSE(reader.HasMoreData()); | |
136 | |
137 message_loop_.PostTask(FROM_HERE, base::Bind(callback, response_)); | |
138 } | 116 } |
139 | 117 |
140 // Handles List method call. | 118 // Handles List method call. |
141 void OnList(dbus::MethodCall* method_call, | 119 void OnList(dbus::MethodCall* method_call, |
142 int timeout_ms, | 120 int timeout_ms, |
143 const dbus::ObjectProxy::ResponseCallback& callback) { | 121 const dbus::ObjectProxy::ResponseCallback& callback) { |
144 EXPECT_EQ(modemmanager::kModemManagerSMSInterface, | 122 EXPECT_EQ(modemmanager:kModemManager1MessagingInterface, |
145 method_call->GetInterface()); | 123 method_call->GetInterface()); |
146 EXPECT_EQ(modemmanager::kSMSListFunction, method_call->GetMember()); | 124 EXPECT_EQ(modemmanager::kSMSListFunction, method_call->GetMember()); |
147 dbus::MessageReader reader(method_call); | 125 dbus::MessageReader reader(method_call); |
148 EXPECT_FALSE(reader.HasMoreData()); | 126 EXPECT_FALSE(reader.HasMoreData()); |
149 | 127 |
150 message_loop_.PostTask(FROM_HERE, base::Bind(callback, response_)); | 128 message_loop_.PostTask(FROM_HERE, base::Bind(callback, response_)); |
151 } | 129 } |
152 | 130 |
153 // Checks the results of Get and List. | 131 // Checks the results of List. |
154 void CheckResult(const base::Value& result) { | 132 void CheckResult(const std::vector<dbus::ObjectPath>& result) { |
155 EXPECT_TRUE(result.Equals(expected_result_)); | 133 EXPECT_TRUE(result.Equals(expected_result_)); |
hashimoto
2012/06/06 07:19:44
Does this line compile?
| |
156 } | 134 } |
157 | 135 |
158 protected: | 136 protected: |
159 // The client to be tested. | 137 // The client to be tested. |
160 scoped_ptr<GsmSMSClient> client_; | 138 scoped_ptr<ModemMessagingClient> client_; |
161 // A message loop to emulate asynchronous behavior. | 139 // A message loop to emulate asynchronous behavior. |
162 MessageLoop message_loop_; | 140 MessageLoop message_loop_; |
163 // The mock bus. | 141 // The mock bus. |
164 scoped_refptr<dbus::MockBus> mock_bus_; | 142 scoped_refptr<dbus::MockBus> mock_bus_; |
165 // The mock object proxy. | 143 // The mock object proxy. |
166 scoped_refptr<dbus::MockObjectProxy> mock_proxy_; | 144 scoped_refptr<dbus::MockObjectProxy> mock_proxy_; |
167 // The SmsReceived signal handler given by the tested client. | 145 // The SmsReceived signal handler given by the tested client. |
168 dbus::ObjectProxy::SignalCallback sms_received_callback_; | 146 dbus::ObjectProxy::SignalCallback sms_received_callback_; |
169 // Expected argument for Delete and Get methods. | 147 // Expected argument for Delete method. |
170 uint32 expected_index_; | 148 dbus::ObjectPath expected_sms_path_; |
171 // Response returned by mock methods. | 149 // Response returned by mock methods. |
172 dbus::Response* response_; | 150 dbus::Response* response_; |
173 // Expected result of Get and List methods. | 151 // Expected result of List method. |
174 base::Value* expected_result_; | 152 std::vector<dbus::ObjectPath>* expected_result_; |
175 | 153 |
176 private: | 154 private: |
177 // Used to implement the mock proxy. | 155 // Used to implement the mock proxy. |
178 void OnConnectToSignal( | 156 void OnConnectToSignal( |
179 const std::string& interface_name, | 157 const std::string& interface_name, |
180 const std::string& signal_name, | 158 const std::string& signal_name, |
181 const dbus::ObjectProxy::SignalCallback& signal_callback, | 159 const dbus::ObjectProxy::SignalCallback& signal_callback, |
182 const dbus::ObjectProxy::OnConnectedCallback& on_connected_callback) { | 160 const dbus::ObjectProxy::OnConnectedCallback& on_connected_callback) { |
183 sms_received_callback_ = signal_callback; | 161 sms_received_callback_ = signal_callback; |
184 const bool success = true; | 162 const bool success = true; |
185 message_loop_.PostTask(FROM_HERE, base::Bind(on_connected_callback, | 163 message_loop_.PostTask(FROM_HERE, base::Bind(on_connected_callback, |
186 interface_name, | 164 interface_name, |
187 signal_name, | 165 signal_name, |
188 success)); | 166 success)); |
189 } | 167 } |
190 }; | 168 }; |
191 | 169 |
192 TEST_F(GsmSMSClientTest, SmsReceived) { | 170 TEST_F(ModemMessagingClientTest, SmsReceived) { |
193 // Set expectations. | 171 // Set expectations. |
194 const uint32 kIndex = 42; | 172 const dbus::ObjectPath kSmsPath('/SMS/0'); |
195 const bool kComplete = true; | 173 const bool kComplete = true; |
196 MockSmsReceivedHandler handler; | 174 MockSmsReceivedHandler handler; |
197 EXPECT_CALL(handler, Run(kIndex, kComplete)).Times(1); | 175 EXPECT_CALL(handler, Run(kSmsPath, kComplete)).Times(1); |
198 // Set handler. | 176 // Set handler. |
199 client_->SetSmsReceivedHandler(kServiceName, dbus::ObjectPath(kObjectPath), | 177 client_->SetSmsReceivedHandler(kServiceName, dbus::ObjectPath(kObjectPath), |
200 base::Bind(&MockSmsReceivedHandler::Run, | 178 base::Bind(&MockSmsReceivedHandler::Run, |
201 base::Unretained(&handler))); | 179 base::Unretained(&handler))); |
202 | 180 |
203 // Run the message loop to run the signal connection result callback. | 181 // Run the message loop to run the signal connection result callback. |
204 message_loop_.RunAllPending(); | 182 message_loop_.RunAllPending(); |
205 | 183 |
206 // Send signal. | 184 // Send signal. |
207 dbus::Signal signal(modemmanager::kModemManagerSMSInterface, | 185 dbus::Signal signal(modemmanager:kModemManager1MessagingInterface, |
208 modemmanager::kSMSReceivedSignal); | 186 modemmanager::kSMSAddedSignal); |
209 dbus::MessageWriter writer(&signal); | 187 dbus::MessageWriter writer(&signal); |
210 writer.AppendUint32(kIndex); | 188 writer.AppendObjectPath(kSmsPath); |
211 writer.AppendBool(kComplete); | 189 writer.AppendBool(kComplete); |
212 ASSERT_FALSE(sms_received_callback_.is_null()); | 190 ASSERT_FALSE(sms_received_callback_.is_null()); |
213 sms_received_callback_.Run(&signal); | 191 sms_received_callback_.Run(&signal); |
214 // Reset handler. | 192 // Reset handler. |
215 client_->ResetSmsReceivedHandler(kServiceName, dbus::ObjectPath(kObjectPath)); | 193 client_->ResetSmsReceivedHandler(kServiceName, dbus::ObjectPath(kObjectPath)); |
216 // Send signal again. | 194 // Send signal again. |
217 sms_received_callback_.Run(&signal); | 195 sms_received_callback_.Run(&signal); |
218 } | 196 } |
219 | 197 |
220 TEST_F(GsmSMSClientTest, Delete) { | 198 TEST_F(ModemMessagingClientTest, Delete) { |
221 // Set expectations. | 199 // Set expectations. |
222 const uint32 kIndex = 42; | 200 const dbus::ObjectPath kSmsPath('/SMS/0'); |
223 expected_index_ = kIndex; | 201 expected_sms_path_ = kSmsPath; |
224 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) | 202 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) |
225 .WillOnce(Invoke(this, &GsmSMSClientTest::OnDelete)); | 203 .WillOnce(Invoke(this, &ModemMessagingClientTest::OnDelete)); |
226 MockDeleteCallback callback; | 204 MockDeleteCallback callback; |
227 EXPECT_CALL(callback, Run()).Times(1); | 205 EXPECT_CALL(callback, Run()).Times(1); |
228 // Create response. | 206 // Create response. |
229 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 207 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
230 response_ = response.get(); | 208 response_ = response.get(); |
231 // Call Delete. | 209 // Call Delete. |
232 client_->Delete(kServiceName, dbus::ObjectPath(kObjectPath), kIndex, | 210 client_->Delete(kServiceName, dbus::ObjectPath(kObjectPath), kSmsPath, |
233 base::Bind(&MockDeleteCallback::Run, | 211 base::Bind(&MockDeleteCallback::Run, |
234 base::Unretained(&callback))); | 212 base::Unretained(&callback))); |
235 | 213 |
236 // Run the message loop. | 214 // Run the message loop. |
237 message_loop_.RunAllPending(); | 215 message_loop_.RunAllPending(); |
238 } | 216 } |
239 | 217 |
240 TEST_F(GsmSMSClientTest, Get) { | 218 TEST_F(ModemMessagingClientTest, List) { |
241 // Set expectations. | 219 // Set expectations. |
242 const uint32 kIndex = 42; | |
243 expected_index_ = kIndex; | |
244 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) | 220 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) |
245 .WillOnce(Invoke(this, &GsmSMSClientTest::OnGet)); | 221 .WillOnce(Invoke(this, &ModemMessagingClientTest::OnList)); |
246 MockGetCallback callback; | 222 MockListCallback callback; |
247 EXPECT_CALL(callback, Run(_)) | 223 EXPECT_CALL(callback, Run(_)) |
248 .WillOnce(Invoke(this, &GsmSMSClientTest::CheckResult)); | 224 .WillOnce(Invoke(this, &ModemMessagingClientTest::CheckResult)); |
249 // Create response. | 225 // Create response. |
250 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | 226 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); |
227 dbus::ObjectPath path1("/SMS/1"); | |
228 dbus::ObjectPath path2("/SMS/2"); | |
251 dbus::MessageWriter writer(response.get()); | 229 dbus::MessageWriter writer(response.get()); |
252 dbus::MessageWriter array_writer(NULL); | 230 dbus::MessageWriter array_writer(NULL); |
253 writer.OpenArray("{sv}", &array_writer); | 231 writer.OpenArray("ao", &array_writer); |
hashimoto
2012/06/06 07:19:44
I think this should be "o", not "ao".
Does this te
Jason Glasgow
2012/06/06 20:54:20
Done.
| |
254 dbus::MessageWriter entry_writer(NULL); | 232 entry_writer.AppendObjectPath(path1); |
255 array_writer.OpenDictEntry(&entry_writer); | 233 entry_writer.AppendObjectPath(path2); |
256 entry_writer.AppendString(kNumberKey); | |
257 entry_writer.AppendVariantOfString(kExampleNumber); | |
258 array_writer.CloseContainer(&entry_writer); | |
259 array_writer.OpenDictEntry(&entry_writer); | |
260 entry_writer.AppendString(kTextKey); | |
261 entry_writer.AppendVariantOfString(kExampleText); | |
262 array_writer.CloseContainer(&entry_writer); | |
263 writer.CloseContainer(&array_writer); | 234 writer.CloseContainer(&array_writer); |
264 response_ = response.get(); | 235 response_ = response.get(); |
236 | |
265 // Create expected result. | 237 // Create expected result. |
266 base::DictionaryValue expected_result; | 238 std::vector<dbus::ObjectPath> expected_result; |
267 expected_result.SetWithoutPathExpansion( | 239 expected_result.push_back(path1); |
268 kNumberKey, base::Value::CreateStringValue(kExampleNumber)); | 240 expected_result.push_back(path2); |
269 expected_result.SetWithoutPathExpansion( | |
270 kTextKey, base::Value::CreateStringValue(kExampleText)); | |
271 expected_result_ = &expected_result; | 241 expected_result_ = &expected_result; |
272 // Call Delete. | 242 // Call List. |
273 client_->Get(kServiceName, dbus::ObjectPath(kObjectPath), kIndex, | |
274 base::Bind(&MockGetCallback::Run, base::Unretained(&callback))); | |
275 | |
276 // Run the message loop. | |
277 message_loop_.RunAllPending(); | |
278 } | |
279 | |
280 TEST_F(GsmSMSClientTest, List) { | |
281 // Set expectations. | |
282 EXPECT_CALL(*mock_proxy_, CallMethod(_, _, _)) | |
283 .WillOnce(Invoke(this, &GsmSMSClientTest::OnList)); | |
284 MockListCallback callback; | |
285 EXPECT_CALL(callback, Run(_)) | |
286 .WillOnce(Invoke(this, &GsmSMSClientTest::CheckResult)); | |
287 // Create response. | |
288 scoped_ptr<dbus::Response> response(dbus::Response::CreateEmpty()); | |
289 dbus::MessageWriter writer(response.get()); | |
290 dbus::MessageWriter array_writer(NULL); | |
291 writer.OpenArray("a{sv}", &array_writer); | |
292 dbus::MessageWriter sub_array_writer(NULL); | |
293 array_writer.OpenArray("{sv}", &sub_array_writer); | |
294 dbus::MessageWriter entry_writer(NULL); | |
295 sub_array_writer.OpenDictEntry(&entry_writer); | |
296 entry_writer.AppendString(kNumberKey); | |
297 entry_writer.AppendVariantOfString(kExampleNumber); | |
298 sub_array_writer.CloseContainer(&entry_writer); | |
299 sub_array_writer.OpenDictEntry(&entry_writer); | |
300 entry_writer.AppendString(kTextKey); | |
301 entry_writer.AppendVariantOfString(kExampleText); | |
302 sub_array_writer.CloseContainer(&entry_writer); | |
303 array_writer.CloseContainer(&sub_array_writer); | |
304 writer.CloseContainer(&array_writer); | |
305 response_ = response.get(); | |
306 // Create expected result. | |
307 base::ListValue expected_result; | |
308 base::DictionaryValue* sms = new base::DictionaryValue; | |
309 sms->SetWithoutPathExpansion( | |
310 kNumberKey, base::Value::CreateStringValue(kExampleNumber)); | |
311 sms->SetWithoutPathExpansion( | |
312 kTextKey, base::Value::CreateStringValue(kExampleText)); | |
313 expected_result.Append(sms); | |
314 expected_result_ = &expected_result; | |
315 // Call Delete. | |
316 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), | 243 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), |
317 base::Bind(&MockListCallback::Run, | 244 base::Bind(&MockListCallback::Run, |
318 base::Unretained(&callback))); | 245 base::Unretained(&callback))); |
319 | 246 |
320 // Run the message loop. | 247 // Run the message loop. |
321 message_loop_.RunAllPending(); | 248 message_loop_.RunAllPending(); |
322 } | 249 } |
323 | 250 |
324 } // namespace chromeos | 251 } // namespace chromeos |
OLD | NEW |