Index: net/ocsp/nss_ocsp.cc |
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc |
index cabda31dd046c86ee5ce96dd1e7f2b28cae1673c..5412cba46a7a804beb80c130504cd5d1fc54b4f3 100644 |
--- a/net/ocsp/nss_ocsp.cc |
+++ b/net/ocsp/nss_ocsp.cc |
@@ -78,6 +78,20 @@ class OCSPIOLoop { |
void AddRequest(OCSPRequestSession* request); |
void RemoveRequest(OCSPRequestSession* request); |
+ // Clears internal state and calls |StartUsing()|. Should be called only in |
+ // the context of testing. |
+ void ReuseForTesting() { |
+ { |
+ base::AutoLock autolock(lock_); |
+ DCHECK(MessageLoopForIO::current()); |
+ thread_checker_.DetachFromThread(); |
+ thread_checker_.CalledOnValidThread(); |
Nico
2013/11/05 03:01:30
As is, this is a no-op. You probably meant to DCHE
blundell
2013/11/05 16:01:33
This call is not a no-op: it associates |thread_ch
Nico
2013/11/05 16:29:54
Aha! This seems to be only place in the codebase w
|
+ shutdown_ = false; |
+ used_ = false; |
+ } |
+ StartUsing(); |
+ } |
+ |
private: |
friend struct base::DefaultLazyInstanceTraits<OCSPIOLoop>; |
@@ -934,6 +948,10 @@ void ShutdownNSSHttpIO() { |
g_ocsp_io_loop.Get().Shutdown(); |
} |
+void ResetNSSHttpIOForTesting() { |
+ g_ocsp_io_loop.Get().ReuseForTesting(); |
+} |
+ |
// This function would be called before NSS initialization. |
void SetURLRequestContextForNSSHttpIO(URLRequestContext* request_context) { |
pthread_mutex_lock(&g_request_context_lock); |