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/manifest_tests/extension_manifest_test.h" | 5 #include "chrome/common/extensions/manifest_tests/extension_manifest_test.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.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 21 matching lines...) Expand all Loading... |
32 EXPECT_TRUE(base::PathExists(manifest_path)) << | 32 EXPECT_TRUE(base::PathExists(manifest_path)) << |
33 "Couldn't find " << manifest_path.value(); | 33 "Couldn't find " << manifest_path.value(); |
34 | 34 |
35 JSONFileValueSerializer serializer(manifest_path); | 35 JSONFileValueSerializer serializer(manifest_path); |
36 base::DictionaryValue* manifest = | 36 base::DictionaryValue* manifest = |
37 static_cast<base::DictionaryValue*>(serializer.Deserialize(NULL, error)); | 37 static_cast<base::DictionaryValue*>(serializer.Deserialize(NULL, error)); |
38 | 38 |
39 // Most unit tests don't need localization, and they'll fail if we try to | 39 // Most unit tests don't need localization, and they'll fail if we try to |
40 // localize them, since their manifests don't have a default_locale key. | 40 // localize them, since their manifests don't have a default_locale key. |
41 // Only localize manifests that indicate they want to be localized. | 41 // Only localize manifests that indicate they want to be localized. |
42 // Calling LocalizeExtension at this point mirrors | 42 // Calling LocalizeExtension at this point mirrors file_util::LoadExtension. |
43 // extension_file_util::LoadExtension. | |
44 if (manifest && | 43 if (manifest && |
45 filename_path.value().find(FILE_PATH_LITERAL("localized")) != | 44 filename_path.value().find(FILE_PATH_LITERAL("localized")) != |
46 std::string::npos) | 45 std::string::npos) |
47 extension_l10n_util::LocalizeExtension(extension_path, manifest, error); | 46 extension_l10n_util::LocalizeExtension(extension_path, manifest, error); |
48 | 47 |
49 return manifest; | 48 return manifest; |
50 } | 49 } |
51 | 50 |
52 } // namespace | 51 } // namespace |
53 | 52 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 testcase.location_, | 272 testcase.location_, |
274 testcase.flags_); | 273 testcase.flags_); |
275 break; | 274 break; |
276 case EXPECT_TYPE_SUCCESS: | 275 case EXPECT_TYPE_SUCCESS: |
277 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), | 276 LoadAndExpectSuccess(testcase.manifest_filename_.c_str(), |
278 testcase.location_, | 277 testcase.location_, |
279 testcase.flags_); | 278 testcase.flags_); |
280 break; | 279 break; |
281 } | 280 } |
282 } | 281 } |
OLD | NEW |