Chromium Code Reviews| Index: chrome/browser/extensions/extension_browser_test_notification_observer.h |
| diff --git a/chrome/browser/extensions/extension_browser_test_notification_observer.h b/chrome/browser/extensions/extension_browser_test_notification_observer.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..73bc62eeacc1d778db7d99971c6884d2de9c3005 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/extension_browser_test_notification_observer.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_NOTIFICATION_OBSERVER_H_ |
| +#define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_NOTIFICATION_OBSERVER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback.h" |
|
Devlin
2016/10/06 15:52:16
needed? (this and others; please trim)
Rahul Chaturvedi
2016/10/11 20:12:35
Done.
|
| +#include "base/compiler_specific.h" |
| +#include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| +#include "content/public/browser/notification_details.h" |
| +#include "content/public/browser/notification_observer.h" |
| +#include "content/public/browser/notification_registrar.h" |
| +#include "content/public/browser/notification_types.h" |
| +#include "extensions/test/extension_test_notification_observer.h" |
| + |
| +class Browser; |
| + |
| +namespace content { |
| +class BrowserContext; |
| +class WindowedNotificationObserver; |
| +} |
| + |
|
Devlin
2016/10/06 15:52:17
Can this file be in the extensions:: namespace?
Rahul Chaturvedi
2016/10/11 20:12:34
I am not sure why this wasn't in the first place,
Devlin
2016/10/11 22:53:45
Can you add a
// TODO(devlin): This should be in t
Rahul Chaturvedi
2016/10/12 20:25:53
Done.
|
| +// Test helper class for observing extension-related events. |
| +class ExtensionBrowserTestNotificationObserver |
|
Devlin
2016/10/06 15:52:16
nit: The common idiom is to name chrome versions C
Rahul Chaturvedi
2016/10/11 20:12:35
Done.
|
| + : public ExtensionTestNotificationObserver, |
| + public extensions::ExtensionActionAPI::Observer { |
| + public: |
| + explicit ExtensionBrowserTestNotificationObserver(Browser*); |
|
Devlin
2016/10/06 15:52:17
chrome style still requires variable naming in hea
Rahul Chaturvedi
2016/10/11 20:12:34
Done.
|
| + ~ExtensionBrowserTestNotificationObserver() override; |
| + |
| + // Wait for the number of visible page actions to change to |count|. |
|
Devlin
2016/10/06 15:52:16
Function descriptions should be descriptive, not i
Rahul Chaturvedi
2016/10/11 20:12:35
Done.
|
| + bool WaitForPageActionVisibilityChangeTo(int count); |
| + |
| + // Waits until an extension is loaded and all view have loaded. |
| + void WaitForExtensionAndViewLoad(); |
| + |
| + // Wait for all extension views to load. |
| + bool WaitForExtensionViewsToLoad(); |
| + |
| + // Wait for extension to be idle. |
| + bool WaitForExtensionIdle(const std::string& extension_id); |
| + |
| + // Wait for extension to be not idle. |
| + bool WaitForExtensionNotIdle(const std::string& extension_id); |
| + |
| + private: |
| + content::BrowserContext* GetBrowserContext(); |
| + |
| + // extensions::ExtensionActionAPI::Observer: |
| + void OnPageActionsUpdated(content::WebContents* contents) override; |
| + |
| + Browser* browser_; |
|
Devlin
2016/10/06 15:52:17
DISALLOW_COPY_AND_ASSIGN
Rahul Chaturvedi
2016/10/11 20:12:35
Done.
|
| +}; |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_TEST_NOTIFICATION_OBSERVER_H_ |