| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 11 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| 12 #include "extensions/test/extension_test_notification_observer.h" | 12 #include "extensions/test/extension_test_notification_observer.h" |
| 13 | 13 |
| 14 class Browser; | 14 class Browser; |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 class BrowserContext; | 17 class BrowserContext; |
| 18 class WindowedNotificationObserver; | 18 class WindowedNotificationObserver; |
| 19 } | 19 } |
| 20 | 20 |
| 21 // Test helper class for observing extension-related events. | 21 // Test helper class for observing extension-related events. |
| 22 // TODO(devlin): This should be in the extensions namespace. | 22 // TODO(devlin): This should be in the extensions namespace. |
| 23 class ChromeExtensionTestNotificationObserver | 23 class ChromeExtensionTestNotificationObserver |
| 24 : public ExtensionTestNotificationObserver, | 24 : public ExtensionTestNotificationObserver, |
| 25 public extensions::ExtensionActionAPI::Observer { | 25 public extensions::ExtensionActionAPI::Observer { |
| 26 public: | 26 public: |
| 27 explicit ChromeExtensionTestNotificationObserver(Browser* browser); | 27 explicit ChromeExtensionTestNotificationObserver(Browser* browser); |
| 28 explicit ChromeExtensionTestNotificationObserver( |
| 29 content::BrowserContext* browser_context); |
| 28 ~ChromeExtensionTestNotificationObserver() override; | 30 ~ChromeExtensionTestNotificationObserver() override; |
| 29 | 31 |
| 30 // Waits for the number of visible page actions to change to |count|. | 32 // Waits for the number of visible page actions to change to |count|. |
| 31 bool WaitForPageActionVisibilityChangeTo(int count); | 33 bool WaitForPageActionVisibilityChangeTo(int count); |
| 32 | 34 |
| 33 // Waits until an extension is loaded and all view have loaded. | 35 // Waits until an extension is loaded and all view have loaded. |
| 34 void WaitForExtensionAndViewLoad(); | 36 void WaitForExtensionAndViewLoad(); |
| 35 | 37 |
| 36 // Waits for all extension views to load. | 38 // Waits for all extension views to load. |
| 37 bool WaitForExtensionViewsToLoad(); | 39 bool WaitForExtensionViewsToLoad(); |
| 38 | 40 |
| 39 // Waits for extension to be idle. | 41 // Waits for extension to be idle. |
| 40 bool WaitForExtensionIdle(const std::string& extension_id); | 42 bool WaitForExtensionIdle(const std::string& extension_id); |
| 41 | 43 |
| 42 // Waits for extension to be not idle. | 44 // Waits for extension to be not idle. |
| 43 bool WaitForExtensionNotIdle(const std::string& extension_id); | 45 bool WaitForExtensionNotIdle(const std::string& extension_id); |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 content::BrowserContext* GetBrowserContext(); | 48 content::BrowserContext* GetBrowserContext(); |
| 47 | 49 |
| 48 // extensions::ExtensionActionAPI::Observer: | 50 // extensions::ExtensionActionAPI::Observer: |
| 49 void OnPageActionsUpdated(content::WebContents* contents) override; | 51 void OnPageActionsUpdated(content::WebContents* contents) override; |
| 50 | 52 |
| 51 Browser* browser_; | 53 Browser* browser_; |
| 52 | 54 |
| 53 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionTestNotificationObserver); | 55 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionTestNotificationObserver); |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER
_H_ | 58 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER
_H_ |
| OLD | NEW |