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 "chrome/test/base/ui_test_utils.h" | 5 #include "chrome/test/base/ui_test_utils.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <windows.h> | 8 #include <windows.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
760 | 760 |
761 void TimedMessageLoopRunner::QuitAfter(int ms) { | 761 void TimedMessageLoopRunner::QuitAfter(int ms) { |
762 quit_loop_invoked_ = true; | 762 quit_loop_invoked_ = true; |
763 loop_->PostDelayedTask( | 763 loop_->PostDelayedTask( |
764 FROM_HERE, | 764 FROM_HERE, |
765 MessageLoop::QuitClosure(), | 765 MessageLoop::QuitClosure(), |
766 base::TimeDelta::FromMilliseconds(ms)); | 766 base::TimeDelta::FromMilliseconds(ms)); |
767 } | 767 } |
768 | 768 |
769 TestWebSocketServer::TestWebSocketServer() | 769 TestWebSocketServer::TestWebSocketServer() |
770 : started_(false), port_(kDefaultWsPort) { | 770 : started_(false), port_(kDefaultWsPort), secure_(false) { |
sky
2012/04/02 15:37:37
nit: because this isn't all on one line, each para
Takashi Toyoshima
2012/04/04 09:01:07
Done.
| |
771 #if defined(OS_POSIX) | 771 #if defined(OS_POSIX) |
772 process_group_id_ = base::kNullProcessHandle; | 772 process_group_id_ = base::kNullProcessHandle; |
773 #endif | 773 #endif |
774 } | 774 } |
775 | 775 |
776 int TestWebSocketServer::UseRandomPort() { | 776 int TestWebSocketServer::UseRandomPort() { |
777 port_ = base::RandInt(1024, 65535); | 777 port_ = base::RandInt(1024, 65535); |
778 return port_; | 778 return port_; |
779 } | 779 } |
780 | 780 |
781 void TestWebSocketServer::UseTLS() { | |
782 secure_ = true; | |
783 } | |
784 | |
781 bool TestWebSocketServer::Start(const FilePath& root_directory) { | 785 bool TestWebSocketServer::Start(const FilePath& root_directory) { |
782 if (started_) | 786 if (started_) |
783 return true; | 787 return true; |
784 // Append CommandLine arguments after the server script, switches won't work. | 788 // Append CommandLine arguments after the server script, switches won't work. |
785 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); | 789 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); |
786 cmd_line->AppendArg("--server=start"); | 790 cmd_line->AppendArg("--server=start"); |
787 cmd_line->AppendArg("--chromium"); | 791 cmd_line->AppendArg("--chromium"); |
788 cmd_line->AppendArg("--register_cygwin"); | 792 cmd_line->AppendArg("--register_cygwin"); |
789 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") + | 793 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") + |
790 root_directory.value()); | 794 root_directory.value()); |
791 cmd_line->AppendArg("--port=" + base::IntToString(port_)); | 795 cmd_line->AppendArg("--port=" + base::IntToString(port_)); |
796 if (secure_) | |
797 cmd_line->AppendArg("--tls"); | |
792 if (!temp_dir_.CreateUniqueTempDir()) { | 798 if (!temp_dir_.CreateUniqueTempDir()) { |
793 LOG(ERROR) << "Unable to create a temporary directory."; | 799 LOG(ERROR) << "Unable to create a temporary directory."; |
794 return false; | 800 return false; |
795 } | 801 } |
796 websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid"); | 802 websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid"); |
797 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + | 803 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + |
798 websocket_pid_file_.value()); | 804 websocket_pid_file_.value()); |
799 SetPythonPath(); | 805 SetPythonPath(); |
800 | 806 |
801 base::LaunchOptions options; | 807 base::LaunchOptions options; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1154 int state, | 1160 int state, |
1155 const base::Closure& followup) { | 1161 const base::Closure& followup) { |
1156 if (!followup.is_null()) | 1162 if (!followup.is_null()) |
1157 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); | 1163 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); |
1158 else | 1164 else |
1159 ui_controls::SendMouseEvents(button, state); | 1165 ui_controls::SendMouseEvents(button, state); |
1160 } | 1166 } |
1161 | 1167 |
1162 } // namespace internal | 1168 } // namespace internal |
1163 } // namespace ui_test_utils | 1169 } // namespace ui_test_utils |
OLD | NEW |