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 "content/public/test/browser_test_utils.h" | 5 #include "content/public/test/browser_test_utils.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
537 PathService::Get(base::DIR_SOURCE_ROOT, &src_path); | 537 PathService::Get(base::DIR_SOURCE_ROOT, &src_path); |
538 | 538 |
539 FilePath script_path(src_path); | 539 FilePath script_path(src_path); |
540 script_path = script_path.AppendASCII("third_party"); | 540 script_path = script_path.AppendASCII("third_party"); |
541 script_path = script_path.AppendASCII("WebKit"); | 541 script_path = script_path.AppendASCII("WebKit"); |
542 script_path = script_path.AppendASCII("Tools"); | 542 script_path = script_path.AppendASCII("Tools"); |
543 script_path = script_path.AppendASCII("Scripts"); | 543 script_path = script_path.AppendASCII("Scripts"); |
544 script_path = script_path.AppendASCII("new-run-webkit-websocketserver"); | 544 script_path = script_path.AppendASCII("new-run-webkit-websocketserver"); |
545 | 545 |
546 CommandLine* cmd_line = CreatePythonCommandLine(); | 546 CommandLine* cmd_line = CreatePythonCommandLine(); |
547 | |
548 // Use unbuffered output, so that testserver output doesn't mix with gtest | |
549 // output in test log files. See http://crbug.com/147368. | |
550 cmd_line->AppendArg("-u"); | |
Paweł Hajdan Jr.
2012/09/11 08:57:31
Why not in CreatePythonCommandLine?
In fact, to r
Raghu Simha
2012/09/11 21:58:04
Done.
| |
551 | |
547 cmd_line->AppendArgPath(script_path); | 552 cmd_line->AppendArgPath(script_path); |
548 return cmd_line; | 553 return cmd_line; |
549 } | 554 } |
550 | 555 |
551 TestWebSocketServer::~TestWebSocketServer() { | 556 TestWebSocketServer::~TestWebSocketServer() { |
552 if (!started_) | 557 if (!started_) |
553 return; | 558 return; |
554 // Append CommandLine arguments after the server script, switches won't work. | 559 // Append CommandLine arguments after the server script, switches won't work. |
555 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); | 560 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); |
556 cmd_line->AppendArg("--server=stop"); | 561 cmd_line->AppendArg("--server=stop"); |
557 cmd_line->AppendArg("--chromium"); | 562 cmd_line->AppendArg("--chromium"); |
558 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + | 563 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + |
559 websocket_pid_file_.value()); | 564 websocket_pid_file_.value()); |
560 base::LaunchOptions options; | 565 base::LaunchOptions options; |
561 options.wait = true; | 566 options.wait = true; |
562 base::LaunchProcess(*cmd_line.get(), options, NULL); | 567 base::LaunchProcess(*cmd_line.get(), options, NULL); |
563 | 568 |
564 #if defined(OS_POSIX) | 569 #if defined(OS_POSIX) |
565 // Just to make sure that the server process terminates certainly. | 570 // Just to make sure that the server process terminates certainly. |
566 if (process_group_id_ != base::kNullProcessHandle) | 571 if (process_group_id_ != base::kNullProcessHandle) |
567 base::KillProcessGroup(process_group_id_); | 572 base::KillProcessGroup(process_group_id_); |
568 #endif | 573 #endif |
569 } | 574 } |
570 | 575 |
571 } // namespace content | 576 } // namespace content |
OLD | NEW |