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

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

Issue 2175933002: More aggressive IO asserts in content_browsertests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use 1 less instance of ScopedAllowIO in DumpAccessibilityTestBase::RunTestForPlatform. Created 4 years, 4 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
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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/threading/thread_restrictions.h"
12 #include "net/cert/x509_certificate.h" 13 #include "net/cert/x509_certificate.h"
13 14
14 namespace net { 15 namespace net {
15 16
16 namespace { 17 namespace {
17 18
18 bool g_has_instance = false; 19 bool g_has_instance = false;
19 20
20 base::LazyInstance<TestRootCerts>::Leaky 21 base::LazyInstance<TestRootCerts>::Leaky
21 g_test_root_certs = LAZY_INSTANCE_INITIALIZER; 22 g_test_root_certs = LAZY_INSTANCE_INITIALIZER;
(...skipping 14 matching lines...) Expand all
36 // static 37 // static
37 TestRootCerts* TestRootCerts::GetInstance() { 38 TestRootCerts* TestRootCerts::GetInstance() {
38 return g_test_root_certs.Pointer(); 39 return g_test_root_certs.Pointer();
39 } 40 }
40 41
41 bool TestRootCerts::HasInstance() { 42 bool TestRootCerts::HasInstance() {
42 return g_has_instance; 43 return g_has_instance;
43 } 44 }
44 45
45 bool TestRootCerts::AddFromFile(const base::FilePath& file) { 46 bool TestRootCerts::AddFromFile(const base::FilePath& file) {
47 base::ThreadRestrictions::ScopedAllowIO allow_io_for_loading_test_certs;
46 CertificateList root_certs = LoadCertificates(file); 48 CertificateList root_certs = LoadCertificates(file);
47 if (root_certs.empty() || root_certs.size() > 1) 49 if (root_certs.empty() || root_certs.size() > 1)
48 return false; 50 return false;
49 51
50 return Add(root_certs.front().get()); 52 return Add(root_certs.front().get());
51 } 53 }
52 54
53 TestRootCerts::TestRootCerts() { 55 TestRootCerts::TestRootCerts() {
54 Init(); 56 Init();
55 g_has_instance = true; 57 g_has_instance = true;
(...skipping 11 matching lines...) Expand all
67 69
68 void ScopedTestRoot::Reset(X509Certificate* cert) { 70 void ScopedTestRoot::Reset(X509Certificate* cert) {
69 if (cert_.get()) 71 if (cert_.get())
70 TestRootCerts::GetInstance()->Clear(); 72 TestRootCerts::GetInstance()->Clear();
71 if (cert) 73 if (cert)
72 TestRootCerts::GetInstance()->Add(cert); 74 TestRootCerts::GetInstance()->Add(cert);
73 cert_ = cert; 75 cert_ = cert;
74 } 76 }
75 77
76 } // namespace net 78 } // namespace net
OLDNEW
« no previous file with comments | « content/test/webui_resource_browsertest.cc ('k') | net/test/embedded_test_server/embedded_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698