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