Index: net/proxy/proxy_script_fetcher_impl_unittest.cc |
=================================================================== |
--- net/proxy/proxy_script_fetcher_impl_unittest.cc (revision 268640) |
+++ net/proxy/proxy_script_fetcher_impl_unittest.cc (working copy) |
@@ -22,7 +22,6 @@ |
#include "net/http/transport_security_state.h" |
#include "net/ssl/ssl_config_service_defaults.h" |
#include "net/test/spawned_test_server/spawned_test_server.h" |
-#include "net/url_request/file_protocol_handler.h" |
#include "net/url_request/url_request_context_storage.h" |
#include "net/url_request/url_request_file_job.h" |
#include "net/url_request/url_request_job_factory_impl.h" |
@@ -30,6 +29,10 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "testing/platform_test.h" |
+#if !defined(DISABLE_FILE_SUPPORT) |
+#include "net/url_request/file_protocol_handler.h" |
+#endif |
+ |
using base::ASCIIToUTF16; |
namespace net { |
@@ -48,7 +51,8 @@ |
base::string16 text; |
}; |
-// A non-mock URL request which can access http:// and file:// urls. |
+// A non-mock URL request which can access http:// and file:// urls, in the case |
+// the tests were built with file support. |
class RequestContext : public URLRequestContext { |
public: |
RequestContext() : storage_(this) { |
@@ -73,8 +77,10 @@ |
storage_.set_http_transaction_factory(new HttpCache( |
network_session.get(), HttpCache::DefaultBackend::InMemory(0))); |
URLRequestJobFactoryImpl* job_factory = new URLRequestJobFactoryImpl(); |
+#if !defined(DISABLE_FILE_SUPPORT) |
job_factory->SetProtocolHandler( |
"file", new FileProtocolHandler(base::MessageLoopProxy::current())); |
+#endif |
storage_.set_job_factory(job_factory); |
} |
@@ -199,6 +205,7 @@ |
RequestContext context_; |
}; |
+#if !defined(DISABLE_FILE_SUPPORT) |
TEST_F(ProxyScriptFetcherImplTest, FileUrl) { |
ProxyScriptFetcherImpl pac_fetcher(&context_); |
@@ -221,6 +228,7 @@ |
EXPECT_EQ(ASCIIToUTF16("-pac.txt-\n"), text); |
} |
} |
+#endif // !defined(DISABLE_FILE_SUPPORT) |
// Note that all mime types are allowed for PAC file, to be consistent |
// with other browsers. |