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

Unified Diff: chromeos/cert_loader.cc

Issue 20087002: Add migration from CaCert NSS nicknames to PEM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unittests depending on NetworkHandler and not on CertLoader. Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/cert_loader.h ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/cert_loader.cc
diff --git a/chromeos/cert_loader.cc b/chromeos/cert_loader.cc
index 776e95ea9a77f6264c384b31b06813705fd8417c..a31dcf7e18e9a2ca06855ef92e2146fb17a12e97 100644
--- a/chromeos/cert_loader.cc
+++ b/chromeos/cert_loader.cc
@@ -59,6 +59,7 @@ void CallOpenPersistentNSSDB() {
} // namespace
static CertLoader* g_cert_loader = NULL;
+
// static
void CertLoader::Initialize() {
CHECK(!g_cert_loader);
@@ -108,6 +109,11 @@ void CertLoader::SetCryptoTaskRunner(
MaybeRequestCertificates();
}
+void CertLoader::SetSlowTaskRunnerForTest(
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner) {
+ slow_task_runner_for_test_ = task_runner;
+}
+
CertLoader::~CertLoader() {
net::CertDatabase::GetInstance()->RemoveObserver(this);
if (LoginState::IsInitialized())
@@ -326,13 +332,16 @@ void CertLoader::StartLoadCertificates() {
net::CertificateList* cert_list = new net::CertificateList;
certificates_update_running_ = true;
certificates_update_required_ = false;
- base::WorkerPool::GetTaskRunner(true /* task_is_slow */)->
- PostTaskAndReply(
- FROM_HERE,
- base::Bind(LoadNSSCertificates, cert_list),
- base::Bind(&CertLoader::UpdateCertificates,
- update_certificates_factory_.GetWeakPtr(),
- base::Owned(cert_list)));
+
+ base::TaskRunner* task_runner = slow_task_runner_for_test_.get();
+ if (!task_runner)
+ task_runner = base::WorkerPool::GetTaskRunner(true /* task is slow */);
+ task_runner->PostTaskAndReply(
+ FROM_HERE,
+ base::Bind(LoadNSSCertificates, cert_list),
+ base::Bind(&CertLoader::UpdateCertificates,
+ update_certificates_factory_.GetWeakPtr(),
+ base::Owned(cert_list)));
}
void CertLoader::UpdateCertificates(net::CertificateList* cert_list) {
« no previous file with comments | « chromeos/cert_loader.h ('k') | chromeos/chromeos.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698