| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 } | 33 } |
| 34 | 34 |
| 35 FilePath sync_test_path; | 35 FilePath sync_test_path; |
| 36 if (!net::TestServer::GetTestServerDirectory(&sync_test_path)) { | 36 if (!net::TestServer::GetTestServerDirectory(&sync_test_path)) { |
| 37 LOG(ERROR) << "Error trying to get python test server path."; | 37 LOG(ERROR) << "Error trying to get python test server path."; |
| 38 return false; | 38 return false; |
| 39 } | 39 } |
| 40 | 40 |
| 41 sync_test_path = | 41 sync_test_path = |
| 42 sync_test_path.Append(FILE_PATH_LITERAL("chromiumsync_test.py")); | 42 sync_test_path.Append(FILE_PATH_LITERAL("chromiumsync_test.py")); |
| 43 FilePath python_runtime; | 43 |
| 44 if (!GetPythonRunTime(&python_runtime)) { | 44 CommandLine python_command(CommandLine::NO_PROGRAM); |
| 45 if (!GetPythonCommand(&python_command)) { |
| 45 LOG(ERROR) << "Could not get python runtime command."; | 46 LOG(ERROR) << "Could not get python runtime command."; |
| 46 return false; | 47 return false; |
| 47 } | 48 } |
| 48 | 49 |
| 49 CommandLine python_command(python_runtime); | |
| 50 python_command.AppendArgPath(sync_test_path); | 50 python_command.AppendArgPath(sync_test_path); |
| 51 if (!base::LaunchProcess(python_command, base::LaunchOptions(), NULL)) { | 51 if (!base::LaunchProcess(python_command, base::LaunchOptions(), NULL)) { |
| 52 LOG(ERROR) << "Failed to launch test script."; | 52 LOG(ERROR) << "Failed to launch test script."; |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 // Gets a port value from the switch with name |switch_name| and writes it to | 58 // Gets a port value from the switch with name |switch_name| and writes it to |
| 59 // |port|. Returns true if successful and false otherwise. | 59 // |port|. Returns true if successful and false otherwise. |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); | 175 UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); |
| 176 return -1; | 176 return -1; |
| 177 } | 177 } |
| 178 | 178 |
| 179 printf("testserver running at %s (type ctrl+c to exit)\n", | 179 printf("testserver running at %s (type ctrl+c to exit)\n", |
| 180 test_server->host_port_pair().ToString().c_str()); | 180 test_server->host_port_pair().ToString().c_str()); |
| 181 | 181 |
| 182 message_loop.Run(); | 182 message_loop.Run(); |
| 183 return 0; | 183 return 0; |
| 184 } | 184 } |
| OLD | NEW |