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

Side by Side Diff: chrome/common/extensions/extension_test_util.cc

Issue 925783002: Split ValueSerializer into separate Serializer and Deserializer classes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed cpplint warnings. Created 5 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/extensions/extension_test_util.h" 5 #include "chrome/common/extensions/extension_test_util.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 12 matching lines...) Expand all
23 Manifest::Location location, 23 Manifest::Location location,
24 int extra_flags, 24 int extra_flags,
25 const std::string& id, 25 const std::string& id,
26 std::string* error) { 26 std::string* error) {
27 base::FilePath path; 27 base::FilePath path;
28 PathService::Get(chrome::DIR_TEST_DATA, &path); 28 PathService::Get(chrome::DIR_TEST_DATA, &path);
29 path = path.AppendASCII("extensions") 29 path = path.AppendASCII("extensions")
30 .AppendASCII(dir) 30 .AppendASCII(dir)
31 .AppendASCII(test_file); 31 .AppendASCII(test_file);
32 32
33 JSONFileValueSerializer serializer(path); 33 JSONFileValueDeserializer deserializer(path);
34 scoped_ptr<base::Value> result(serializer.Deserialize(NULL, error)); 34 scoped_ptr<base::Value> result(deserializer.Deserialize(NULL, error));
35 if (!result) 35 if (!result)
36 return NULL; 36 return NULL;
37 const base::DictionaryValue* dict; 37 const base::DictionaryValue* dict;
38 CHECK(result->GetAsDictionary(&dict)); 38 CHECK(result->GetAsDictionary(&dict));
39 39
40 scoped_refptr<Extension> extension = Extension::Create( 40 scoped_refptr<Extension> extension = Extension::Create(
41 path.DirName(), location, *dict, extra_flags, id, error); 41 path.DirName(), location, *dict, extra_flags, id, error);
42 return extension; 42 return extension;
43 } 43 }
44 44
(...skipping 28 matching lines...) Expand all
73 const std::string& test_file) { 73 const std::string& test_file) {
74 return LoadManifest(dir, test_file, Extension::NO_FLAGS); 74 return LoadManifest(dir, test_file, Extension::NO_FLAGS);
75 } 75 }
76 76
77 scoped_refptr<Extension> LoadManifest(const std::string& dir, 77 scoped_refptr<Extension> LoadManifest(const std::string& dir,
78 const std::string& test_file) { 78 const std::string& test_file) {
79 return LoadManifest(dir, test_file, Extension::NO_FLAGS); 79 return LoadManifest(dir, test_file, Extension::NO_FLAGS);
80 } 80 }
81 81
82 } // namespace extension_test_util 82 } // namespace extension_test_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698