Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chromeos/dbus/gsm_sms_client_unittest.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: headers Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory>
10 #include <utility>
11
9 #include "base/bind.h" 12 #include "base/bind.h"
10 #include "base/location.h" 13 #include "base/location.h"
11 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 15 #include "base/run_loop.h"
13 #include "base/single_thread_task_runner.h" 16 #include "base/single_thread_task_runner.h"
14 #include "base/values.h" 17 #include "base/values.h"
15 #include "dbus/message.h" 18 #include "dbus/message.h"
16 #include "dbus/mock_bus.h" 19 #include "dbus/mock_bus.h"
17 #include "dbus/mock_object_proxy.h" 20 #include "dbus/mock_object_proxy.h"
18 #include "dbus/object_path.h" 21 #include "dbus/object_path.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 sub_array_writer.CloseContainer(&entry_writer); 308 sub_array_writer.CloseContainer(&entry_writer);
306 sub_array_writer.OpenDictEntry(&entry_writer); 309 sub_array_writer.OpenDictEntry(&entry_writer);
307 entry_writer.AppendString(kTextKey); 310 entry_writer.AppendString(kTextKey);
308 entry_writer.AppendVariantOfString(kExampleText); 311 entry_writer.AppendVariantOfString(kExampleText);
309 sub_array_writer.CloseContainer(&entry_writer); 312 sub_array_writer.CloseContainer(&entry_writer);
310 array_writer.CloseContainer(&sub_array_writer); 313 array_writer.CloseContainer(&sub_array_writer);
311 writer.CloseContainer(&array_writer); 314 writer.CloseContainer(&array_writer);
312 response_ = response.get(); 315 response_ = response.get();
313 // Create expected result. 316 // Create expected result.
314 base::ListValue expected_result; 317 base::ListValue expected_result;
315 base::DictionaryValue* sms = new base::DictionaryValue; 318 std::unique_ptr<base::DictionaryValue> sms(new base::DictionaryValue);
316 sms->SetWithoutPathExpansion(kNumberKey, 319 sms->SetWithoutPathExpansion(kNumberKey,
317 new base::StringValue(kExampleNumber)); 320 new base::StringValue(kExampleNumber));
318 sms->SetWithoutPathExpansion(kTextKey, new base::StringValue(kExampleText)); 321 sms->SetWithoutPathExpansion(kTextKey, new base::StringValue(kExampleText));
319 expected_result.Append(sms); 322 expected_result.Append(std::move(sms));
320 expected_result_ = &expected_result; 323 expected_result_ = &expected_result;
321 // Call List. 324 // Call List.
322 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), 325 client_->List(kServiceName, dbus::ObjectPath(kObjectPath),
323 base::Bind(&MockListCallback::Run, 326 base::Bind(&MockListCallback::Run,
324 base::Unretained(&callback))); 327 base::Unretained(&callback)));
325 328
326 // Run the message loop. 329 // Run the message loop.
327 base::RunLoop().RunUntilIdle(); 330 base::RunLoop().RunUntilIdle();
328 } 331 }
329 332
330 } // namespace chromeos 333 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698