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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 base::LaunchOptions options; | 712 base::LaunchOptions options; |
713 options.wait = true; | 713 options.wait = true; |
714 if (!base::LaunchProcess(*cmd_line.get(), options)) { | 714 if (!base::LaunchProcess(*cmd_line.get(), options, NULL)) { |
715 LOG(ERROR) << "Unable to launch websocket server."; | 715 LOG(ERROR) << "Unable to launch websocket server."; |
716 return false; | 716 return false; |
717 } | 717 } |
718 started_ = true; | 718 started_ = true; |
719 return true; | 719 return true; |
720 } | 720 } |
721 | 721 |
722 CommandLine* TestWebSocketServer::CreatePythonCommandLine() { | 722 CommandLine* TestWebSocketServer::CreatePythonCommandLine() { |
723 // 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 |
724 // 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 if (!started_) | 758 if (!started_) |
759 return; | 759 return; |
760 // Append CommandLine arguments after the server script, switches won't work. | 760 // Append CommandLine arguments after the server script, switches won't work. |
761 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); | 761 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); |
762 cmd_line->AppendArg("--server=stop"); | 762 cmd_line->AppendArg("--server=stop"); |
763 cmd_line->AppendArg("--chromium"); | 763 cmd_line->AppendArg("--chromium"); |
764 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + | 764 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + |
765 websocket_pid_file_.value()); | 765 websocket_pid_file_.value()); |
766 base::LaunchOptions options; | 766 base::LaunchOptions options; |
767 options.wait = true; | 767 options.wait = true; |
768 base::LaunchProcess(*cmd_line.get(), options); | 768 base::LaunchProcess(*cmd_line.get(), options, NULL); |
769 } | 769 } |
770 | 770 |
771 TestNotificationObserver::TestNotificationObserver() | 771 TestNotificationObserver::TestNotificationObserver() |
772 : source_(NotificationService::AllSources()) { | 772 : source_(NotificationService::AllSources()) { |
773 } | 773 } |
774 | 774 |
775 TestNotificationObserver::~TestNotificationObserver() {} | 775 TestNotificationObserver::~TestNotificationObserver() {} |
776 | 776 |
777 void TestNotificationObserver::Observe(int type, | 777 void TestNotificationObserver::Observe(int type, |
778 const NotificationSource& source, | 778 const NotificationSource& source, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); | 974 return taker.TakeRenderWidgetSnapshot(rwh, page_size, page_size, bitmap); |
975 } | 975 } |
976 | 976 |
977 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { | 977 bool TakeEntirePageSnapshot(RenderViewHost* rvh, SkBitmap* bitmap) { |
978 DCHECK(bitmap); | 978 DCHECK(bitmap); |
979 SnapshotTaker taker; | 979 SnapshotTaker taker; |
980 return taker.TakeEntirePageSnapshot(rvh, bitmap); | 980 return taker.TakeEntirePageSnapshot(rvh, bitmap); |
981 } | 981 } |
982 | 982 |
983 } // namespace ui_test_utils | 983 } // namespace ui_test_utils |
OLD | NEW |