| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 int SetPacScriptFromDisk(const char* filename) { | 110 int SetPacScriptFromDisk(const char* filename) { |
| 111 base::FilePath path; | 111 base::FilePath path; |
| 112 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 112 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 113 path = path.AppendASCII("net"); | 113 path = path.AppendASCII("net"); |
| 114 path = path.AppendASCII("data"); | 114 path = path.AppendASCII("data"); |
| 115 path = path.AppendASCII("proxy_resolver_v8_unittest"); | 115 path = path.AppendASCII("proxy_resolver_v8_unittest"); |
| 116 path = path.AppendASCII(filename); | 116 path = path.AppendASCII(filename); |
| 117 | 117 |
| 118 // Try to read the file from disk. | 118 // Try to read the file from disk. |
| 119 std::string file_contents; | 119 std::string file_contents; |
| 120 bool ok = file_util::ReadFileToString(path, &file_contents); | 120 bool ok = base::ReadFileToString(path, &file_contents); |
| 121 | 121 |
| 122 // If we can't load the file from disk, something is misconfigured. | 122 // If we can't load the file from disk, something is misconfigured. |
| 123 if (!ok) { | 123 if (!ok) { |
| 124 LOG(ERROR) << "Failed to read file: " << path.value(); | 124 LOG(ERROR) << "Failed to read file: " << path.value(); |
| 125 return ERR_UNEXPECTED; | 125 return ERR_UNEXPECTED; |
| 126 } | 126 } |
| 127 | 127 |
| 128 // Load the PAC script into the ProxyResolver. | 128 // Load the PAC script into the ProxyResolver. |
| 129 return SetPacScript(ProxyResolverScriptData::FromUTF8(file_contents), | 129 return SetPacScript(ProxyResolverScriptData::FromUTF8(file_contents), |
| 130 CompletionCallback()); | 130 CompletionCallback()); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 GURL("http://kittens/"), &proxy_info, | 622 GURL("http://kittens/"), &proxy_info, |
| 623 CompletionCallback(), NULL, BoundNetLog()); | 623 CompletionCallback(), NULL, BoundNetLog()); |
| 624 | 624 |
| 625 EXPECT_EQ(OK, result); | 625 EXPECT_EQ(OK, result); |
| 626 EXPECT_EQ(0u, bindings->errors.size()); | 626 EXPECT_EQ(0u, bindings->errors.size()); |
| 627 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); | 627 EXPECT_EQ("kittens:88", proxy_info.proxy_server().ToURI()); |
| 628 } | 628 } |
| 629 | 629 |
| 630 } // namespace | 630 } // namespace |
| 631 } // namespace net | 631 } // namespace net |
| OLD | NEW |