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 "extensions/common/manifest_test.h" | 5 #include "extensions/common/manifest_test.h" |
6 | 6 |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/json/json_file_value_serializer.h" | 9 #include "base/json/json_file_value_serializer.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 // |manifest_path| is an absolute path to a manifest file. | 22 // |manifest_path| is an absolute path to a manifest file. |
23 base::DictionaryValue* LoadManifestFile(const base::FilePath& manifest_path, | 23 base::DictionaryValue* LoadManifestFile(const base::FilePath& manifest_path, |
24 std::string* error) { | 24 std::string* error) { |
25 base::FilePath extension_path = manifest_path.DirName(); | 25 base::FilePath extension_path = manifest_path.DirName(); |
26 | 26 |
27 EXPECT_TRUE(base::PathExists(manifest_path)) << | 27 EXPECT_TRUE(base::PathExists(manifest_path)) << |
28 "Couldn't find " << manifest_path.value(); | 28 "Couldn't find " << manifest_path.value(); |
29 | 29 |
30 JSONFileValueDeserializer deserializer(manifest_path); | 30 JSONFileValueDeserializer deserializer(manifest_path); |
31 base::DictionaryValue* manifest = static_cast<base::DictionaryValue*>( | 31 base::DictionaryValue* manifest = static_cast<base::DictionaryValue*>( |
32 deserializer.Deserialize(NULL, error)); | 32 deserializer.Deserialize(NULL, error).release()); |
33 | 33 |
34 // Most unit tests don't need localization, and they'll fail if we try to | 34 // Most unit tests don't need localization, and they'll fail if we try to |
35 // localize them, since their manifests don't have a default_locale key. | 35 // localize them, since their manifests don't have a default_locale key. |
36 // Only localize manifests that indicate they want to be localized. | 36 // Only localize manifests that indicate they want to be localized. |
37 // Calling LocalizeExtension at this point mirrors file_util::LoadExtension. | 37 // Calling LocalizeExtension at this point mirrors file_util::LoadExtension. |
38 if (manifest && | 38 if (manifest && |
39 manifest_path.value().find(FILE_PATH_LITERAL("localized")) != | 39 manifest_path.value().find(FILE_PATH_LITERAL("localized")) != |
40 std::string::npos) | 40 std::string::npos) |
41 extension_l10n_util::LocalizeExtension(extension_path, manifest, error); | 41 extension_l10n_util::LocalizeExtension(extension_path, manifest, error); |
42 | 42 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 break; | 252 break; |
253 case EXPECT_TYPE_SUCCESS: | 253 case EXPECT_TYPE_SUCCESS: |
254 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), | 254 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), |
255 testcase.location_, | 255 testcase.location_, |
256 testcase.flags_); | 256 testcase.flags_); |
257 break; | 257 break; |
258 } | 258 } |
259 } | 259 } |
260 | 260 |
261 } // namespace extensions | 261 } // namespace extensions |
OLD | NEW |