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

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: revert a few files 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
« no previous file with comments | « net/test/local_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..f00f9f2d2b5730d59886b047c36f49a983ce55d5 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;
« no previous file with comments | « net/test/local_test_server_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698