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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 kFlagEnableFileAccess | kFlagEnableIncognito); | 213 kFlagEnableFileAccess | kFlagEnableIncognito); |
214 } | 214 } |
215 | 215 |
216 const Extension* ExtensionBrowserTest::LoadExtensionAsComponentWithManifest( | 216 const Extension* ExtensionBrowserTest::LoadExtensionAsComponentWithManifest( |
217 const base::FilePath& path, | 217 const base::FilePath& path, |
218 const base::FilePath::CharType* manifest_relative_path) { | 218 const base::FilePath::CharType* manifest_relative_path) { |
219 ExtensionService* service = extensions::ExtensionSystem::Get( | 219 ExtensionService* service = extensions::ExtensionSystem::Get( |
220 profile())->extension_service(); | 220 profile())->extension_service(); |
221 | 221 |
222 std::string manifest; | 222 std::string manifest; |
223 if (!file_util::ReadFileToString(path.Append(manifest_relative_path), | 223 if (!base::ReadFileToString(path.Append(manifest_relative_path), &manifest)) { |
224 &manifest)) { | |
225 return NULL; | 224 return NULL; |
226 } | 225 } |
227 | 226 |
228 std::string extension_id = service->component_loader()->Add(manifest, path); | 227 std::string extension_id = service->component_loader()->Add(manifest, path); |
229 const Extension* extension = service->extensions()->GetByID(extension_id); | 228 const Extension* extension = service->extensions()->GetByID(extension_id); |
230 if (!extension) | 229 if (!extension) |
231 return NULL; | 230 return NULL; |
232 last_loaded_extension_id_ = extension->id(); | 231 last_loaded_extension_id_ = extension->id(); |
233 return extension; | 232 return extension; |
234 } | 233 } |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: | 755 case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: |
757 VLOG(1) << "Got LOAD_STOP or WEB_CONTENTS_DESTROYED notification."; | 756 VLOG(1) << "Got LOAD_STOP or WEB_CONTENTS_DESTROYED notification."; |
758 base::MessageLoopForUI::current()->Quit(); | 757 base::MessageLoopForUI::current()->Quit(); |
759 break; | 758 break; |
760 | 759 |
761 default: | 760 default: |
762 NOTREACHED(); | 761 NOTREACHED(); |
763 break; | 762 break; |
764 } | 763 } |
765 } | 764 } |
OLD | NEW |