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

Side by Side Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h" 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 std::string expected_result; 299 std::string expected_result;
300 client_->CreateSecureMessage( 300 client_->CreateSecureMessage(
301 "PAYLOAD", 301 "PAYLOAD",
302 create_options, 302 create_options,
303 base::Bind(&CopyData, &expected_result)); 303 base::Bind(&CopyData, &expected_result));
304 ASSERT_GT(expected_result.length(), 0u); 304 ASSERT_GT(expected_result.length(), 0u);
305 305
306 std::unique_ptr<base::ListValue> args(new base::ListValue); 306 std::unique_ptr<base::ListValue> args(new base::ListValue);
307 args->Append(StringToBinaryValue("PAYLOAD")); 307 args->Append(StringToBinaryValue("PAYLOAD"));
308 args->Append(StringToBinaryValue("KEY")); 308 args->Append(StringToBinaryValue("KEY"));
309 base::DictionaryValue* options = new base::DictionaryValue(); 309 auto options = base::MakeUnique<base::DictionaryValue>();
310 args->Append(options); 310 args->Append(std::move(options));
311 311
312 ASSERT_TRUE(extension_function_test_utils::RunFunction( 312 ASSERT_TRUE(extension_function_test_utils::RunFunction(
313 function.get(), std::move(args), browser(), 313 function.get(), std::move(args), browser(),
314 extension_function_test_utils::NONE)); 314 extension_function_test_utils::NONE));
315 315
316 EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get())); 316 EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
317 } 317 }
318 318
319 TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage_AsymmetricSign) { 319 TEST_F(EasyUnlockPrivateApiTest, CreateSecureMessage_AsymmetricSign) {
320 scoped_refptr<EasyUnlockPrivateCreateSecureMessageFunction> function( 320 scoped_refptr<EasyUnlockPrivateCreateSecureMessageFunction> function(
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 std::string expected_result; 406 std::string expected_result;
407 client_->UnwrapSecureMessage( 407 client_->UnwrapSecureMessage(
408 "MESSAGE", 408 "MESSAGE",
409 unwrap_options, 409 unwrap_options,
410 base::Bind(&CopyData, &expected_result)); 410 base::Bind(&CopyData, &expected_result));
411 ASSERT_GT(expected_result.length(), 0u); 411 ASSERT_GT(expected_result.length(), 0u);
412 412
413 std::unique_ptr<base::ListValue> args(new base::ListValue); 413 std::unique_ptr<base::ListValue> args(new base::ListValue);
414 args->Append(StringToBinaryValue("MESSAGE")); 414 args->Append(StringToBinaryValue("MESSAGE"));
415 args->Append(StringToBinaryValue("KEY")); 415 args->Append(StringToBinaryValue("KEY"));
416 base::DictionaryValue* options = new base::DictionaryValue(); 416 auto options = base::MakeUnique<base::DictionaryValue>();
417 args->Append(options); 417 args->Append(std::move(options));
418 418
419 ASSERT_TRUE(extension_function_test_utils::RunFunction( 419 ASSERT_TRUE(extension_function_test_utils::RunFunction(
420 function.get(), std::move(args), browser(), 420 function.get(), std::move(args), browser(),
421 extension_function_test_utils::NONE)); 421 extension_function_test_utils::NONE));
422 422
423 EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get())); 423 EXPECT_EQ(expected_result, GetSingleBinaryResultAsString(function.get()));
424 } 424 }
425 425
426 TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage_AsymmetricSign) { 426 TEST_F(EasyUnlockPrivateApiTest, UnwrapSecureMessage_AsymmetricSign) {
427 scoped_refptr<EasyUnlockPrivateUnwrapSecureMessageFunction> function( 427 scoped_refptr<EasyUnlockPrivateUnwrapSecureMessageFunction> function(
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 654
655 scoped_refptr<TestableGetPermitAccessFunction> function( 655 scoped_refptr<TestableGetPermitAccessFunction> function(
656 new TestableGetPermitAccessFunction()); 656 new TestableGetPermitAccessFunction());
657 std::unique_ptr<base::Value> value( 657 std::unique_ptr<base::Value> value(
658 extensions::api_test_utils::RunFunctionAndReturnSingleResult( 658 extensions::api_test_utils::RunFunctionAndReturnSingleResult(
659 function.get(), "[]", profile())); 659 function.get(), "[]", profile()));
660 EXPECT_FALSE(value); 660 EXPECT_FALSE(value);
661 } 661 }
662 662
663 } // namespace 663 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698