| 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/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 232 |
| 233 const Extension* ExtensionBrowserTest::LoadExtensionAsComponent( | 233 const Extension* ExtensionBrowserTest::LoadExtensionAsComponent( |
| 234 const base::FilePath& path) { | 234 const base::FilePath& path) { |
| 235 return LoadExtensionAsComponentWithManifest(path, | 235 return LoadExtensionAsComponentWithManifest(path, |
| 236 extensions::kManifestFilename); | 236 extensions::kManifestFilename); |
| 237 } | 237 } |
| 238 | 238 |
| 239 base::FilePath ExtensionBrowserTest::PackExtension( | 239 base::FilePath ExtensionBrowserTest::PackExtension( |
| 240 const base::FilePath& dir_path) { | 240 const base::FilePath& dir_path) { |
| 241 base::FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); | 241 base::FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); |
| 242 if (!file_util::Delete(crx_path, false)) { | 242 if (!base::Delete(crx_path, false)) { |
| 243 ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); | 243 ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); |
| 244 return base::FilePath(); | 244 return base::FilePath(); |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Look for PEM files with the same name as the directory. | 247 // Look for PEM files with the same name as the directory. |
| 248 base::FilePath pem_path = | 248 base::FilePath pem_path = |
| 249 dir_path.ReplaceExtension(FILE_PATH_LITERAL(".pem")); | 249 dir_path.ReplaceExtension(FILE_PATH_LITERAL(".pem")); |
| 250 base::FilePath pem_path_out; | 250 base::FilePath pem_path_out; |
| 251 | 251 |
| 252 if (!file_util::PathExists(pem_path)) { | 252 if (!file_util::PathExists(pem_path)) { |
| 253 pem_path = base::FilePath(); | 253 pem_path = base::FilePath(); |
| 254 pem_path_out = crx_path.DirName().AppendASCII("temp.pem"); | 254 pem_path_out = crx_path.DirName().AppendASCII("temp.pem"); |
| 255 if (!file_util::Delete(pem_path_out, false)) { | 255 if (!base::Delete(pem_path_out, false)) { |
| 256 ADD_FAILURE() << "Failed to delete pem: " << pem_path_out.value(); | 256 ADD_FAILURE() << "Failed to delete pem: " << pem_path_out.value(); |
| 257 return base::FilePath(); | 257 return base::FilePath(); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 return PackExtensionWithOptions(dir_path, crx_path, pem_path, pem_path_out); | 261 return PackExtensionWithOptions(dir_path, crx_path, pem_path, pem_path_out); |
| 262 } | 262 } |
| 263 | 263 |
| 264 base::FilePath ExtensionBrowserTest::PackExtensionWithOptions( | 264 base::FilePath ExtensionBrowserTest::PackExtensionWithOptions( |
| 265 const base::FilePath& dir_path, | 265 const base::FilePath& dir_path, |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 733 case content::NOTIFICATION_LOAD_STOP: | 733 case content::NOTIFICATION_LOAD_STOP: |
| 734 VLOG(1) << "Got LOAD_STOP notification."; | 734 VLOG(1) << "Got LOAD_STOP notification."; |
| 735 base::MessageLoopForUI::current()->Quit(); | 735 base::MessageLoopForUI::current()->Quit(); |
| 736 break; | 736 break; |
| 737 | 737 |
| 738 default: | 738 default: |
| 739 NOTREACHED(); | 739 NOTREACHED(); |
| 740 break; | 740 break; |
| 741 } | 741 } |
| 742 } | 742 } |
| OLD | NEW |