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

Side by Side Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api_chromeos_unittest.cc

Issue 2065793002: Return a unique_ptr from BinaryValue::CreateWithCopiedBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android and CrOS Created 4 years, 6 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 94 }
95 95
96 private: 96 private:
97 ~TestableGetPermitAccessFunction() override {} 97 ~TestableGetPermitAccessFunction() override {}
98 98
99 DISALLOW_COPY_AND_ASSIGN(TestableGetPermitAccessFunction); 99 DISALLOW_COPY_AND_ASSIGN(TestableGetPermitAccessFunction);
100 }; 100 };
101 101
102 // Converts a string to a base::BinaryValue value whose buffer contains the 102 // Converts a string to a base::BinaryValue value whose buffer contains the
103 // string data without the trailing '\0'. 103 // string data without the trailing '\0'.
104 base::BinaryValue* StringToBinaryValue(const std::string& value) { 104 std::unique_ptr<base::BinaryValue> StringToBinaryValue(
105 const std::string& value) {
105 return base::BinaryValue::CreateWithCopiedBuffer(value.data(), 106 return base::BinaryValue::CreateWithCopiedBuffer(value.data(),
106 value.length()); 107 value.length());
107 } 108 }
108 109
109 // Copies |private_key_source| and |public_key_source| to |private_key_target| 110 // Copies |private_key_source| and |public_key_source| to |private_key_target|
110 // and |public_key_target|. It is used as a callback for 111 // and |public_key_target|. It is used as a callback for
111 // |EasyUnlockClient::GenerateEcP256KeyPair| to save the values returned by the 112 // |EasyUnlockClient::GenerateEcP256KeyPair| to save the values returned by the
112 // method. 113 // method.
113 void CopyKeyPair(std::string* private_key_target, 114 void CopyKeyPair(std::string* private_key_target,
114 std::string* public_key_target, 115 std::string* public_key_target,
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 655
655 scoped_refptr<TestableGetPermitAccessFunction> function( 656 scoped_refptr<TestableGetPermitAccessFunction> function(
656 new TestableGetPermitAccessFunction()); 657 new TestableGetPermitAccessFunction());
657 std::unique_ptr<base::Value> value( 658 std::unique_ptr<base::Value> value(
658 extensions::api_test_utils::RunFunctionAndReturnSingleResult( 659 extensions::api_test_utils::RunFunctionAndReturnSingleResult(
659 function.get(), "[]", profile())); 660 function.get(), "[]", profile()));
660 EXPECT_FALSE(value); 661 EXPECT_FALSE(value);
661 } 662 }
662 663
663 } // namespace 664 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698