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

Side by Side Diff: chrome/browser/extensions/api/certificate_provider/certificate_provider_apitest.cc

Issue 2841623003: Remove base::Value::Get{Buffer,Size} (Closed)
Patch Set: std::vector::assign instead of std::vector::operator= Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 callback.Run(); 69 callback.Run();
70 } 70 }
71 71
72 void StoreDigest(std::vector<uint8_t>* digest, 72 void StoreDigest(std::vector<uint8_t>* digest,
73 const base::Closure& callback, 73 const base::Closure& callback,
74 const base::Value* value) { 74 const base::Value* value) {
75 const base::Value* binary = nullptr; 75 const base::Value* binary = nullptr;
76 const bool is_binary = value->GetAsBinary(&binary); 76 const bool is_binary = value->GetAsBinary(&binary);
77 EXPECT_TRUE(is_binary) << "Unexpected value in StoreDigest"; 77 EXPECT_TRUE(is_binary) << "Unexpected value in StoreDigest";
78 if (is_binary) { 78 if (is_binary) {
79 const uint8_t* const binary_begin = 79 digest->assign(binary->GetBlob().begin(), binary->GetBlob().end());
80 reinterpret_cast<const uint8_t*>(binary->GetBuffer());
81 digest->assign(binary_begin, binary_begin + binary->GetSize());
82 } 80 }
83 81
84 callback.Run(); 82 callback.Run();
85 } 83 }
86 84
87 // See net::SSLPrivateKey::SignDigest for the expected padding and DigestInfo 85 // See net::SSLPrivateKey::SignDigest for the expected padding and DigestInfo
88 // prefixing. 86 // prefixing.
89 bool RsaSign(const std::vector<uint8_t>& digest, 87 bool RsaSign(const std::vector<uint8_t>& digest,
90 crypto::RSAPrivateKey* key, 88 crypto::RSAPrivateKey* key,
91 std::vector<uint8_t>* signature) { 89 std::vector<uint8_t>* signature) {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 chromeos::CertificateProviderService* service = 419 chromeos::CertificateProviderService* service =
422 LoadRequestPinExtension("request_pin", "basic_lock.html"); 420 LoadRequestPinExtension("request_pin", "basic_lock.html");
423 421
424 EnterCode(service, base::ASCIIToUTF16("123")); 422 EnterCode(service, base::ASCIIToUTF16("123"));
425 service->pin_dialog_manager()->active_window_for_testing()->Close(); 423 service->pin_dialog_manager()->active_window_for_testing()->Close();
426 base::RunLoop().RunUntilIdle(); 424 base::RunLoop().RunUntilIdle();
427 425
428 // The view should be set to nullptr when the window is closed. 426 // The view should be set to nullptr when the window is closed.
429 EXPECT_EQ(service->pin_dialog_manager()->active_view_for_testing(), nullptr); 427 EXPECT_EQ(service->pin_dialog_manager()->active_view_for_testing(), nullptr);
430 } 428 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698