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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 array_writer.CloseContainer(&entry_writer); | 260 array_writer.CloseContainer(&entry_writer); |
261 array_writer.OpenDictEntry(&entry_writer); | 261 array_writer.OpenDictEntry(&entry_writer); |
262 entry_writer.AppendString(kTextKey); | 262 entry_writer.AppendString(kTextKey); |
263 entry_writer.AppendVariantOfString(kExampleText); | 263 entry_writer.AppendVariantOfString(kExampleText); |
264 array_writer.CloseContainer(&entry_writer); | 264 array_writer.CloseContainer(&entry_writer); |
265 writer.CloseContainer(&array_writer); | 265 writer.CloseContainer(&array_writer); |
266 response_ = response.get(); | 266 response_ = response.get(); |
267 // Create expected result. | 267 // Create expected result. |
268 base::DictionaryValue expected_result; | 268 base::DictionaryValue expected_result; |
269 expected_result.SetWithoutPathExpansion( | 269 expected_result.SetWithoutPathExpansion( |
270 kNumberKey, base::Value::CreateStringValue(kExampleNumber)); | 270 kNumberKey, new base::StringValue(kExampleNumber)); |
271 expected_result.SetWithoutPathExpansion( | 271 expected_result.SetWithoutPathExpansion(kTextKey, |
272 kTextKey, base::Value::CreateStringValue(kExampleText)); | 272 new base::StringValue(kExampleText)); |
273 expected_result_ = &expected_result; | 273 expected_result_ = &expected_result; |
274 // Call Delete. | 274 // Call Delete. |
275 client_->Get(kServiceName, dbus::ObjectPath(kObjectPath), kIndex, | 275 client_->Get(kServiceName, dbus::ObjectPath(kObjectPath), kIndex, |
276 base::Bind(&MockGetCallback::Run, base::Unretained(&callback))); | 276 base::Bind(&MockGetCallback::Run, base::Unretained(&callback))); |
277 | 277 |
278 // Run the message loop. | 278 // Run the message loop. |
279 message_loop_.RunUntilIdle(); | 279 message_loop_.RunUntilIdle(); |
280 } | 280 } |
281 | 281 |
282 TEST_F(GsmSMSClientTest, List) { | 282 TEST_F(GsmSMSClientTest, List) { |
(...skipping 18 matching lines...) Expand all Loading... |
301 sub_array_writer.OpenDictEntry(&entry_writer); | 301 sub_array_writer.OpenDictEntry(&entry_writer); |
302 entry_writer.AppendString(kTextKey); | 302 entry_writer.AppendString(kTextKey); |
303 entry_writer.AppendVariantOfString(kExampleText); | 303 entry_writer.AppendVariantOfString(kExampleText); |
304 sub_array_writer.CloseContainer(&entry_writer); | 304 sub_array_writer.CloseContainer(&entry_writer); |
305 array_writer.CloseContainer(&sub_array_writer); | 305 array_writer.CloseContainer(&sub_array_writer); |
306 writer.CloseContainer(&array_writer); | 306 writer.CloseContainer(&array_writer); |
307 response_ = response.get(); | 307 response_ = response.get(); |
308 // Create expected result. | 308 // Create expected result. |
309 base::ListValue expected_result; | 309 base::ListValue expected_result; |
310 base::DictionaryValue* sms = new base::DictionaryValue; | 310 base::DictionaryValue* sms = new base::DictionaryValue; |
311 sms->SetWithoutPathExpansion( | 311 sms->SetWithoutPathExpansion(kNumberKey, |
312 kNumberKey, base::Value::CreateStringValue(kExampleNumber)); | 312 new base::StringValue(kExampleNumber)); |
313 sms->SetWithoutPathExpansion( | 313 sms->SetWithoutPathExpansion(kTextKey, new base::StringValue(kExampleText)); |
314 kTextKey, base::Value::CreateStringValue(kExampleText)); | |
315 expected_result.Append(sms); | 314 expected_result.Append(sms); |
316 expected_result_ = &expected_result; | 315 expected_result_ = &expected_result; |
317 // Call List. | 316 // Call List. |
318 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), | 317 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), |
319 base::Bind(&MockListCallback::Run, | 318 base::Bind(&MockListCallback::Run, |
320 base::Unretained(&callback))); | 319 base::Unretained(&callback))); |
321 | 320 |
322 // Run the message loop. | 321 // Run the message loop. |
323 message_loop_.RunUntilIdle(); | 322 message_loop_.RunUntilIdle(); |
324 } | 323 } |
325 | 324 |
326 } // namespace chromeos | 325 } // namespace chromeos |
OLD | NEW |