summaryrefslogtreecommitdiffstats
path: root/net/tools
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 05:13:30 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-15 05:13:30 +0000
commit6e289c7216e44f42496a0e05b457c5c5ca24e8d5 (patch)
tree6b3687329189a6d9e1af1a5db92af91537c71e8a /net/tools
parent4a63af5b5aefe6e4b7601b78ad288e969f4fedbe (diff)
downloadchromium_src-6e289c7216e44f42496a0e05b457c5c5ca24e8d5.zip
chromium_src-6e289c7216e44f42496a0e05b457c5c5ca24e8d5.tar.gz
chromium_src-6e289c7216e44f42496a0e05b457c5c5ca24e8d5.tar.bz2
Add "run_testserver --sync-test" for easy chromiumsync_test.py launching.
BUG=none TEST=type that command. see tests run. Review URL: https://chromiumcodereview.appspot.com/9545019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools')
-rw-r--r--net/tools/testserver/run_testserver.cc34
1 files changed, 34 insertions, 0 deletions
diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc
index 51b9aac..f00f9f2 100644
--- a/net/tools/testserver/run_testserver.cc
+++ b/net/tools/testserver/run_testserver.cc
@@ -9,8 +9,10 @@
#include "base/file_path.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/process_util.h"
#include "base/test/test_timeouts.h"
#include "base/utf_string_conversions.h"
+#include "net/test/python_utils.h"
#include "net/test/test_server.h"
static void PrintUsage() {
@@ -19,6 +21,36 @@ static void PrintUsage() {
printf("(NOTE: relpath should be relative to the 'src' directory)\n");
}
+// Launches the chromiumsync_test script, testing the --sync functionality.
+static bool RunSyncTest() {
+ if (!net::TestServer::SetPythonPath()) {
+ LOG(ERROR) << "Error trying to set python path. Exiting.";
+ return false;
+ }
+
+ FilePath sync_test_path;
+ if (!net::TestServer::GetTestServerDirectory(&sync_test_path)) {
+ LOG(ERROR) << "Error trying to get python test server path.";
+ return false;
+ }
+
+ sync_test_path =
+ sync_test_path.Append(FILE_PATH_LITERAL("chromiumsync_test.py"));
+ FilePath python_runtime;
+ if (!GetPythonRunTime(&python_runtime)) {
+ LOG(ERROR) << "Could not get python runtime command.";
+ return false;
+ }
+
+ CommandLine python_command(python_runtime);
+ python_command.AppendArgPath(sync_test_path);
+ if (!base::LaunchProcess(python_command, base::LaunchOptions(), NULL)) {
+ LOG(ERROR) << "Failed to launch test script.";
+ return false;
+ }
+ return true;
+}
+
int main(int argc, const char* argv[]) {
base::AtExitManager at_exit_manager;
MessageLoopForIO message_loop;
@@ -51,6 +83,8 @@ int main(int argc, const char* argv[]) {
server_type = net::TestServer::TYPE_FTP;
} else if (command_line->HasSwitch("sync")) {
server_type = net::TestServer::TYPE_SYNC;
+ } else if (command_line->HasSwitch("sync-test")) {
+ return RunSyncTest() ? 0 : -1;
}
net::TestServer::HTTPSOptions https_options;