| 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 <openssl/evp.h> | 5 #include <openssl/evp.h> |
| 6 #include <openssl/rsa.h> | 6 #include <openssl/rsa.h> |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 | 10 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 { | 236 { |
| 237 base::RunLoop run_loop; | 237 base::RunLoop run_loop; |
| 238 std::string https_reply; | 238 std::string https_reply; |
| 239 https_contents->GetMainFrame()->ExecuteJavaScriptForTests( | 239 https_contents->GetMainFrame()->ExecuteJavaScriptForTests( |
| 240 base::ASCIIToUTF16("document.body.textContent;"), | 240 base::ASCIIToUTF16("document.body.textContent;"), |
| 241 base::Bind(&StoreString, &https_reply, run_loop.QuitClosure())); | 241 base::Bind(&StoreString, &https_reply, run_loop.QuitClosure())); |
| 242 run_loop.Run(); | 242 run_loop.Run(); |
| 243 // Expect the server to return the fingerprint of the client cert that we | 243 // Expect the server to return the fingerprint of the client cert that we |
| 244 // presented, which should be the fingerprint of 'l1_leaf.der'. | 244 // presented, which should be the fingerprint of 'l1_leaf.der'. |
| 245 // The fingerprint can be calculated independently using: | 245 // The fingerprint can be calculated independently using: |
| 246 // openssl x509 -inform DER -noout -fingerprint -in \ | 246 // openssl x509 -inform DER -noout -fingerprint -in |
| 247 // chrome/test/data/extensions/api_test/certificate_provider/l1_leaf.der | 247 // chrome/test/data/extensions/api_test/certificate_provider/l1_leaf.der |
| 248 ASSERT_EQ( | 248 ASSERT_EQ( |
| 249 "got client cert with fingerprint: " | 249 "got client cert with fingerprint: " |
| 250 "2ab3f55e06eb8b36a741fe285a769da45edb2695", | 250 "2ab3f55e06eb8b36a741fe285a769da45edb2695", |
| 251 https_reply); | 251 https_reply); |
| 252 } | 252 } |
| 253 | 253 |
| 254 // Replying to the same signature request a second time must fail. | 254 // Replying to the same signature request a second time must fail. |
| 255 { | 255 { |
| 256 base::RunLoop run_loop; | 256 base::RunLoop run_loop; |
| 257 const std::string code = "replyWithSignatureSecondTime();"; | 257 const std::string code = "replyWithSignatureSecondTime();"; |
| 258 bool result = false; | 258 bool result = false; |
| 259 extension_contents->GetMainFrame()->ExecuteJavaScriptForTests( | 259 extension_contents->GetMainFrame()->ExecuteJavaScriptForTests( |
| 260 base::ASCIIToUTF16(code), | 260 base::ASCIIToUTF16(code), |
| 261 base::Bind(&StoreBool, &result, run_loop.QuitClosure())); | 261 base::Bind(&StoreBool, &result, run_loop.QuitClosure())); |
| 262 run_loop.Run(); | 262 run_loop.Run(); |
| 263 EXPECT_TRUE(result); | 263 EXPECT_TRUE(result); |
| 264 } | 264 } |
| 265 } | 265 } |
| OLD | NEW |