OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 135 |
136 const Extension* ExtensionBrowserTest::LoadExtension(const FilePath& path) { | 136 const Extension* ExtensionBrowserTest::LoadExtension(const FilePath& path) { |
137 return LoadExtensionWithOptions(path, false, true); | 137 return LoadExtensionWithOptions(path, false, true); |
138 } | 138 } |
139 | 139 |
140 const Extension* ExtensionBrowserTest::LoadExtensionIncognito( | 140 const Extension* ExtensionBrowserTest::LoadExtensionIncognito( |
141 const FilePath& path) { | 141 const FilePath& path) { |
142 return LoadExtensionWithOptions(path, true, true); | 142 return LoadExtensionWithOptions(path, true, true); |
143 } | 143 } |
144 | 144 |
145 bool ExtensionBrowserTest::LoadExtensionAsComponent(const FilePath& path) { | 145 const Extension* ExtensionBrowserTest::LoadExtensionAsComponent( |
| 146 const FilePath& path) { |
146 ExtensionService* service = browser()->profile()->GetExtensionService(); | 147 ExtensionService* service = browser()->profile()->GetExtensionService(); |
147 | 148 |
148 std::string manifest; | 149 std::string manifest; |
149 if (!file_util::ReadFileToString(path.Append(Extension::kManifestFilename), | 150 if (!file_util::ReadFileToString(path.Append(Extension::kManifestFilename), |
150 &manifest)) | 151 &manifest)) |
151 return false; | 152 return NULL; |
152 | 153 |
153 service->component_loader()->Add(manifest, path); | 154 const Extension* extension = |
154 | 155 service->component_loader()->Add(manifest, path); |
155 return true; | 156 if (!extension) |
| 157 return NULL; |
| 158 last_loaded_extension_id_ = extension->id(); |
| 159 return extension; |
156 } | 160 } |
157 | 161 |
158 FilePath ExtensionBrowserTest::PackExtension(const FilePath& dir_path) { | 162 FilePath ExtensionBrowserTest::PackExtension(const FilePath& dir_path) { |
159 FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); | 163 FilePath crx_path = temp_dir_.path().AppendASCII("temp.crx"); |
160 if (!file_util::Delete(crx_path, false)) { | 164 if (!file_util::Delete(crx_path, false)) { |
161 ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); | 165 ADD_FAILURE() << "Failed to delete crx: " << crx_path.value(); |
162 return FilePath(); | 166 return FilePath(); |
163 } | 167 } |
164 | 168 |
165 FilePath pem_path = crx_path.DirName().AppendASCII("temp.pem"); | 169 FilePath pem_path = crx_path.DirName().AppendASCII("temp.pem"); |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 MessageLoopForUI::current()->Quit(); | 504 MessageLoopForUI::current()->Quit(); |
501 } | 505 } |
502 break; | 506 break; |
503 } | 507 } |
504 | 508 |
505 default: | 509 default: |
506 NOTREACHED(); | 510 NOTREACHED(); |
507 break; | 511 break; |
508 } | 512 } |
509 } | 513 } |
OLD | NEW |