| 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_path.h" | 10 #include "base/file_path.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 const Extension* ExtensionBrowserTest::LoadExtensionAsComponent( | 181 const Extension* ExtensionBrowserTest::LoadExtensionAsComponent( |
| 182 const FilePath& path) { | 182 const FilePath& path) { |
| 183 ExtensionService* service = browser()->profile()->GetExtensionService(); | 183 ExtensionService* service = browser()->profile()->GetExtensionService(); |
| 184 | 184 |
| 185 std::string manifest; | 185 std::string manifest; |
| 186 if (!file_util::ReadFileToString(path.Append(Extension::kManifestFilename), | 186 if (!file_util::ReadFileToString(path.Append(Extension::kManifestFilename), |
| 187 &manifest)) | 187 &manifest)) |
| 188 return NULL; | 188 return NULL; |
| 189 | 189 |
| 190 const Extension* extension = | 190 std::string extension_id = service->component_loader()->Add(manifest, path); |
| 191 service->component_loader()->Add(manifest, path); | 191 const Extension* extension = service->extensions()->GetByID(extension_id); |
| 192 if (!extension) | 192 if (!extension) |
| 193 return NULL; | 193 return NULL; |
| 194 last_loaded_extension_id_ = extension->id(); | 194 last_loaded_extension_id_ = extension->id(); |
| 195 return extension; | 195 return extension; |
| 196 } | 196 } |
| 197 | 197 |
| 198 FilePath ExtensionBrowserTest::PackExtension(const FilePath& dir_path) { | 198 FilePath ExtensionBrowserTest::PackExtension(const FilePath& dir_path) { |
| 199 FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); | 199 FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); |
| 200 if (!file_util::Delete(crx_path, false)) { | 200 if (!file_util::Delete(crx_path, false)) { |
| 201 ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); | 201 ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 case content::NOTIFICATION_LOAD_STOP: | 676 case content::NOTIFICATION_LOAD_STOP: |
| 677 VLOG(1) << "Got LOAD_STOP notification."; | 677 VLOG(1) << "Got LOAD_STOP notification."; |
| 678 MessageLoopForUI::current()->Quit(); | 678 MessageLoopForUI::current()->Quit(); |
| 679 break; | 679 break; |
| 680 | 680 |
| 681 default: | 681 default: |
| 682 NOTREACHED(); | 682 NOTREACHED(); |
| 683 break; | 683 break; |
| 684 } | 684 } |
| 685 } | 685 } |
| OLD | NEW |