OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 certs_.swap(*certs); | 46 certs_.swap(*certs); |
47 run_loop->Quit(); | 47 run_loop->Quit(); |
48 } | 48 } |
49 | 49 |
50 protected: | 50 protected: |
51 static void ReadTestKeyAndCert(std::string* key, std::string* cert) { | 51 static void ReadTestKeyAndCert(std::string* key, std::string* cert) { |
52 base::FilePath key_path = net::GetTestCertsDirectory().AppendASCII( | 52 base::FilePath key_path = net::GetTestCertsDirectory().AppendASCII( |
53 "unittest.originbound.key.der"); | 53 "unittest.originbound.key.der"); |
54 base::FilePath cert_path = net::GetTestCertsDirectory().AppendASCII( | 54 base::FilePath cert_path = net::GetTestCertsDirectory().AppendASCII( |
55 "unittest.originbound.der"); | 55 "unittest.originbound.der"); |
56 ASSERT_TRUE(file_util::ReadFileToString(key_path, key)); | 56 ASSERT_TRUE(base::ReadFileToString(key_path, key)); |
57 ASSERT_TRUE(file_util::ReadFileToString(cert_path, cert)); | 57 ASSERT_TRUE(base::ReadFileToString(cert_path, cert)); |
58 } | 58 } |
59 | 59 |
60 static base::Time GetTestCertExpirationTime() { | 60 static base::Time GetTestCertExpirationTime() { |
61 // Cert expiration time from 'dumpasn1 unittest.originbound.der': | 61 // Cert expiration time from 'dumpasn1 unittest.originbound.der': |
62 // GeneralizedTime 19/11/2111 02:23:45 GMT | 62 // GeneralizedTime 19/11/2111 02:23:45 GMT |
63 // base::Time::FromUTCExploded can't generate values past 2038 on 32-bit | 63 // base::Time::FromUTCExploded can't generate values past 2038 on 32-bit |
64 // linux, so we use the raw value here. | 64 // linux, so we use the raw value here. |
65 return base::Time::FromInternalValue(GG_INT64_C(16121816625000000)); | 65 return base::Time::FromInternalValue(GG_INT64_C(16121816625000000)); |
66 } | 66 } |
67 | 67 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 ASSERT_EQ("google.com", certs[0]->server_identifier()); | 460 ASSERT_EQ("google.com", certs[0]->server_identifier()); |
461 ASSERT_EQ(GetTestCertExpirationTime(), | 461 ASSERT_EQ(GetTestCertExpirationTime(), |
462 certs[0]->expiration_time()); | 462 certs[0]->expiration_time()); |
463 ASSERT_EQ(key_data, certs[0]->private_key()); | 463 ASSERT_EQ(key_data, certs[0]->private_key()); |
464 ASSERT_EQ(cert_data, certs[0]->cert()); | 464 ASSERT_EQ(cert_data, certs[0]->cert()); |
465 | 465 |
466 store_ = NULL; | 466 store_ = NULL; |
467 // Make sure we wait until the destructor has run. | 467 // Make sure we wait until the destructor has run. |
468 base::RunLoop().RunUntilIdle(); | 468 base::RunLoop().RunUntilIdle(); |
469 } | 469 } |
OLD | NEW |