diff options
author | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 01:24:29 +0000 |
---|---|---|
committer | mattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 01:24:29 +0000 |
commit | 109bbf029bbcc9e8c2ab1ec77c6f0a0816290677 (patch) | |
tree | 7f4eb790ad10f2411e7ede05938b61dbecfe9ca2 /net/test | |
parent | 953d04a25a27bc6a81e4420b04d2b21c738db506 (diff) | |
download | chromium_src-109bbf029bbcc9e8c2ab1ec77c6f0a0816290677.zip chromium_src-109bbf029bbcc9e8c2ab1ec77c6f0a0816290677.tar.gz chromium_src-109bbf029bbcc9e8c2ab1ec77c6f0a0816290677.tar.bz2 |
Revert 154861 - Run safebrowsing_service_test through the net testserver code.
Allows us to use ephemeral ports.
Also run the testserver.py python process with -u to avoid buffering issues.
BUG=96459,119403
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10073033
TBR=mattm@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10905087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@154875 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/test')
-rw-r--r-- | net/test/base_test_server.cc | 6 | ||||
-rw-r--r-- | net/test/base_test_server.h | 8 | ||||
-rw-r--r-- | net/test/local_sync_test_server.cc | 3 | ||||
-rw-r--r-- | net/test/local_test_server.cc | 27 | ||||
-rw-r--r-- | net/test/local_test_server.h | 20 | ||||
-rw-r--r-- | net/test/local_test_server_posix.cc | 3 | ||||
-rw-r--r-- | net/test/local_test_server_win.cc | 5 |
7 files changed, 11 insertions, 61 deletions
diff --git a/net/test/base_test_server.cc b/net/test/base_test_server.cc index 8df64c4..a4d1ff9 100644 --- a/net/test/base_test_server.cc +++ b/net/test/base_test_server.cc @@ -392,12 +392,6 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { base::Value::CreateIntegerValue(ssl_options_.tls_intolerant)); } } - - return GenerateAdditionalArguments(arguments); -} - -bool BaseTestServer::GenerateAdditionalArguments( - base::DictionaryValue* arguments) const { return true; } diff --git a/net/test/base_test_server.h b/net/test/base_test_server.h index 672b44d..cd996cb 100644 --- a/net/test/base_test_server.h +++ b/net/test/base_test_server.h @@ -206,13 +206,7 @@ class BaseTestServer { // Generates a DictionaryValue with the arguments for launching the external // Python test server. - bool GenerateArguments(base::DictionaryValue* arguments) const - WARN_UNUSED_RESULT; - - // Subclasses can override this to add arguments that are specific to their - // own test servers. - virtual bool GenerateAdditionalArguments( - base::DictionaryValue* arguments) const WARN_UNUSED_RESULT; + bool GenerateArguments(base::DictionaryValue* arguments) const; private: void Init(const std::string& host); diff --git a/net/test/local_sync_test_server.cc b/net/test/local_sync_test_server.cc index 432fde1..8d757f8 100644 --- a/net/test/local_sync_test_server.cc +++ b/net/test/local_sync_test_server.cc @@ -29,8 +29,7 @@ LocalSyncTestServer::~LocalSyncTestServer() {} bool LocalSyncTestServer::AddCommandLineArguments( CommandLine* command_line) const { - if (!LocalTestServer::AddCommandLineArguments(command_line)) - return false; + LocalTestServer::AddCommandLineArguments(command_line); if (xmpp_port_ != 0) { std::string xmpp_port_str = base::IntToString(xmpp_port_); command_line->AppendArg("--xmpp-port=" + xmpp_port_str); diff --git a/net/test/local_test_server.cc b/net/test/local_test_server.cc index 4768f36..a1a1bc8 100644 --- a/net/test/local_test_server.cc +++ b/net/test/local_test_server.cc @@ -94,19 +94,13 @@ bool LocalTestServer::GetTestServerDirectory(FilePath* directory) { return true; } -bool LocalTestServer::GetTestServerPath(FilePath* testserver_path) const { - if (!GetTestServerDirectory(testserver_path)) - return false; - *testserver_path = testserver_path->Append(FILE_PATH_LITERAL( - "testserver.py")); - return true; -} - bool LocalTestServer::Start() { // Get path to Python server script. FilePath testserver_path; - if (!GetTestServerPath(&testserver_path)) + if (!GetTestServerDirectory(&testserver_path)) return false; + testserver_path = + testserver_path.Append(FILE_PATH_LITERAL("testserver.py")); if (!SetPythonPath()) return false; @@ -165,12 +159,8 @@ bool LocalTestServer::Init(const FilePath& document_root) { return true; } -bool LocalTestServer::SetPythonPath() const { - return SetPythonPathStatic(); -} - // static -bool LocalTestServer::SetPythonPathStatic() { +bool LocalTestServer::SetPythonPath() { FilePath third_party_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &third_party_dir)) { LOG(ERROR) << "Failed to get DIR_SOURCE_ROOT"; @@ -265,13 +255,4 @@ bool LocalTestServer::AddCommandLineArguments(CommandLine* command_line) const { return true; } -void LocalTestServer::AddPythonArguments(const FilePath& testserver_path, - CommandLine* command_line) const { - // Make python stdout and stderr unbuffered, to prevent incomplete stderr on - // win bots, and also fix mixed up ordering of stdout and stderr. - command_line->AppendSwitch("-u"); - - command_line->AppendArgPath(testserver_path); -} - } // namespace net diff --git a/net/test/local_test_server.h b/net/test/local_test_server.h index bf2579c..2663668 100644 --- a/net/test/local_test_server.h +++ b/net/test/local_test_server.h @@ -43,26 +43,15 @@ class LocalTestServer : public BaseTestServer { bool Stop(); // Modify PYTHONPATH to contain libraries we need. - virtual bool SetPythonPath() const WARN_UNUSED_RESULT; - - // This is a static version so that RunSyncTest in run_testserver.py can use - // it. - // TODO(mattm): We should refactor that so this isn't necessary. - static bool SetPythonPathStatic() WARN_UNUSED_RESULT; + static bool SetPythonPath() WARN_UNUSED_RESULT; // Returns true if successfully stored the FilePath for the directory of the // testserver python script in |*directory|. static bool GetTestServerDirectory(FilePath* directory) WARN_UNUSED_RESULT; - // Returns true if successfully stored the FilePath for the testserver python - // script in |*testserver_path|. - virtual bool GetTestServerPath(FilePath* testserver_path) const - WARN_UNUSED_RESULT; - // Adds the command line arguments for the Python test server to // |command_line|. Returns true on success. - virtual bool AddCommandLineArguments(CommandLine* command_line) const - WARN_UNUSED_RESULT; + virtual bool AddCommandLineArguments(CommandLine* command_line) const; private: bool Init(const FilePath& document_root); @@ -73,11 +62,6 @@ class LocalTestServer : public BaseTestServer { // Waits for the server to start. Returns true on success. bool WaitToStart() WARN_UNUSED_RESULT; - // Adds the Python command line arguments and test server path to - // |command_line|. - void AddPythonArguments(const FilePath& testserver_path, - CommandLine* command_line) const; - // Handle of the Python process running the test server. base::ProcessHandle process_handle_; diff --git a/net/test/local_test_server_posix.cc b/net/test/local_test_server_posix.cc index f9b0f9e8..7afd422 100644 --- a/net/test/local_test_server_posix.cc +++ b/net/test/local_test_server_posix.cc @@ -101,8 +101,7 @@ bool LocalTestServer::LaunchPython(const FilePath& testserver_path) { getenv(kPythonPathEnv); CommandLine python_command(FilePath(FILE_PATH_LITERAL("python"))); - AddPythonArguments(testserver_path, &python_command); - + python_command.AppendArgPath(testserver_path); if (!AddCommandLineArguments(&python_command)) return false; diff --git a/net/test/local_test_server_win.cc b/net/test/local_test_server_win.cc index 504f7d5..0b30312 100644 --- a/net/test/local_test_server_win.cc +++ b/net/test/local_test_server_win.cc @@ -94,9 +94,7 @@ bool LocalTestServer::LaunchPython(const FilePath& testserver_path) { .Append(FILE_PATH_LITERAL("python.exe")); CommandLine python_command(python_exe); - - AddPythonArguments(testserver_path, &python_command); - + python_command.AppendArgPath(testserver_path); if (!AddCommandLineArguments(&python_command)) return false; @@ -178,3 +176,4 @@ bool LocalTestServer::WaitToStart() { } } // namespace net + |