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

Unified Diff: net/proxy/proxy_script_fetcher_impl_unittest.cc

Issue 7170026: net: don't check revocation when fetching PAC files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_script_fetcher_impl_unittest.cc
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index 98fbd5e5c19fb7e7956e4ffc80aca0f29118e7c7..f7bf5ef72f843215a6bfa674ef5447146f7823b3 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -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 @@ struct FetchResult {
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 @@ class RequestContext : public URLRequestContext {
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 @@ class RequestContext : public URLRequestContext {
}
URLRequestContextStorage storage_;
+ scoped_ptr<URLRequestJobFactory> url_request_job_factory_;
};
// Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest.
« no previous file with comments | « net/proxy/proxy_script_fetcher_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698