Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: chrome/test/base/ui_test_utils.cc

Issue 10541168: Add end to end client cert auth test for wss (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove p12 file Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 return base::Bind(&MessageLoopRunner::Quit, this); 870 return base::Bind(&MessageLoopRunner::Quit, this);
871 } 871 }
872 872
873 void MessageLoopRunner::Quit() { 873 void MessageLoopRunner::Quit() {
874 ui_test_utils::GetQuitTaskForRunLoop(&run_loop_).Run(); 874 ui_test_utils::GetQuitTaskForRunLoop(&run_loop_).Run();
875 } 875 }
876 876
877 TestWebSocketServer::TestWebSocketServer() 877 TestWebSocketServer::TestWebSocketServer()
878 : started_(false), 878 : started_(false),
879 port_(kDefaultWsPort), 879 port_(kDefaultWsPort),
880 secure_(false) { 880 secure_(false),
881 client_authentication_(false) {
881 #if defined(OS_POSIX) 882 #if defined(OS_POSIX)
882 process_group_id_ = base::kNullProcessHandle; 883 process_group_id_ = base::kNullProcessHandle;
883 #endif 884 #endif
884 } 885 }
885 886
886 int TestWebSocketServer::UseRandomPort() { 887 int TestWebSocketServer::UseRandomPort() {
887 port_ = base::RandInt(1024, 65535); 888 port_ = base::RandInt(1024, 65535);
888 return port_; 889 return port_;
889 } 890 }
890 891
891 void TestWebSocketServer::UseTLS() { 892 void TestWebSocketServer::UseTLS() {
892 secure_ = true; 893 secure_ = true;
893 } 894 }
894 895
896 void TestWebSocketServer::UseClientAuthentication() {
897 secure_ = true;
wtc 2012/07/11 21:35:57 Nit: this method probably should not set secure_ t
Takashi Toyoshima 2012/07/12 05:20:13 Done.
898 client_authentication_ = true;
899 }
900
895 bool TestWebSocketServer::Start(const FilePath& root_directory) { 901 bool TestWebSocketServer::Start(const FilePath& root_directory) {
896 if (started_) 902 if (started_)
897 return true; 903 return true;
898 // Append CommandLine arguments after the server script, switches won't work. 904 // Append CommandLine arguments after the server script, switches won't work.
899 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine()); 905 scoped_ptr<CommandLine> cmd_line(CreateWebSocketServerCommandLine());
900 cmd_line->AppendArg("--server=start"); 906 cmd_line->AppendArg("--server=start");
901 cmd_line->AppendArg("--chromium"); 907 cmd_line->AppendArg("--chromium");
902 cmd_line->AppendArg("--register_cygwin"); 908 cmd_line->AppendArg("--register_cygwin");
903 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") + 909 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--root=") +
904 root_directory.value()); 910 root_directory.value());
905 cmd_line->AppendArg("--port=" + base::IntToString(port_)); 911 cmd_line->AppendArg("--port=" + base::IntToString(port_));
906 if (secure_) 912 if (secure_)
907 cmd_line->AppendArg("--tls"); 913 cmd_line->AppendArg("--tls");
908 if (!temp_dir_.CreateUniqueTempDir()) { 914 if (!temp_dir_.CreateUniqueTempDir()) {
909 LOG(ERROR) << "Unable to create a temporary directory."; 915 LOG(ERROR) << "Unable to create a temporary directory.";
910 return false; 916 return false;
911 } 917 }
918 FilePath cacert_path(root_directory);
wtc 2012/07/11 21:35:57 The declaration of the cacert_path variable can be
Takashi Toyoshima 2012/07/12 05:20:13 Done.
919 if (client_authentication_) {
920 cmd_line->AppendArg("--ca-certificate");
wtc 2012/07/11 21:35:57 It is strange that the --ca-certificate option alo
Takashi Toyoshima 2012/07/12 05:20:13 Currently, just adding '--ca-certificate <filename
wtc 2012/07/12 23:10:48 Thank you for the info. I suggest that you use tw
921 cacert_path = cacert_path.Append(FILE_PATH_LITERAL("ssl"));
922 cacert_path = cacert_path.Append(FILE_PATH_LITERAL("cacert.pem"));
923 cmd_line->AppendArgNative(cacert_path.value());
924 }
912 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--output-dir=") + 925 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--output-dir=") +
913 temp_dir_.path().value()); 926 temp_dir_.path().value());
914 websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid"); 927 websocket_pid_file_ = temp_dir_.path().AppendASCII("websocket.pid");
915 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") + 928 cmd_line->AppendArgNative(FILE_PATH_LITERAL("--pidfile=") +
916 websocket_pid_file_.value()); 929 websocket_pid_file_.value());
917 SetPythonPath(); 930 SetPythonPath();
918 931
919 base::LaunchOptions options; 932 base::LaunchOptions options;
920 base::ProcessHandle process_handle; 933 base::ProcessHandle process_handle;
921 934
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1289 int state, 1302 int state,
1290 const base::Closure& followup) { 1303 const base::Closure& followup) {
1291 if (!followup.is_null()) 1304 if (!followup.is_null())
1292 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup); 1305 ui_controls::SendMouseEventsNotifyWhenDone(button, state, followup);
1293 else 1306 else
1294 ui_controls::SendMouseEvents(button, state); 1307 ui_controls::SendMouseEvents(button, state);
1295 } 1308 }
1296 1309
1297 } // namespace internal 1310 } // namespace internal
1298 } // namespace ui_test_utils 1311 } // namespace ui_test_utils
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698