Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Unified Diff: net/tools/testserver/run_testserver.cc

Issue 9545019: Add "run_testserver --sync-test" for easy chromiumsync_test.py launching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: retreat to run_testserver Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/test/test_server_posix.cc ('K') | « net/test/test_server_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/testserver/run_testserver.cc
diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc
index 51b9aac0c69c8d3b0ff993f75b9e702eaf4ec9de..509e048ec718bca110eefdd50fa27677bc874e6f 100644
--- a/net/tools/testserver/run_testserver.cc
+++ b/net/tools/testserver/run_testserver.cc
@@ -11,6 +11,7 @@
#include "base/message_loop.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 +20,37 @@ 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(net::TestServer::GetTestServerDirectory());
+ if (sync_test_path.empty()) {
+ 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);
+ VLOG(1) << "Launching " << python_command.GetCommandLineString();
Paweł Hajdan Jr. 2012/03/13 17:15:23 Is this needed?
tim (not reviewing) 2012/03/15 00:41:40 Removed this one.
+ 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;
« net/test/test_server_posix.cc ('K') | « net/test/test_server_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698