Chromium Code Reviews| Index: chrome/test/chromedriver/chrome_launcher.cc |
| diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc |
| index 21595b0c8b3fab8f83af37918ef29e7f2e2eb8b5..12b87a1c0045d67e759bb747fee5fef96792e75d 100644 |
| --- a/chrome/test/chromedriver/chrome_launcher.cc |
| +++ b/chrome/test/chromedriver/chrome_launcher.cc |
| @@ -128,28 +128,34 @@ Status PrepareCommandLine(int port, |
| switches.RemoveSwitch(*iter); |
| } |
| switches.SetFromSwitches(capabilities.switches); |
| - |
| + base::FilePath user_data_dir_path; |
| if (!switches.HasSwitch("user-data-dir")) { |
| command.AppendArg("data:,"); |
| if (!user_data_dir->CreateUniqueTempDir()) |
| return Status(kUnknownError, "cannot create temp dir for user data dir"); |
| switches.SetSwitch("user-data-dir", user_data_dir->path().value()); |
| - Status status = internal::PrepareUserDataDir( |
| - user_data_dir->path(), capabilities.prefs.get(), |
| - capabilities.local_state.get()); |
| - if (status.IsError()) |
| - return status; |
| + user_data_dir_path = user_data_dir->path(); |
| + } else { |
| + user_data_dir_path = base::FilePath( |
| + switches.GetSwitchValue("user-data-dir")); |
| } |
| + Status status = internal::PrepareUserDataDir( |
| + user_data_dir_path, |
| + capabilities.prefs.get(), |
| + capabilities.local_state.get()); |
|
samuong
2014/10/17 23:30:34
please fix indenting for arguments - they should e
andrewcheng
2014/10/18 00:45:46
Done.
|
| + if (status.IsError()) |
| + return status; |
|
samuong
2014/10/17 23:30:34
please fix indenting for "return status;" (it shou
andrewcheng
2014/10/18 00:45:46
Done.
|
| + |
| if (!extension_dir->CreateUniqueTempDir()) { |
| return Status(kUnknownError, |
| "cannot create temp dir for unpacking extensions"); |
| } |
| - Status status = internal::ProcessExtensions(capabilities.extensions, |
| - extension_dir->path(), |
| - true, |
| - &switches, |
| - extension_bg_pages); |
| + status = internal::ProcessExtensions(capabilities.extensions, |
| + extension_dir->path(), |
| + true, |
| + &switches, |
| + extension_bg_pages); |
| if (status.IsError()) |
| return status; |
| switches.AppendToCommandLine(&command); |
| @@ -772,14 +778,32 @@ Status PrepareUserDataDir( |
| if (!base::CreateDirectory(default_dir)) |
| return Status(kUnknownError, "cannot create default profile directory"); |
| + std::string preferences; |
| + base::FilePath preferences_path = |
| + default_dir.Append(chrome::kPreferencesFilename); |
|
samuong
2014/10/17 23:30:35
fix indenting (should be 6 spaces, not 9)
andrewcheng
2014/10/18 00:45:46
Done.
|
| + |
| + if (base::PathExists(preferences_path)) |
| + base::ReadFileToString(preferences_path, &preferences); |
| + else |
| + preferences = std::string(kPreferences); |
|
samuong
2014/10/17 23:30:34
why not just do "preferences = kPreferences;"?
andrewcheng
2014/10/18 00:45:46
Done.
|
| + |
| Status status = |
| - WritePrefsFile(kPreferences, |
| + WritePrefsFile(preferences, |
| custom_prefs, |
| default_dir.Append(chrome::kPreferencesFilename)); |
| if (status.IsError()) |
| return status; |
| - status = WritePrefsFile(kLocalState, |
| + std::string local_state; |
| + base::FilePath local_state_path = |
| + user_data_dir.Append(chrome::kLocalStateFilename); |
|
samuong
2014/10/17 23:30:34
fix indenting (should be 6 spaces, not 8)
andrewcheng
2014/10/18 00:45:46
Done.
|
| + |
| + if (base::PathExists(local_state_path)) |
| + base::ReadFileToString(local_state_path, &local_state); |
| + else |
| + local_state = std::string(kLocalState); |
|
samuong
2014/10/17 23:30:35
similar to above, why not just do "local_state = k
andrewcheng
2014/10/18 00:45:46
Done.
|
| + |
| + status = WritePrefsFile(local_state, |
| custom_local_state, |
| user_data_dir.Append(chrome::kLocalStateFilename)); |
| if (status.IsError()) |