diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-08 20:40:15 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-08 20:40:15 +0000 |
commit | 6cdfd7f74ebadbe6fd2f557039b8b94242dd714e (patch) | |
tree | 39125d76f2a25515427dd53a81265d73bbb8ed18 /net/test | |
parent | 81aee95aa6bcb433e4bc26212ea3341edf839bdb (diff) | |
download | chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.zip chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.tar.gz chromium_src-6cdfd7f74ebadbe6fd2f557039b8b94242dd714e.tar.bz2 |
Replace FilePath with base::FilePath in net.
Review URL: https://codereview.chromium.org/12218081
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/test')
-rw-r--r-- | net/test/base_test_server.cc | 26 | ||||
-rw-r--r-- | net/test/base_test_server.h | 14 | ||||
-rw-r--r-- | net/test/local_test_server.cc | 18 | ||||
-rw-r--r-- | net/test/local_test_server.h | 14 | ||||
-rw-r--r-- | net/test/local_test_server_posix.cc | 2 | ||||
-rw-r--r-- | net/test/local_test_server_win.cc | 2 | ||||
-rw-r--r-- | net/test/python_utils.cc | 24 | ||||
-rw-r--r-- | net/test/python_utils_unittest.cc | 8 | ||||
-rw-r--r-- | net/test/remote_test_server.cc | 18 | ||||
-rw-r--r-- | net/test/remote_test_server.h | 8 |
10 files changed, 67 insertions, 67 deletions
diff --git a/net/test/base_test_server.cc b/net/test/base_test_server.cc index 7cd2469..5babc9f 100644 --- a/net/test/base_test_server.cc +++ b/net/test/base_test_server.cc @@ -71,23 +71,23 @@ BaseTestServer::SSLOptions::SSLOptions( BaseTestServer::SSLOptions::~SSLOptions() {} -FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { +base::FilePath BaseTestServer::SSLOptions::GetCertificateFile() const { switch (server_certificate) { case CERT_OK: case CERT_MISMATCHED_NAME: - return FilePath(FILE_PATH_LITERAL("ok_cert.pem")); + return base::FilePath(FILE_PATH_LITERAL("ok_cert.pem")); case CERT_EXPIRED: - return FilePath(FILE_PATH_LITERAL("expired_cert.pem")); + return base::FilePath(FILE_PATH_LITERAL("expired_cert.pem")); case CERT_CHAIN_WRONG_ROOT: // This chain uses its own dedicated test root certificate to avoid // side-effects that may affect testing. - return FilePath(FILE_PATH_LITERAL("redundant-server-chain.pem")); + return base::FilePath(FILE_PATH_LITERAL("redundant-server-chain.pem")); case CERT_AUTO: - return FilePath(); + return base::FilePath(); default: NOTREACHED(); } - return FilePath(); + return base::FilePath(); } std::string BaseTestServer::SSLOptions::GetOCSPArgument() const { @@ -247,8 +247,8 @@ void BaseTestServer::Init(const std::string& host) { log_to_console_ = true; } -void BaseTestServer::SetResourcePath(const FilePath& document_root, - const FilePath& certificates_dir) { +void BaseTestServer::SetResourcePath(const base::FilePath& document_root, + const base::FilePath& certificates_dir) { // This method shouldn't get called twice. DCHECK(certificates_dir_.empty()); document_root_ = document_root; @@ -287,9 +287,9 @@ bool BaseTestServer::LoadTestRootCert() const { return false; // Should always use absolute path to load the root certificate. - FilePath root_certificate_path = certificates_dir_; + base::FilePath root_certificate_path = certificates_dir_; if (!certificates_dir_.IsAbsolute()) { - FilePath src_dir; + base::FilePath src_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)) return false; root_certificate_path = src_dir.Append(certificates_dir_); @@ -335,8 +335,8 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { if (UsingSSL(type_)) { // Check the certificate arguments of the HTTPS server. - FilePath certificate_path(certificates_dir_); - FilePath certificate_file(ssl_options_.GetCertificateFile()); + base::FilePath certificate_path(certificates_dir_); + base::FilePath certificate_file(ssl_options_.GetCertificateFile()); if (!certificate_file.value().empty()) { certificate_path = certificate_path.Append(certificate_file); if (certificate_path.IsAbsolute() && @@ -353,7 +353,7 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { arguments->Set("ssl-client-auth", base::Value::CreateNullValue()); scoped_ptr<base::ListValue> ssl_client_certs(new base::ListValue()); - std::vector<FilePath>::const_iterator it; + std::vector<base::FilePath>::const_iterator it; for (it = ssl_options_.client_authorities.begin(); it != ssl_options_.client_authorities.end(); ++it) { if (it->IsAbsolute() && !file_util::PathExists(*it)) { diff --git a/net/test/base_test_server.h b/net/test/base_test_server.h index 973bfb1..de4fe1d 100644 --- a/net/test/base_test_server.h +++ b/net/test/base_test_server.h @@ -107,7 +107,7 @@ class BaseTestServer { // Returns the relative filename of the file that contains the // |server_certificate|. - FilePath GetCertificateFile() const; + base::FilePath GetCertificateFile() const; // GetOCSPArgument returns the value of any OCSP argument to testserver or // the empty string if there is none. @@ -128,7 +128,7 @@ class BaseTestServer { // each containing a single, PEM-encoded X.509 certificates. The subject // from each certificate will be added to the certificate_authorities // field of the CertificateRequest. - std::vector<FilePath> client_authorities; + std::vector<base::FilePath> client_authorities; // A bitwise-OR of BulkCipher that should be used by the // HTTPS server, or BULK_CIPHER_ANY to indicate that all implemented @@ -158,7 +158,7 @@ class BaseTestServer { // if the server is started. const HostPortPair& host_port_pair() const; - const FilePath& document_root() const { return document_root_; } + const base::FilePath& document_root() const { return document_root_; } const base::DictionaryValue& server_data() const; std::string GetScheme() const; bool GetAddressList(AddressList* address_list) const WARN_UNUSED_RESULT; @@ -200,8 +200,8 @@ class BaseTestServer { void CleanUpWhenStoppingServer(); // Set path of test resources. - void SetResourcePath(const FilePath& document_root, - const FilePath& certificates_dir); + void SetResourcePath(const base::FilePath& document_root, + const base::FilePath& certificates_dir); // Parses the server data read from the test server. Returns true // on success. @@ -225,10 +225,10 @@ class BaseTestServer { bool LoadTestRootCert() const WARN_UNUSED_RESULT; // Document root of the test server. - FilePath document_root_; + base::FilePath document_root_; // Directory that contains the SSL certificates. - FilePath certificates_dir_; + base::FilePath certificates_dir_; // Address the test server listens on. HostPortPair host_port_pair_; diff --git a/net/test/local_test_server.cc b/net/test/local_test_server.cc index a24d6bb..e2d334f 100644 --- a/net/test/local_test_server.cc +++ b/net/test/local_test_server.cc @@ -59,7 +59,7 @@ bool AppendArgumentFromJSONValue(const std::string& key, LocalTestServer::LocalTestServer(Type type, const std::string& host, - const FilePath& document_root) + const base::FilePath& document_root) : BaseTestServer(type, host) { if (!Init(document_root)) NOTREACHED(); @@ -67,7 +67,7 @@ LocalTestServer::LocalTestServer(Type type, LocalTestServer::LocalTestServer(Type type, const SSLOptions& ssl_options, - const FilePath& document_root) + const base::FilePath& document_root) : BaseTestServer(type, ssl_options) { if (!Init(document_root)) NOTREACHED(); @@ -77,8 +77,8 @@ LocalTestServer::~LocalTestServer() { Stop(); } -bool LocalTestServer::GetTestServerPath(FilePath* testserver_path) const { - FilePath testserver_dir; +bool LocalTestServer::GetTestServerPath(base::FilePath* testserver_path) const { + base::FilePath testserver_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &testserver_dir)) { LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; return false; @@ -96,7 +96,7 @@ bool LocalTestServer::Start() { bool LocalTestServer::StartInBackground() { // Get path to Python server script. - FilePath testserver_path; + base::FilePath testserver_path; if (!GetTestServerPath(&testserver_path)) return false; @@ -139,7 +139,7 @@ bool LocalTestServer::Stop() { return ret; } -bool LocalTestServer::Init(const FilePath& document_root) { +bool LocalTestServer::Init(const base::FilePath& document_root) { if (document_root.IsAbsolute()) return false; @@ -150,7 +150,7 @@ bool LocalTestServer::Init(const FilePath& document_root) { DCHECK(!GetPort()); process_handle_ = base::kNullProcessHandle; - FilePath src_dir; + base::FilePath src_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)) return false; SetResourcePath(src_dir.Append(document_root), @@ -162,7 +162,7 @@ bool LocalTestServer::Init(const FilePath& document_root) { } bool LocalTestServer::SetPythonPath() const { - FilePath third_party_dir; + base::FilePath third_party_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)) { LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; return false; @@ -181,7 +181,7 @@ bool LocalTestServer::SetPythonPath() const { third_party_dir.AppendASCII("pywebsocket").AppendASCII("src")); // Locate the Python code generated by the protocol buffers compiler. - FilePath pyproto_dir; + base::FilePath pyproto_dir; if (!GetPyProtoPath(&pyproto_dir)) { LOG(WARNING) << "Cannot find pyproto dir for generated code. " << "Testserver features that rely on it will not work"; diff --git a/net/test/local_test_server.h b/net/test/local_test_server.h index 14b291d..fcc7ebf 100644 --- a/net/test/local_test_server.h +++ b/net/test/local_test_server.h @@ -27,13 +27,13 @@ class LocalTestServer : public BaseTestServer { // |document_root| must be a relative path under the root tree. LocalTestServer(Type type, const std::string& host, - const FilePath& document_root); + const base::FilePath& document_root); // Initialize a TestServer with a specific set of SSLOptions. // |document_root| must be a relative path under the root tree. LocalTestServer(Type type, const SSLOptions& ssl_options, - const FilePath& document_root); + const base::FilePath& document_root); virtual ~LocalTestServer(); @@ -66,9 +66,9 @@ class LocalTestServer : public BaseTestServer { // Modify PYTHONPATH to contain libraries we need. virtual bool SetPythonPath() const WARN_UNUSED_RESULT; - // Returns true if the FilePath for the testserver python script is + // Returns true if the base::FilePath for the testserver python script is // successfully stored in |*testserver_path|. - virtual bool GetTestServerPath(FilePath* testserver_path) const + virtual bool GetTestServerPath(base::FilePath* testserver_path) const WARN_UNUSED_RESULT; // Adds the command line arguments for the Python test server to @@ -78,13 +78,13 @@ class LocalTestServer : public BaseTestServer { // Returns the actual path of document root for test cases. This function // should be called by test cases to retrieve the actual document root path. - FilePath GetDocumentRoot() const { return document_root(); }; + base::FilePath GetDocumentRoot() const { return document_root(); }; private: - bool Init(const FilePath& document_root); + bool Init(const base::FilePath& document_root); // Launches the Python test server. Returns true on success. - bool LaunchPython(const FilePath& testserver_path) WARN_UNUSED_RESULT; + bool LaunchPython(const base::FilePath& testserver_path) WARN_UNUSED_RESULT; // Waits for the server to start. Returns true on success. bool WaitToStart() WARN_UNUSED_RESULT; diff --git a/net/test/local_test_server_posix.cc b/net/test/local_test_server_posix.cc index 760a915..48af349 100644 --- a/net/test/local_test_server_posix.cc +++ b/net/test/local_test_server_posix.cc @@ -98,7 +98,7 @@ bool ReadData(int fd, ssize_t bytes_max, uint8* buffer, namespace net { -bool LocalTestServer::LaunchPython(const FilePath& testserver_path) { +bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) { // Log is useful in the event you want to run a nearby script (e.g. a test) in // the same environment as the TestServer. VLOG(1) << "LaunchPython called with PYTHONPATH = " << getenv(kPythonPathEnv); diff --git a/net/test/local_test_server_win.cc b/net/test/local_test_server_win.cc index ba2a8cd..9562360 100644 --- a/net/test/local_test_server_win.cc +++ b/net/test/local_test_server_win.cc @@ -85,7 +85,7 @@ bool ReadData(HANDLE read_fd, HANDLE write_fd, namespace net { -bool LocalTestServer::LaunchPython(const FilePath& testserver_path) { +bool LocalTestServer::LaunchPython(const base::FilePath& testserver_path) { CommandLine python_command(CommandLine::NO_PROGRAM); if (!GetPythonCommand(&python_command)) return false; diff --git a/net/test/python_utils.cc b/net/test/python_utils.cc index be9facf..349a360 100644 --- a/net/test/python_utils.cc +++ b/net/test/python_utils.cc @@ -16,7 +16,7 @@ const char kPythonPathEnv[] = "PYTHONPATH"; -void AppendToPythonPath(const FilePath& dir) { +void AppendToPythonPath(const base::FilePath& dir) { scoped_ptr<base::Environment> env(base::Environment::Create()); std::string old_path; std::string dir_path; @@ -44,12 +44,12 @@ namespace { // Search for |to_try|, rolling up the directory tree from // |start_dir|. If found, return true and put the path to |to_try| in // |out_dir|. If not, return false and leave |out_dir| untouched. -bool TryRelativeToDir(const FilePath& start_dir, - const FilePath& to_try, - FilePath* out_dir) { - FilePath dir(start_dir); +bool TryRelativeToDir(const base::FilePath& start_dir, + const base::FilePath& to_try, + base::FilePath* out_dir) { + base::FilePath dir(start_dir); while (!file_util::DirectoryExists(dir.Append(to_try))) { - FilePath parent = dir.DirName(); + base::FilePath parent = dir.DirName(); if (parent == dir) { // We hit the root directory. return false; @@ -62,18 +62,18 @@ bool TryRelativeToDir(const FilePath& start_dir, } // namespace -bool GetPyProtoPath(FilePath* dir) { +bool GetPyProtoPath(base::FilePath* dir) { // Locate the Python code generated by the protocol buffers compiler. - FilePath generated_code_dir; + base::FilePath generated_code_dir; if (!PathService::Get(base::DIR_EXE, &generated_code_dir)) { LOG(ERROR) << "Can't find " << generated_code_dir.value(); return false; } - const FilePath kPyProto(FILE_PATH_LITERAL("pyproto")); + const base::FilePath kPyProto(FILE_PATH_LITERAL("pyproto")); #if defined(OS_MACOSX) || defined(OS_CHROMEOS) - FilePath source_dir; + base::FilePath source_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_dir)) { LOG(ERROR) << "Can't find " << source_dir.value(); return false; @@ -106,7 +106,7 @@ bool GetPyProtoPath(FilePath* dir) { bool GetPythonCommand(CommandLine* python_cmd) { DCHECK(python_cmd); - FilePath dir; + base::FilePath dir; #if defined(OS_WIN) if (!PathService::Get(base::DIR_SOURCE_ROOT, &dir)) return false; @@ -114,7 +114,7 @@ bool GetPythonCommand(CommandLine* python_cmd) { .Append(FILE_PATH_LITERAL("python_26")) .Append(FILE_PATH_LITERAL("python.exe")); #elif defined(OS_POSIX) - dir = FilePath("python"); + dir = base::FilePath("python"); #endif python_cmd->SetProgram(dir); diff --git a/net/test/python_utils_unittest.cc b/net/test/python_utils_unittest.cc index f81a440..1c7a3c3 100644 --- a/net/test/python_utils_unittest.cc +++ b/net/test/python_utils_unittest.cc @@ -15,16 +15,16 @@ #include "testing/gtest/include/gtest/gtest.h" TEST(PythonUtils, Append) { - const FilePath::CharType kAppendDir1[] = + const base::FilePath::CharType kAppendDir1[] = FILE_PATH_LITERAL("test/path_append1"); - const FilePath::CharType kAppendDir2[] = + const base::FilePath::CharType kAppendDir2[] = FILE_PATH_LITERAL("test/path_append2"); scoped_ptr<base::Environment> env(base::Environment::Create()); std::string python_path; - FilePath append_path1(kAppendDir1); - FilePath append_path2(kAppendDir2); + base::FilePath append_path1(kAppendDir1); + base::FilePath append_path2(kAppendDir2); // Get a clean start env->UnSetVar(kPythonPathEnv); diff --git a/net/test/remote_test_server.cc b/net/test/remote_test_server.cc index 3421fa5..a4eab05 100644 --- a/net/test/remote_test_server.cc +++ b/net/test/remote_test_server.cc @@ -31,11 +31,11 @@ namespace { // to a single testing device. // The mapping between the test server spawner and the individual Python test // servers is written to a file on the device prior to executing any tests. -FilePath GetTestServerPortInfoFile() { +base::FilePath GetTestServerPortInfoFile() { #if !defined(OS_ANDROID) - return FilePath("/tmp/net-test-server-ports"); + return base::FilePath("/tmp/net-test-server-ports"); #else - FilePath test_data_dir; + base::FilePath test_data_dir; PathService::Get(base::DIR_ANDROID_EXTERNAL_STORAGE, &test_data_dir); return test_data_dir.Append("net-test-server-ports"); #endif @@ -66,7 +66,7 @@ std::string GetServerTypeString(BaseTestServer::Type type) { RemoteTestServer::RemoteTestServer(Type type, const std::string& host, - const FilePath& document_root) + const base::FilePath& document_root) : BaseTestServer(type, host), spawner_server_port_(0) { if (!Init(document_root)) @@ -75,7 +75,7 @@ RemoteTestServer::RemoteTestServer(Type type, RemoteTestServer::RemoteTestServer(Type type, const SSLOptions& ssl_options, - const FilePath& document_root) + const base::FilePath& document_root) : BaseTestServer(type, ssl_options), spawner_server_port_(0) { if (!Init(document_root)) @@ -154,13 +154,13 @@ bool RemoteTestServer::Stop() { // root in the host machine where the test server is launched. So prepend // DIR_SOURCE_ROOT here to get the actual path of document root on the Android // device. -FilePath RemoteTestServer::GetDocumentRoot() const { - FilePath src_dir; +base::FilePath RemoteTestServer::GetDocumentRoot() const { + base::FilePath src_dir; PathService::Get(base::DIR_SOURCE_ROOT, &src_dir); return src_dir.Append(document_root()); } -bool RemoteTestServer::Init(const FilePath& document_root) { +bool RemoteTestServer::Init(const base::FilePath& document_root) { if (document_root.IsAbsolute()) return false; @@ -193,7 +193,7 @@ bool RemoteTestServer::Init(const FilePath& document_root) { return false; SetPort(test_server_port); - SetResourcePath(document_root, FilePath().AppendASCII("net") + SetResourcePath(document_root, base::FilePath().AppendASCII("net") .AppendASCII("data") .AppendASCII("ssl") .AppendASCII("certificates")); diff --git a/net/test/remote_test_server.h b/net/test/remote_test_server.h index 9c3fcfc..5d8e2b6 100644 --- a/net/test/remote_test_server.h +++ b/net/test/remote_test_server.h @@ -21,13 +21,13 @@ class RemoteTestServer : public BaseTestServer { // |document_root| must be a relative path under the root tree. RemoteTestServer(Type type, const std::string& host, - const FilePath& document_root); + const base::FilePath& document_root); // Initialize a TestServer with a specific set of SSLOptions. // |document_root| must be a relative path under the root tree. RemoteTestServer(Type type, const SSLOptions& ssl_options, - const FilePath& document_root); + const base::FilePath& document_root); virtual ~RemoteTestServer(); @@ -47,10 +47,10 @@ class RemoteTestServer : public BaseTestServer { // should be called by test cases to retrieve the actual document root path // on the Android device, otherwise document_root() function is used to get // the document root. - FilePath GetDocumentRoot() const; + base::FilePath GetDocumentRoot() const; private: - bool Init(const FilePath& document_root); + bool Init(const base::FilePath& document_root); // The local port used to communicate with the TestServer spawner. This is // used to control the startup and shutdown of the Python TestServer running |