summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_apitest.h
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.h
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.h')
-rw-r--r--chrome/browser/extensions/extension_apitest.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extension_apitest.h b/chrome/browser/extensions/extension_apitest.h
index 01ada82..bd05fe5 100644
--- a/chrome/browser/extensions/extension_apitest.h
+++ b/chrome/browser/extensions/extension_apitest.h
@@ -8,6 +8,8 @@
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/common/notification_service.h"
+class Extension;
+
// The general flow of these API tests should work like this:
// (1) Setup initial browser state (e.g. create some bookmarks for the
// bookmark test)
@@ -19,10 +21,11 @@
class ExtensionApiTest : public ExtensionBrowserTest {
protected:
- // Helper class that observes tests failing or passing. Observation starts when
- // the class is constructed. Get the next result by calling GetNextResult() and
- // message() if GetNextResult() return false. If there are no results, this
- // method will pump the UI message loop until one is received.
+ // Helper class that observes tests failing or passing. Observation starts
+ // when the class is constructed. Get the next result by calling
+ // GetNextResult() and message() if GetNextResult() return false. If there
+ // are no results, this method will pump the UI message loop until one is
+ // received.
class ResultCatcher : public NotificationObserver {
public:
ResultCatcher();
@@ -34,7 +37,8 @@ class ExtensionApiTest : public ExtensionBrowserTest {
const std::string& message() { return message_; }
private:
- virtual void Observe(NotificationType type, const NotificationSource& source,
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
const NotificationDetails& details);
NotificationRegistrar registrar_;
@@ -51,6 +55,10 @@ class ExtensionApiTest : public ExtensionBrowserTest {
// |extension_name| is a directory in "test/data/extensions/api_test".
bool RunExtensionTest(const char* extension_name);
+ // Test that exactly one extension loaded. If so, return a pointer to
+ // the extension. If not, return NULL and set message_.
+ Extension* GetSingleLoadedExtension();
+
// All extensions tested by ExtensionApiTest are in the "api_test" dir.
virtual void SetUpCommandLine(CommandLine* command_line);