OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/proxy/proxy_script_fetcher.h" | 5 #include "net/proxy/proxy_script_fetcher.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 template<> | 147 template<> |
148 void RunnableMethodTraits<SynchFetcher>::ReleaseCallee(SynchFetcher* remover) {} | 148 void RunnableMethodTraits<SynchFetcher>::ReleaseCallee(SynchFetcher* remover) {} |
149 | 149 |
150 // Required to be in net namespace by FRIEND_TEST. | 150 // Required to be in net namespace by FRIEND_TEST. |
151 namespace net { | 151 namespace net { |
152 | 152 |
153 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. | 153 // Get a file:// url relative to net/data/proxy/proxy_script_fetcher_unittest. |
154 GURL GetTestFileUrl(const std::string& relpath) { | 154 GURL GetTestFileUrl(const std::string& relpath) { |
155 FilePath path; | 155 FilePath path; |
156 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 156 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
157 path = path.Append(FILE_PATH_LITERAL("net")); | 157 path = path.AppendASCII("net"); |
158 path = path.Append(FILE_PATH_LITERAL("data")); | 158 path = path.AppendASCII("data"); |
159 path = path.Append(FILE_PATH_LITERAL("proxy_script_fetcher_unittest")); | 159 path = path.AppendASCII("proxy_script_fetcher_unittest"); |
160 GURL base_url = net::FilePathToFileURL(path); | 160 GURL base_url = net::FilePathToFileURL(path); |
161 return GURL(base_url.spec() + "/" + relpath); | 161 return GURL(base_url.spec() + "/" + relpath); |
162 } | 162 } |
163 | 163 |
164 typedef PlatformTest ProxyScriptFetcherTest; | 164 typedef PlatformTest ProxyScriptFetcherTest; |
165 | 165 |
166 TEST_F(ProxyScriptFetcherTest, FileUrl) { | 166 TEST_F(ProxyScriptFetcherTest, FileUrl) { |
167 SynchFetcher pac_fetcher; | 167 SynchFetcher pac_fetcher; |
168 | 168 |
169 { // Fetch a non-existent file. | 169 { // Fetch a non-existent file. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 { // Make sure we can still fetch regular URLs. | 299 { // Make sure we can still fetch regular URLs. |
300 GURL url = server->TestServerPage("files/pac.nsproxy"); | 300 GURL url = server->TestServerPage("files/pac.nsproxy"); |
301 FetchResult result = pac_fetcher.Fetch(url); | 301 FetchResult result = pac_fetcher.Fetch(url); |
302 EXPECT_EQ(net::OK, result.code); | 302 EXPECT_EQ(net::OK, result.code); |
303 EXPECT_EQ("-pac.nsproxy-\n", result.bytes); | 303 EXPECT_EQ("-pac.nsproxy-\n", result.bytes); |
304 } | 304 } |
305 } | 305 } |
306 | 306 |
307 } // namespace net | 307 } // namespace net |
OLD | NEW |