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

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

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk 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
« no previous file with comments | « net/cert/nss_cert_database_unittest.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/cert/test_root_certs.h" 5 #include "net/cert/test_root_certs.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 29 matching lines...) Expand all
40 40
41 bool TestRootCerts::HasInstance() { 41 bool TestRootCerts::HasInstance() {
42 return g_has_instance; 42 return g_has_instance;
43 } 43 }
44 44
45 bool TestRootCerts::AddFromFile(const base::FilePath& file) { 45 bool TestRootCerts::AddFromFile(const base::FilePath& file) {
46 CertificateList root_certs = LoadCertificates(file); 46 CertificateList root_certs = LoadCertificates(file);
47 if (root_certs.empty() || root_certs.size() > 1) 47 if (root_certs.empty() || root_certs.size() > 1)
48 return false; 48 return false;
49 49
50 return Add(root_certs.front()); 50 return Add(root_certs.front().get());
51 } 51 }
52 52
53 TestRootCerts::TestRootCerts() { 53 TestRootCerts::TestRootCerts() {
54 Init(); 54 Init();
55 g_has_instance = true; 55 g_has_instance = true;
56 } 56 }
57 57
58 ScopedTestRoot::ScopedTestRoot() {} 58 ScopedTestRoot::ScopedTestRoot() {}
59 59
60 ScopedTestRoot::ScopedTestRoot(X509Certificate* cert) { 60 ScopedTestRoot::ScopedTestRoot(X509Certificate* cert) {
61 Reset(cert); 61 Reset(cert);
62 } 62 }
63 63
64 ScopedTestRoot::~ScopedTestRoot() { 64 ScopedTestRoot::~ScopedTestRoot() {
65 Reset(NULL); 65 Reset(NULL);
66 } 66 }
67 67
68 void ScopedTestRoot::Reset(X509Certificate* cert) { 68 void ScopedTestRoot::Reset(X509Certificate* cert) {
69 if (cert_) 69 if (cert_.get())
70 TestRootCerts::GetInstance()->Clear(); 70 TestRootCerts::GetInstance()->Clear();
71 if (cert) 71 if (cert)
72 TestRootCerts::GetInstance()->Add(cert); 72 TestRootCerts::GetInstance()->Add(cert);
73 cert_ = cert; 73 cert_ = cert;
74 } 74 }
75 75
76 } // namespace net 76 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/nss_cert_database_unittest.cc ('k') | net/cert/x509_certificate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698