| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_impl.h" | 5 #include "net/proxy/proxy_script_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 return GURL(base_url.spec() + "/" + relpath); | 69 return GURL(base_url.spec() + "/" + relpath); |
| 70 } | 70 } |
| 71 | 71 |
| 72 class ProxyScriptFetcherImplTest : public PlatformTest { | 72 class ProxyScriptFetcherImplTest : public PlatformTest { |
| 73 public: | 73 public: |
| 74 ProxyScriptFetcherImplTest() | 74 ProxyScriptFetcherImplTest() |
| 75 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)) { | 75 : test_server_(net::TestServer::TYPE_HTTP, FilePath(kDocRoot)) { |
| 76 } | 76 } |
| 77 | 77 |
| 78 static void SetUpTestCase() { | 78 static void SetUpTestCase() { |
| 79 URLRequest::AllowFileAccess(); | 79 net::URLRequest::AllowFileAccess(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 net::TestServer test_server_; | 83 net::TestServer test_server_; |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 TEST_F(ProxyScriptFetcherImplTest, FileUrl) { | 86 TEST_F(ProxyScriptFetcherImplTest, FileUrl) { |
| 87 scoped_refptr<URLRequestContext> context(new RequestContext); | 87 scoped_refptr<URLRequestContext> context(new RequestContext); |
| 88 ProxyScriptFetcherImpl pac_fetcher(context); | 88 ProxyScriptFetcherImpl pac_fetcher(context); |
| 89 | 89 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 string16 text; | 322 string16 text; |
| 323 TestCompletionCallback callback; | 323 TestCompletionCallback callback; |
| 324 int result = pac_fetcher.Fetch(url, &text, &callback); | 324 int result = pac_fetcher.Fetch(url, &text, &callback); |
| 325 EXPECT_EQ(ERR_IO_PENDING, result); | 325 EXPECT_EQ(ERR_IO_PENDING, result); |
| 326 EXPECT_EQ(OK, callback.WaitForResult()); | 326 EXPECT_EQ(OK, callback.WaitForResult()); |
| 327 EXPECT_EQ(ASCIIToUTF16("This was encoded as UTF-16BE.\n"), text); | 327 EXPECT_EQ(ASCIIToUTF16("This was encoded as UTF-16BE.\n"), text); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace net | 331 } // namespace net |
| OLD | NEW |