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

Side by Side Diff: net/cert/test_root_certs_android.cc

Issue 5535006: Add unittests for net::TestRootCerts and regenerate test certificates (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bump certs again, add script to auto-rengerate Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/cert/test_root_certs.h" 5 #include "net/cert/test_root_certs.h"
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/android/network_library.h" 9 #include "net/android/network_library.h"
10 #include "net/cert/x509_certificate.h" 10 #include "net/cert/x509_certificate.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 bool TestRootCerts::Add(X509Certificate* certificate) { 14 bool TestRootCerts::Add(X509Certificate* certificate) {
15 std::string cert_bytes; 15 std::string cert_bytes;
16 if (!X509Certificate::GetDEREncoded(certificate->os_cert_handle(), 16 if (!X509Certificate::GetDEREncoded(certificate->os_cert_handle(),
17 &cert_bytes)) 17 &cert_bytes))
18 return false; 18 return false;
19 android::AddTestRootCertificate( 19 android::AddTestRootCertificate(
20 reinterpret_cast<const uint8*>(cert_bytes.data()), cert_bytes.size()); 20 reinterpret_cast<const uint8*>(cert_bytes.data()), cert_bytes.size());
21 empty_ = false;
wtc 2013/06/18 22:51:45 This is a bug fix, right?
Ryan Sleevi 2013/06/18 23:57:59 Yes, picked up by the TestRootCerts test.
21 return true; 22 return true;
22 } 23 }
23 24
24 void TestRootCerts::Clear() { 25 void TestRootCerts::Clear() {
25 if (empty_) 26 if (empty_)
26 return; 27 return;
27 28
28 android::ClearTestRootCertificates(); 29 android::ClearTestRootCertificates();
29 empty_ = true; 30 empty_ = true;
30 } 31 }
31 32
32 bool TestRootCerts::IsEmpty() const { 33 bool TestRootCerts::IsEmpty() const {
33 return empty_; 34 return empty_;
34 } 35 }
35 36
36 TestRootCerts::~TestRootCerts() {} 37 TestRootCerts::~TestRootCerts() {}
37 38
38 void TestRootCerts::Init() { 39 void TestRootCerts::Init() {
39 empty_ = true; 40 empty_ = true;
40 } 41 }
41 42
42 } // namespace net 43 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698