OLD | NEW |
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void StoreString(std::string* result, | 65 void StoreString(std::string* result, |
66 const base::Closure& callback, | 66 const base::Closure& callback, |
67 const base::Value* value) { | 67 const base::Value* value) { |
68 value->GetAsString(result); | 68 value->GetAsString(result); |
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 ASSERT_TRUE(value->is_blob()) << "Unexpected value in StoreDigest"; |
76 const bool is_binary = value->GetAsBinary(&binary); | 76 digest->assign(value->GetBlob().begin(), value->GetBlob().end()); |
77 EXPECT_TRUE(is_binary) << "Unexpected value in StoreDigest"; | |
78 if (is_binary) { | |
79 digest->assign(binary->GetBlob().begin(), binary->GetBlob().end()); | |
80 } | |
81 | |
82 callback.Run(); | 77 callback.Run(); |
83 } | 78 } |
84 | 79 |
85 // See net::SSLPrivateKey::SignDigest for the expected padding and DigestInfo | 80 // See net::SSLPrivateKey::SignDigest for the expected padding and DigestInfo |
86 // prefixing. | 81 // prefixing. |
87 bool RsaSign(const std::vector<uint8_t>& digest, | 82 bool RsaSign(const std::vector<uint8_t>& digest, |
88 crypto::RSAPrivateKey* key, | 83 crypto::RSAPrivateKey* key, |
89 std::vector<uint8_t>* signature) { | 84 std::vector<uint8_t>* signature) { |
90 RSA* rsa_key = EVP_PKEY_get0_RSA(key->key()); | 85 RSA* rsa_key = EVP_PKEY_get0_RSA(key->key()); |
91 if (!rsa_key) | 86 if (!rsa_key) |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 chromeos::CertificateProviderService* service = | 414 chromeos::CertificateProviderService* service = |
420 LoadRequestPinExtension("request_pin", "basic_lock.html"); | 415 LoadRequestPinExtension("request_pin", "basic_lock.html"); |
421 | 416 |
422 EnterCode(service, base::ASCIIToUTF16("123")); | 417 EnterCode(service, base::ASCIIToUTF16("123")); |
423 service->pin_dialog_manager()->active_window_for_testing()->Close(); | 418 service->pin_dialog_manager()->active_window_for_testing()->Close(); |
424 base::RunLoop().RunUntilIdle(); | 419 base::RunLoop().RunUntilIdle(); |
425 | 420 |
426 // The view should be set to nullptr when the window is closed. | 421 // The view should be set to nullptr when the window is closed. |
427 EXPECT_EQ(service->pin_dialog_manager()->active_view_for_testing(), nullptr); | 422 EXPECT_EQ(service->pin_dialog_manager()->active_view_for_testing(), nullptr); |
428 } | 423 } |
OLD | NEW |