| 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 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 << std::endl << "key from header: " << public_key_base64 | 685 << std::endl << "key from header: " << public_key_base64 |
| 686 << std::endl << "key from manifest: " << manifest_key_base64 | 686 << std::endl << "key from manifest: " << manifest_key_base64 |
| 687 << std::endl << "generated extension id from header key: " << id | 687 << std::endl << "generated extension id from header key: " << id |
| 688 << std::endl << "generated extension id from manifest key: " | 688 << std::endl << "generated extension id from manifest key: " |
| 689 << manifest_id; | 689 << manifest_id; |
| 690 } | 690 } |
| 691 id = manifest_id; | 691 id = manifest_id; |
| 692 } | 692 } |
| 693 } else { | 693 } else { |
| 694 manifest->SetString("key", public_key_base64); | 694 manifest->SetString("key", public_key_base64); |
| 695 base::JSONWriter::Write(manifest, &manifest_data); | 695 base::JSONWriter::Write(*manifest, &manifest_data); |
| 696 if (base::WriteFile( | 696 if (base::WriteFile( |
| 697 manifest_path, manifest_data.c_str(), manifest_data.size()) != | 697 manifest_path, manifest_data.c_str(), manifest_data.size()) != |
| 698 static_cast<int>(manifest_data.size())) { | 698 static_cast<int>(manifest_data.size())) { |
| 699 return Status(kUnknownError, "cannot add 'key' to manifest"); | 699 return Status(kUnknownError, "cannot add 'key' to manifest"); |
| 700 } | 700 } |
| 701 } | 701 } |
| 702 | 702 |
| 703 // Get extension's background page URL, if there is one. | 703 // Get extension's background page URL, if there is one. |
| 704 std::string bg_page_tmp; | 704 std::string bg_page_tmp; |
| 705 Status status = GetExtensionBackgroundPage(manifest, id, &bg_page_tmp); | 705 Status status = GetExtensionBackgroundPage(manifest, id, &bg_page_tmp); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 } | 781 } |
| 782 | 782 |
| 783 if (custom_prefs) { | 783 if (custom_prefs) { |
| 784 for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd(); | 784 for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd(); |
| 785 it.Advance()) { | 785 it.Advance()) { |
| 786 prefs->Set(it.key(), it.value().DeepCopy()); | 786 prefs->Set(it.key(), it.value().DeepCopy()); |
| 787 } | 787 } |
| 788 } | 788 } |
| 789 | 789 |
| 790 std::string prefs_str; | 790 std::string prefs_str; |
| 791 base::JSONWriter::Write(prefs, &prefs_str); | 791 base::JSONWriter::Write(*prefs, &prefs_str); |
| 792 VLOG(0) << "Populating " << path.BaseName().value() | 792 VLOG(0) << "Populating " << path.BaseName().value() |
| 793 << " file: " << PrettyPrintValue(*prefs); | 793 << " file: " << PrettyPrintValue(*prefs); |
| 794 if (static_cast<int>(prefs_str.length()) != base::WriteFile( | 794 if (static_cast<int>(prefs_str.length()) != base::WriteFile( |
| 795 path, prefs_str.c_str(), prefs_str.length())) { | 795 path, prefs_str.c_str(), prefs_str.length())) { |
| 796 return Status(kUnknownError, "failed to write prefs file"); | 796 return Status(kUnknownError, "failed to write prefs file"); |
| 797 } | 797 } |
| 798 return Status(kOk); | 798 return Status(kOk); |
| 799 } | 799 } |
| 800 | 800 |
| 801 Status PrepareUserDataDir( | 801 Status PrepareUserDataDir( |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 // Write empty "First Run" file, otherwise Chrome will wipe the default | 841 // Write empty "First Run" file, otherwise Chrome will wipe the default |
| 842 // profile that was written. | 842 // profile that was written. |
| 843 if (base::WriteFile( | 843 if (base::WriteFile( |
| 844 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { | 844 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { |
| 845 return Status(kUnknownError, "failed to write first run file"); | 845 return Status(kUnknownError, "failed to write first run file"); |
| 846 } | 846 } |
| 847 return Status(kOk); | 847 return Status(kOk); |
| 848 } | 848 } |
| 849 | 849 |
| 850 } // namespace internal | 850 } // namespace internal |
| OLD | NEW |