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 } | 18 } |
19 | 19 |
| 20 namespace extensions { |
| 21 |
20 // Test helper class for observing extension-related events. | 22 // Test helper class for observing extension-related events. |
21 // TODO(devlin): This should be in the extensions namespace. | |
22 class ChromeExtensionTestNotificationObserver | 23 class ChromeExtensionTestNotificationObserver |
23 : public ExtensionTestNotificationObserver, | 24 : public ExtensionTestNotificationObserver, |
24 public extensions::ExtensionActionAPI::Observer { | 25 public ExtensionActionAPI::Observer { |
25 public: | 26 public: |
26 explicit ChromeExtensionTestNotificationObserver(Browser* browser); | 27 explicit ChromeExtensionTestNotificationObserver(Browser* browser); |
27 explicit ChromeExtensionTestNotificationObserver( | 28 explicit ChromeExtensionTestNotificationObserver( |
28 content::BrowserContext* browser_context); | 29 content::BrowserContext* browser_context); |
29 ~ChromeExtensionTestNotificationObserver() override; | 30 ~ChromeExtensionTestNotificationObserver() override; |
30 | 31 |
31 // 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|. |
32 bool WaitForPageActionVisibilityChangeTo(int count); | 33 bool WaitForPageActionVisibilityChangeTo(int count); |
33 | 34 |
34 // Waits until an extension is loaded and all view have loaded. | 35 // Waits until an extension is loaded and all view have loaded. |
35 void WaitForExtensionAndViewLoad(); | 36 void WaitForExtensionAndViewLoad(); |
36 | 37 |
37 // Waits for all extension views to load. | 38 // Waits for all extension views to load. |
38 bool WaitForExtensionViewsToLoad(); | 39 bool WaitForExtensionViewsToLoad(); |
39 | 40 |
40 // Waits for extension to be idle. | 41 // Waits for extension to be idle. |
41 bool WaitForExtensionIdle(const std::string& extension_id); | 42 bool WaitForExtensionIdle(const std::string& extension_id); |
42 | 43 |
43 // Waits for extension to be not idle. | 44 // Waits for extension to be not idle. |
44 bool WaitForExtensionNotIdle(const std::string& extension_id); | 45 bool WaitForExtensionNotIdle(const std::string& extension_id); |
45 | 46 |
46 private: | 47 private: |
47 content::BrowserContext* GetBrowserContext(); | 48 content::BrowserContext* GetBrowserContext(); |
48 | 49 |
49 // extensions::ExtensionActionAPI::Observer: | 50 // ExtensionActionAPI::Observer: |
50 void OnPageActionsUpdated(content::WebContents* contents) override; | 51 void OnPageActionsUpdated(content::WebContents* contents) override; |
51 | 52 |
52 Browser* browser_; | 53 Browser* browser_; |
53 | 54 |
54 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionTestNotificationObserver); | 55 DISALLOW_COPY_AND_ASSIGN(ChromeExtensionTestNotificationObserver); |
55 }; | 56 }; |
56 | 57 |
| 58 } // namespace extensions |
| 59 |
57 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER
_H_ | 60 #endif // CHROME_BROWSER_EXTENSIONS_CHROME_EXTENSION_TEST_NOTIFICATION_OBSERVER
_H_ |
OLD | NEW |