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/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 | 386 |
387 return true; | 387 return true; |
388 } | 388 } |
389 | 389 |
390 // Test that exactly one extension is loaded, and return it. | 390 // Test that exactly one extension is loaded, and return it. |
391 const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { | 391 const extensions::Extension* ExtensionApiTest::GetSingleLoadedExtension() { |
392 ExtensionService* service = extensions::ExtensionSystem::Get( | 392 ExtensionService* service = extensions::ExtensionSystem::Get( |
393 browser()->profile())->extension_service(); | 393 browser()->profile())->extension_service(); |
394 | 394 |
395 const extensions::Extension* extension = NULL; | 395 const extensions::Extension* extension = NULL; |
396 for (ExtensionSet::const_iterator it = service->extensions()->begin(); | 396 for (extensions::ExtensionSet::const_iterator it = |
| 397 service->extensions()->begin(); |
397 it != service->extensions()->end(); ++it) { | 398 it != service->extensions()->end(); ++it) { |
398 // Ignore any component extensions. They are automatically loaded into all | 399 // Ignore any component extensions. They are automatically loaded into all |
399 // profiles and aren't the extension we're looking for here. | 400 // profiles and aren't the extension we're looking for here. |
400 if ((*it)->location() == extensions::Manifest::COMPONENT) | 401 if ((*it)->location() == extensions::Manifest::COMPONENT) |
401 continue; | 402 continue; |
402 | 403 |
403 if (extension != NULL) { | 404 if (extension != NULL) { |
404 // TODO(yoz): this is misleading; it counts component extensions. | 405 // TODO(yoz): this is misleading; it counts component extensions. |
405 message_ = base::StringPrintf( | 406 message_ = base::StringPrintf( |
406 "Expected only one extension to be present. Found %u.", | 407 "Expected only one extension to be present. Found %u.", |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 test_config_->SetInteger(kSpawnedTestServerPort, | 458 test_config_->SetInteger(kSpawnedTestServerPort, |
458 test_server()->host_port_pair().port()); | 459 test_server()->host_port_pair().port()); |
459 | 460 |
460 return true; | 461 return true; |
461 } | 462 } |
462 | 463 |
463 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { | 464 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { |
464 ExtensionBrowserTest::SetUpCommandLine(command_line); | 465 ExtensionBrowserTest::SetUpCommandLine(command_line); |
465 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); | 466 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); |
466 } | 467 } |
OLD | NEW |