Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromedriver/chrome_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 #include "crypto/rsa_private_key.h" | 46 #include "crypto/rsa_private_key.h" |
| 47 #include "crypto/sha2.h" | 47 #include "crypto/sha2.h" |
| 48 #include "third_party/zlib/google/zip.h" | 48 #include "third_party/zlib/google/zip.h" |
| 49 | 49 |
| 50 #if defined(OS_POSIX) | 50 #if defined(OS_POSIX) |
| 51 #include <fcntl.h> | 51 #include <fcntl.h> |
| 52 #include <sys/stat.h> | 52 #include <sys/stat.h> |
| 53 #include <sys/types.h> | 53 #include <sys/types.h> |
| 54 #elif defined(OS_WIN) | 54 #elif defined(OS_WIN) |
| 55 #include "base/win/scoped_handle.h" | 55 #include "base/win/scoped_handle.h" |
| 56 #include "chrome/test/chromedriver/keycode_text_conversion.h" | |
| 56 #endif | 57 #endif |
| 57 | 58 |
| 58 namespace { | 59 namespace { |
| 59 | 60 |
| 60 const char* const kCommonSwitches[] = { | 61 const char* const kCommonSwitches[] = { |
| 61 "ignore-certificate-errors", "metrics-recording-only"}; | 62 "ignore-certificate-errors", "metrics-recording-only"}; |
| 62 | 63 |
| 63 #if defined(OS_LINUX) | 64 #if defined(OS_LINUX) |
| 64 const char kEnableCrashReport[] = "enable-crash-reporter-for-testing"; | 65 const char kEnableCrashReport[] = "enable-crash-reporter-for-testing"; |
| 65 #endif | 66 #endif |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 if (!CreatePipe(&out_read, &out_write, &sa_attr, 0)) | 338 if (!CreatePipe(&out_read, &out_write, &sa_attr, 0)) |
| 338 return Status(kUnknownError, "CreatePipe() - Pipe creation failed"); | 339 return Status(kUnknownError, "CreatePipe() - Pipe creation failed"); |
| 339 // Prevent handle leak. | 340 // Prevent handle leak. |
| 340 base::win::ScopedHandle scoped_out_read(out_read); | 341 base::win::ScopedHandle scoped_out_read(out_read); |
| 341 base::win::ScopedHandle scoped_out_write(out_write); | 342 base::win::ScopedHandle scoped_out_write(out_write); |
| 342 | 343 |
| 343 options.stdout_handle = out_write; | 344 options.stdout_handle = out_write; |
| 344 options.stderr_handle = out_write; | 345 options.stderr_handle = out_write; |
| 345 options.stdin_handle = GetStdHandle(STD_INPUT_HANDLE); | 346 options.stdin_handle = GetStdHandle(STD_INPUT_HANDLE); |
| 346 options.inherit_handles = true; | 347 options.inherit_handles = true; |
| 348 // use US keyboard layout for key conversion | |
| 349 if (!SwitchToUSKeyboardLayout()) { | |
| 350 VLOG(0) << "Can not set to US keyboard layout\n"; | |
|
samuong
2015/01/23 19:36:58
We should also mention that some keycodes may be i
andrewcheng1
2015/01/24 01:40:00
Done.
andrewcheng1
2015/02/19 00:56:59
Done.
| |
| 351 } | |
|
samuong
2015/01/23 19:36:58
You mentioned earlier that this is a per-process s
andrewcheng1
2015/01/24 01:40:00
sent you email - main() will not work (reason n
andrewcheng1
2015/02/19 00:56:59
sent you email - main() will not work (which it
| |
| 347 #endif | 352 #endif |
| 348 | 353 |
| 349 #if defined(OS_WIN) | 354 #if defined(OS_WIN) |
| 350 std::string command_string = base::WideToUTF8(command.GetCommandLineString()); | 355 std::string command_string = base::WideToUTF8(command.GetCommandLineString()); |
| 351 #else | 356 #else |
| 352 std::string command_string = command.GetCommandLineString(); | 357 std::string command_string = command.GetCommandLineString(); |
| 353 #endif | 358 #endif |
| 354 VLOG(0) << "Launching chrome: " << command_string; | 359 VLOG(0) << "Launching chrome: " << command_string; |
| 355 base::Process process = base::LaunchProcess(command, options); | 360 base::Process process = base::LaunchProcess(command, options); |
| 356 if (!process.IsValid()) | 361 if (!process.IsValid()) |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 // Write empty "First Run" file, otherwise Chrome will wipe the default | 840 // Write empty "First Run" file, otherwise Chrome will wipe the default |
| 836 // profile that was written. | 841 // profile that was written. |
| 837 if (base::WriteFile( | 842 if (base::WriteFile( |
| 838 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 843 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
| 839 return Status(kUnknownError, "failed to write first run file"); | 844 return Status(kUnknownError, "failed to write first run file"); |
| 840 } | 845 } |
| 841 return Status(kOk); | 846 return Status(kOk); |
| 842 } | 847 } |
| 843 | 848 |
| 844 } // namespace internal | 849 } // namespace internal |
| OLD | NEW |