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

Side by Side Diff: chrome/test/chromedriver/chrome_launcher.cc

Issue 1310173010: Remove use of JSONReader::DeprecatedRead from chrome/test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years, 2 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
OLDNEW
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 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
768 bg_pages->swap(bg_pages_tmp); 768 bg_pages->swap(bg_pages_tmp);
769 return Status(kOk); 769 return Status(kOk);
770 } 770 }
771 771
772 Status WritePrefsFile( 772 Status WritePrefsFile(
773 const std::string& template_string, 773 const std::string& template_string,
774 const base::DictionaryValue* custom_prefs, 774 const base::DictionaryValue* custom_prefs,
775 const base::FilePath& path) { 775 const base::FilePath& path) {
776 int code; 776 int code;
777 std::string error_msg; 777 std::string error_msg;
778 scoped_ptr<base::Value> template_value( 778 scoped_ptr<base::Value> template_value = base::JSONReader::ReadAndReturnError(
779 base::JSONReader::DeprecatedReadAndReturnError(template_string, 0, &code, 779 template_string, 0, &code, &error_msg);
780 &error_msg));
781 base::DictionaryValue* prefs; 780 base::DictionaryValue* prefs;
782 if (!template_value || !template_value->GetAsDictionary(&prefs)) { 781 if (!template_value || !template_value->GetAsDictionary(&prefs)) {
783 return Status(kUnknownError, 782 return Status(kUnknownError,
784 "cannot parse internal JSON template: " + error_msg); 783 "cannot parse internal JSON template: " + error_msg);
785 } 784 }
786 785
787 if (custom_prefs) { 786 if (custom_prefs) {
788 for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd(); 787 for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd();
789 it.Advance()) { 788 it.Advance()) {
790 prefs->Set(it.key(), it.value().DeepCopy()); 789 prefs->Set(it.key(), it.value().DeepCopy());
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 // Write empty "First Run" file, otherwise Chrome will wipe the default 844 // Write empty "First Run" file, otherwise Chrome will wipe the default
846 // profile that was written. 845 // profile that was written.
847 if (base::WriteFile( 846 if (base::WriteFile(
848 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) { 847 user_data_dir.Append(chrome::kFirstRunSentinel), "", 0) != 0) {
849 return Status(kUnknownError, "failed to write first run file"); 848 return Status(kUnknownError, "failed to write first run file");
850 } 849 }
851 return Status(kOk); 850 return Status(kOk);
852 } 851 }
853 852
854 } // namespace internal 853 } // namespace internal
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome/frame_tracker_unittest.cc ('k') | chrome/test/chromedriver/chrome_launcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698