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 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 return Status(kUnknownError, "failed to write prefs file"); | 628 return Status(kUnknownError, "failed to write prefs file"); |
629 } | 629 } |
630 return Status(kOk); | 630 return Status(kOk); |
631 } | 631 } |
632 | 632 |
633 Status PrepareUserDataDir( | 633 Status PrepareUserDataDir( |
634 const base::FilePath& user_data_dir, | 634 const base::FilePath& user_data_dir, |
635 const base::DictionaryValue* custom_prefs, | 635 const base::DictionaryValue* custom_prefs, |
636 const base::DictionaryValue* custom_local_state) { | 636 const base::DictionaryValue* custom_local_state) { |
637 base::FilePath default_dir = user_data_dir.AppendASCII("Default"); | 637 base::FilePath default_dir = user_data_dir.AppendASCII("Default"); |
638 if (!file_util::CreateDirectory(default_dir)) | 638 if (!base::CreateDirectory(default_dir)) |
639 return Status(kUnknownError, "cannot create default profile directory"); | 639 return Status(kUnknownError, "cannot create default profile directory"); |
640 | 640 |
641 Status status = WritePrefsFile( | 641 Status status = WritePrefsFile( |
642 kPreferences, | 642 kPreferences, |
643 custom_prefs, | 643 custom_prefs, |
644 default_dir.AppendASCII("Preferences")); | 644 default_dir.AppendASCII("Preferences")); |
645 if (status.IsError()) | 645 if (status.IsError()) |
646 return status; | 646 return status; |
647 | 647 |
648 status = WritePrefsFile( | 648 status = WritePrefsFile( |
649 kLocalState, | 649 kLocalState, |
650 custom_local_state, | 650 custom_local_state, |
651 user_data_dir.AppendASCII("Local State")); | 651 user_data_dir.AppendASCII("Local State")); |
652 if (status.IsError()) | 652 if (status.IsError()) |
653 return status; | 653 return status; |
654 | 654 |
655 // Write empty "First Run" file, otherwise Chrome will wipe the default | 655 // Write empty "First Run" file, otherwise Chrome will wipe the default |
656 // profile that was written. | 656 // profile that was written. |
657 if (file_util::WriteFile( | 657 if (file_util::WriteFile( |
658 user_data_dir.AppendASCII("First Run"), "", 0) != 0) { | 658 user_data_dir.AppendASCII("First Run"), "", 0) != 0) { |
659 return Status(kUnknownError, "failed to write first run file"); | 659 return Status(kUnknownError, "failed to write first run file"); |
660 } | 660 } |
661 return Status(kOk); | 661 return Status(kOk); |
662 } | 662 } |
663 | 663 |
664 } // namespace internal | 664 } // namespace internal |
OLD | NEW |