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 10 matching lines...) Expand all Loading... |
21 // the appropriate test directory. | 21 // the appropriate test directory. |
22 base::DictionaryValue* LoadManifestFile(const base::FilePath& filename_path, | 22 base::DictionaryValue* LoadManifestFile(const base::FilePath& filename_path, |
23 std::string* error) { | 23 std::string* error) { |
24 base::FilePath extension_path; | 24 base::FilePath extension_path; |
25 base::FilePath manifest_path; | 25 base::FilePath manifest_path; |
26 | 26 |
27 PathService::Get(chrome::DIR_TEST_DATA, &manifest_path); | 27 PathService::Get(chrome::DIR_TEST_DATA, &manifest_path); |
28 manifest_path = manifest_path.Append(filename_path); | 28 manifest_path = manifest_path.Append(filename_path); |
29 extension_path = manifest_path.DirName(); | 29 extension_path = manifest_path.DirName(); |
30 | 30 |
31 EXPECT_TRUE(file_util::PathExists(manifest_path)) << | 31 EXPECT_TRUE(base::PathExists(manifest_path)) << |
32 "Couldn't find " << manifest_path.value(); | 32 "Couldn't find " << manifest_path.value(); |
33 | 33 |
34 JSONFileValueSerializer serializer(manifest_path); | 34 JSONFileValueSerializer serializer(manifest_path); |
35 base::DictionaryValue* manifest = | 35 base::DictionaryValue* manifest = |
36 static_cast<base::DictionaryValue*>(serializer.Deserialize(NULL, error)); | 36 static_cast<base::DictionaryValue*>(serializer.Deserialize(NULL, error)); |
37 | 37 |
38 // Most unit tests don't need localization, and they'll fail if we try to | 38 // Most unit tests don't need localization, and they'll fail if we try to |
39 // localize them, since their manifests don't have a default_locale key. | 39 // localize them, since their manifests don't have a default_locale key. |
40 // Only localize manifests that indicate they want to be localized. | 40 // Only localize manifests that indicate they want to be localized. |
41 // Calling LocalizeExtension at this point mirrors | 41 // Calling LocalizeExtension at this point mirrors |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 testcase.location_, | 250 testcase.location_, |
251 testcase.flags_); | 251 testcase.flags_); |
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 } |
OLD | NEW |