OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |