summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_apitest.cc
diff options
context:
space:
mode:
authorskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-02 21:37:45 +0000
committerskerner@chromium.org <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-02 21:37:45 +0000
commit5f9c249d80cd424784f5c34542c82e5ef4188b1e (patch)
tree777fae44cdd89baab991b4e11188c5f3beb92b71 /chrome/browser/extensions/extension_apitest.cc
parent0133392bbbd8eb9e3a7a6064ca5b202e58f0a34b (diff)
downloadchromium_src-5f9c249d80cd424784f5c34542c82e5ef4188b1e.zip
chromium_src-5f9c249d80cd424784f5c34542c82e5ef4188b1e.tar.gz
chromium_src-5f9c249d80cd424784f5c34542c82e5ef4188b1e.tar.bz2
Move repetive testing code into a method of the base class used for testing extension actions.
BUG=None TEST=Run unit tests that were altered. Review URL: http://codereview.chromium.org/558046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37884 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_apitest.cc')
-rw-r--r--chrome/browser/extensions/extension_apitest.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extension_apitest.cc b/chrome/browser/extensions/extension_apitest.cc
index 65f1058..498e437 100644
--- a/chrome/browser/extensions/extension_apitest.cc
+++ b/chrome/browser/extensions/extension_apitest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/browser.h"
+#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/test/ui_test_utils.h"
@@ -81,6 +82,23 @@ bool ExtensionApiTest::RunExtensionTest(const char* extension_name) {
}
}
+// Test that exactly one extension loaded.
+Extension* ExtensionApiTest::GetSingleLoadedExtension() {
+ ExtensionsService* service = browser()->profile()->GetExtensionsService();
+ if (service->extensions()->size() != 1u) {
+ message_ = StringPrintf(
+ "Expected only one extension to be present. Found %u.",
+ static_cast<unsigned>(service->extensions()->size()));
+ return NULL;
+ }
+ Extension* extension = service->extensions()->at(0);
+ if (!extension) {
+ message_ = "extension pointer is NULL.";
+ return NULL;
+ }
+ return extension;
+}
+
void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) {
ExtensionBrowserTest::SetUpCommandLine(command_line);
test_data_dir_ = test_data_dir_.AppendASCII("api_test");