Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1354)

Unified Diff: chrome/browser/extensions/extension_test_notification_observer.h

Issue 496403003: Remove NOTIFICATION_EXTENSION_PAGE_ACTIONS_UPDATED (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Latest master for CQ Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_test_notification_observer.h
diff --git a/chrome/browser/extensions/extension_test_notification_observer.h b/chrome/browser/extensions/extension_test_notification_observer.h
index e6abdc99291ad15dc89a7416518effcbe0d0d2d1..267d5f44e9ff84a99b5783bf4fd8433fc4cfd884 100644
--- a/chrome/browser/extensions/extension_test_notification_observer.h
+++ b/chrome/browser/extensions/extension_test_notification_observer.h
@@ -7,8 +7,10 @@
#include <string>
+#include "base/callback.h"
#include "base/compiler_specific.h"
#include "chrome/browser/chrome_notification_types.h"
+#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/location_bar/location_bar.h"
#include "content/public/browser/notification_details.h"
@@ -20,14 +22,13 @@ class WindowedNotificationObserver;
}
// Test helper class for observing extension-related events.
-class ExtensionTestNotificationObserver : public content::NotificationObserver {
+class ExtensionTestNotificationObserver
+ : public content::NotificationObserver,
+ public extensions::ExtensionActionAPI::Observer {
public:
explicit ExtensionTestNotificationObserver(Browser* browser);
virtual ~ExtensionTestNotificationObserver();
- // Wait for the total number of page actions to change to |count|.
- bool WaitForPageActionCountChangeTo(int count);
-
// Wait for the number of visible page actions to change to |count|.
bool WaitForPageActionVisibilityChangeTo(int count);
@@ -82,10 +83,25 @@ class ExtensionTestNotificationObserver : public content::NotificationObserver {
const content::NotificationDetails& details) OVERRIDE;
private:
+ class NotificationSet;
+
Profile* GetProfile();
void WaitForNotification(int notification_type);
+ // Wait for |condition_| to be met. |notification_set| is the set of
+ // notifications to wait for and to check |condition| when observing. This
+ // can be NULL if we are instead waiting for a different observer method, like
+ // OnPageActionsUpdated().
+ void WaitForCondition(const base::Callback<bool(void)>& condition,
+ NotificationSet* notification_set);
+
+ // Quits the message loop if |condition_| is met.
+ void MaybeQuit();
+
+ // extensions::ExtensionActionAPI::Observer:
+ virtual void OnPageActionsUpdated(content::WebContents* contents) OVERRIDE;
+
Browser* browser_;
Profile* profile_;
@@ -96,6 +112,13 @@ class ExtensionTestNotificationObserver : public content::NotificationObserver {
int extension_installs_observed_;
int extension_load_errors_observed_;
int crx_installers_done_observed_;
+
+ // The condition for which we are waiting. This should be checked in any
+ // observing methods that could trigger it.
+ base::Callback<bool(void)> condition_;
+
+ // The closure to quit the currently-running message loop.
+ base::Closure quit_closure_;
};
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_TEST_NOTIFICATION_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698