| 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_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
| 9 #include "chrome/browser/extensions/api/test/test_api.h" |
| 9 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/extensions/api/test/test_api.h" | 11 #include "chrome/browser/extensions/extension_system.h" |
| 11 #include "chrome/browser/extensions/unpacked_installer.h" | 12 #include "chrome/browser/extensions/unpacked_installer.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/extensions/application_launch.h" | 15 #include "chrome/browser/ui/extensions/application_launch.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 16 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
| 17 #include "chrome/test/base/ui_test_utils.h" | 18 #include "chrome/test/base/ui_test_utils.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 19 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 20 #include "net/base/net_util.h" | 21 #include "net/base/net_util.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 if (!catcher.GetNextResult()) { | 245 if (!catcher.GetNextResult()) { |
| 245 message_ = catcher.message(); | 246 message_ = catcher.message(); |
| 246 return false; | 247 return false; |
| 247 } else { | 248 } else { |
| 248 return true; | 249 return true; |
| 249 } | 250 } |
| 250 } | 251 } |
| 251 | 252 |
| 252 // Test that exactly one extension is loaded, and return it. | 253 // Test that exactly one extension is loaded, and return it. |
| 253 const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { | 254 const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { |
| 254 ExtensionService* service = browser()->profile()->GetExtensionService(); | 255 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 256 browser()->profile())->extension_service(); |
| 255 | 257 |
| 256 const extensions::Extension* extension = NULL; | 258 const extensions::Extension* extension = NULL; |
| 257 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 259 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
| 258 it != service->extensions()->end(); ++it) { | 260 it != service->extensions()->end(); ++it) { |
| 259 // Ignore any component extensions. They are automatically loaded into all | 261 // Ignore any component extensions. They are automatically loaded into all |
| 260 // profiles and aren't the extension we're looking for here. | 262 // profiles and aren't the extension we're looking for here. |
| 261 if ((*it)->location() == extensions::Extension::COMPONENT) | 263 if ((*it)->location() == extensions::Extension::COMPONENT) |
| 262 continue; | 264 continue; |
| 263 | 265 |
| 264 if (extension != NULL) { | 266 if (extension != NULL) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 test_config_->SetInteger(kTestWebSocketPort, | 306 test_config_->SetInteger(kTestWebSocketPort, |
| 305 websocket_server_->host_port_pair().port()); | 307 websocket_server_->host_port_pair().port()); |
| 306 | 308 |
| 307 return true; | 309 return true; |
| 308 } | 310 } |
| 309 | 311 |
| 310 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 312 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
| 311 ExtensionBrowserTest::SetUpCommandLine(command_line); | 313 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 312 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 314 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
| 313 } | 315 } |
| OLD | NEW |