Index: net/proxy/proxy_script_fetcher_impl_unittest.cc |
=================================================================== |
--- net/proxy/proxy_script_fetcher_impl_unittest.cc (revision 89633) |
+++ net/proxy/proxy_script_fetcher_impl_unittest.cc (working copy) |
@@ -11,6 +11,7 @@ |
#include "base/path_service.h" |
#include "base/utf_string_conversions.h" |
#include "net/base/net_util.h" |
+#include "net/base/load_flags.h" |
#include "net/base/ssl_config_service_defaults.h" |
#include "net/base/test_completion_callback.h" |
#include "net/disk_cache/disk_cache.h" |
@@ -18,6 +19,7 @@ |
#include "net/http/http_network_session.h" |
#include "net/test/test_server.h" |
#include "net/url_request/url_request_context_storage.h" |
+#include "net/url_request/url_request_job_factory.h" |
#include "net/url_request/url_request_test_util.h" |
#include "testing/gtest/include/gtest/gtest.h" |
#include "testing/platform_test.h" |
@@ -38,6 +40,26 @@ |
string16 text; |
}; |
+// CheckNoRevocationFlagSetInterceptor causes a test failure if a request is |
+// seen that doesn't set a load flag to bypass revocation checking. |
+class CheckNoRevocationFlagSetInterceptor : |
+ public URLRequestJobFactory::Interceptor { |
+ public: |
+ virtual URLRequestJob* MaybeIntercept(URLRequest* request) const OVERRIDE { |
+ EXPECT_TRUE(request->load_flags() & LOAD_DISABLE_CERT_REVOCATION_CHECKING); |
+ return NULL; |
+ } |
+ |
+ virtual URLRequestJob* MaybeInterceptRedirect(const GURL& location, |
+ URLRequest* request) const { |
+ return NULL; |
+ } |
+ |
+ virtual URLRequestJob* MaybeInterceptResponse(URLRequest* request) const { |
+ return NULL; |
+ } |
+}; |
+ |
// A non-mock URL request which can access http:// and file:// urls. |
class RequestContext : public URLRequestContext { |
public: |
@@ -61,6 +83,10 @@ |
storage_.set_http_transaction_factory(new HttpCache( |
network_session, |
HttpCache::DefaultBackend::InMemory(0))); |
+ url_request_job_factory_.reset(new URLRequestJobFactory); |
+ set_job_factory(url_request_job_factory_.get()); |
+ url_request_job_factory_->AddInterceptor( |
+ new CheckNoRevocationFlagSetInterceptor); |
} |
private: |
@@ -68,6 +94,7 @@ |
} |
URLRequestContextStorage storage_; |
+ scoped_ptr<URLRequestJobFactory> url_request_job_factory_; |
}; |
// Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. |