OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/test/ui_test_utils.h" | 5 #include "chrome/test/ui_test_utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") + | 702 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") + |
703 root_directory.value()); | 703 root_directory.value()); |
704 if (!temp_dir_.CreateUniqueTempDir()) { | 704 if (!temp_dir_.CreateUniqueTempDir()) { |
705 LOG(ERROR) << "Unable to create a temporary directory."; | 705 LOG(ERROR) << "Unable to create a temporary directory."; |
706 return false; | 706 return false; |
707 } | 707 } |
708 websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid"); | 708 websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid"); |
709 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + | 709 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + |
710 websocket_pid_file_.value()); | 710 websocket_pid_file_.value()); |
711 SetPythonPath(); | 711 SetPythonPath(); |
712 if (!base::LaunchApp(*cmd_line.get(), true, false, NULL)) { | 712 base::LaunchOptions options; |
| 713 options.wait = true; |
| 714 if (!base::LaunchProcess(*cmd_line.get(), options)) { |
713 LOG(ERROR) << "Unable to launch websocket server."; | 715 LOG(ERROR) << "Unable to launch websocket server."; |
714 return false; | 716 return false; |
715 } | 717 } |
716 started_ = true; | 718 started_ = true; |
717 return true; | 719 return true; |
718 } | 720 } |
719 | 721 |
720 CommandLine* TestWebSocketServer::CreatePythonCommandLine() { | 722 CommandLine* TestWebSocketServer::CreatePythonCommandLine() { |
721 // Note: Python's first argument must be the script; do not append CommandLine | 723 // Note: Python's first argument must be the script; do not append CommandLine |
722 // switches, as they would precede the script path and break this CommandLine. | 724 // switches, as they would precede the script path and break this CommandLine. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 756 |
755 TestWebSocketServer::~TestWebSocketServer() { | 757 TestWebSocketServer::~TestWebSocketServer() { |
756 if (!started_) | 758 if (!started_) |
757 return; | 759 return; |
758 // Append CommandLine arguments after the server script, switches won't work. | 760 // Append CommandLine arguments after the server script, switches won't work. |
759 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); | 761 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); |
760 cmd_line->AppendArg("--server=stop"); | 762 cmd_line->AppendArg("--server=stop"); |
761 cmd_line->AppendArg("--chromium"); | 763 cmd_line->AppendArg("--chromium"); |
762 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + | 764 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + |
763 websocket_pid_file_.value()); | 765 websocket_pid_file_.value()); |
764 base::LaunchApp(*cmd_line.get(), true, false, NULL); | 766 base::LaunchOptions options; |
| 767 options.wait = true; |
| 768 base::LaunchProcess(*cmd_line.get(), options); |
765 } | 769 } |
766 | 770 |
767 TestNotificationObserver::TestNotificationObserver() | 771 TestNotificationObserver::TestNotificationObserver() |
768 : source_(NotificationService::AllSources()) { | 772 : source_(NotificationService::AllSources()) { |
769 } | 773 } |
770 | 774 |
771 TestNotificationObserver::~TestNotificationObserver() {} | 775 TestNotificationObserver::~TestNotificationObserver() {} |
772 | 776 |
773 void TestNotificationObserver::Observe(int type, | 777 void TestNotificationObserver::Observe(int type, |
774 const NotificationSource& source, | 778 const NotificationSource& source, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 974 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
971 } | 975 } |
972 | 976 |
973 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 977 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
974 DCHECK(bitmap); | 978 DCHECK(bitmap); |
975 SnapshotTaker taker; | 979 SnapshotTaker taker; |
976 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 980 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
977 } | 981 } |
978 | 982 |
979 } // namespace ui_test_utils | 983 } // namespace ui_test_utils |
OLD | NEW |