OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/extensions/test_extension_dir.h" | 5 #include "chrome/browser/extensions/test_extension_dir.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/safe_numerics.h" | 9 #include "base/safe_numerics.h" |
10 #include "base/test/values_test_util.h" | 10 #include "base/test/values_test_util.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // This function packs the extension into a .crx, and returns the path to that | 39 // This function packs the extension into a .crx, and returns the path to that |
40 // .crx. Multiple calls to Pack() will produce extensions with the same ID. | 40 // .crx. Multiple calls to Pack() will produce extensions with the same ID. |
41 base::FilePath TestExtensionDir::Pack() { | 41 base::FilePath TestExtensionDir::Pack() { |
42 ExtensionCreator creator; | 42 ExtensionCreator creator; |
43 base::FilePath crx_path = | 43 base::FilePath crx_path = |
44 crx_dir_.path().Append(FILE_PATH_LITERAL("ext.crx")); | 44 crx_dir_.path().Append(FILE_PATH_LITERAL("ext.crx")); |
45 base::FilePath pem_path = | 45 base::FilePath pem_path = |
46 crx_dir_.path().Append(FILE_PATH_LITERAL("ext.pem")); | 46 crx_dir_.path().Append(FILE_PATH_LITERAL("ext.pem")); |
47 base::FilePath pem_in_path, pem_out_path; | 47 base::FilePath pem_in_path, pem_out_path; |
48 if (file_util::PathExists(pem_path)) | 48 if (base::PathExists(pem_path)) |
49 pem_in_path = pem_path; | 49 pem_in_path = pem_path; |
50 else | 50 else |
51 pem_out_path = pem_path; | 51 pem_out_path = pem_path; |
52 if (!creator.Run(dir_.path(), | 52 if (!creator.Run(dir_.path(), |
53 crx_path, | 53 crx_path, |
54 pem_in_path, | 54 pem_in_path, |
55 pem_out_path, | 55 pem_out_path, |
56 ExtensionCreator::kOverwriteCRX)) { | 56 ExtensionCreator::kOverwriteCRX)) { |
57 ADD_FAILURE() | 57 ADD_FAILURE() |
58 << "ExtensionCreator::Run() failed: " << creator.error_message(); | 58 << "ExtensionCreator::Run() failed: " << creator.error_message(); |
59 return base::FilePath(); | 59 return base::FilePath(); |
60 } | 60 } |
61 if (!file_util::PathExists(crx_path)) { | 61 if (!base::PathExists(crx_path)) { |
62 ADD_FAILURE() << crx_path.value() << " was not created."; | 62 ADD_FAILURE() << crx_path.value() << " was not created."; |
63 return base::FilePath(); | 63 return base::FilePath(); |
64 } | 64 } |
65 return crx_path; | 65 return crx_path; |
66 } | 66 } |
67 | 67 |
68 } // namespace extensions | 68 } // namespace extensions |
OLD | NEW |