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

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: MakeUnique 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
« no previous file with comments | « chromeos/dbus/fake_gsm_sms_client.cc ('k') | chromeos/dbus/shill_manager_client_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
14 #include "base/memory/ptr_util.h"
11 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h" 16 #include "base/run_loop.h"
13 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
14 #include "base/values.h" 18 #include "base/values.h"
15 #include "dbus/message.h" 19 #include "dbus/message.h"
16 #include "dbus/mock_bus.h" 20 #include "dbus/mock_bus.h"
17 #include "dbus/mock_object_proxy.h" 21 #include "dbus/mock_object_proxy.h"
18 #include "dbus/object_path.h" 22 #include "dbus/object_path.h"
19 #include "dbus/values_util.h" 23 #include "dbus/values_util.h"
20 #include "testing/gmock/include/gmock/gmock.h" 24 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 sub_array_writer.CloseContainer(&entry_writer); 309 sub_array_writer.CloseContainer(&entry_writer);
306 sub_array_writer.OpenDictEntry(&entry_writer); 310 sub_array_writer.OpenDictEntry(&entry_writer);
307 entry_writer.AppendString(kTextKey); 311 entry_writer.AppendString(kTextKey);
308 entry_writer.AppendVariantOfString(kExampleText); 312 entry_writer.AppendVariantOfString(kExampleText);
309 sub_array_writer.CloseContainer(&entry_writer); 313 sub_array_writer.CloseContainer(&entry_writer);
310 array_writer.CloseContainer(&sub_array_writer); 314 array_writer.CloseContainer(&sub_array_writer);
311 writer.CloseContainer(&array_writer); 315 writer.CloseContainer(&array_writer);
312 response_ = response.get(); 316 response_ = response.get();
313 // Create expected result. 317 // Create expected result.
314 base::ListValue expected_result; 318 base::ListValue expected_result;
315 base::DictionaryValue* sms = new base::DictionaryValue; 319 auto sms = base::MakeUnique<base::DictionaryValue>();
316 sms->SetWithoutPathExpansion(kNumberKey, 320 sms->SetWithoutPathExpansion(kNumberKey,
317 new base::StringValue(kExampleNumber)); 321 new base::StringValue(kExampleNumber));
318 sms->SetWithoutPathExpansion(kTextKey, new base::StringValue(kExampleText)); 322 sms->SetWithoutPathExpansion(kTextKey, new base::StringValue(kExampleText));
319 expected_result.Append(sms); 323 expected_result.Append(std::move(sms));
320 expected_result_ = &expected_result; 324 expected_result_ = &expected_result;
321 // Call List. 325 // Call List.
322 client_->List(kServiceName, dbus::ObjectPath(kObjectPath), 326 client_->List(kServiceName, dbus::ObjectPath(kObjectPath),
323 base::Bind(&MockListCallback::Run, 327 base::Bind(&MockListCallback::Run,
324 base::Unretained(&callback))); 328 base::Unretained(&callback)));
325 329
326 // Run the message loop. 330 // Run the message loop.
327 base::RunLoop().RunUntilIdle(); 331 base::RunLoop().RunUntilIdle();
328 } 332 }
329 333
330 } // namespace chromeos 334 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_gsm_sms_client.cc ('k') | chromeos/dbus/shill_manager_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698