Chromium Code Reviews| Index: chrome/browser/ui/website_settings/permission_bubble_browser_test_util.h |
| diff --git a/chrome/browser/ui/website_settings/permission_bubble_browser_test_util.h b/chrome/browser/ui/website_settings/permission_bubble_browser_test_util.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..97ba8e26ae40aa82f7e1777b0bac03a8fb3107a3 |
| --- /dev/null |
| +++ b/chrome/browser/ui/website_settings/permission_bubble_browser_test_util.h |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2015 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_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H_ |
| +#define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H_ |
| + |
| +#include "chrome/browser/extensions/extension_browsertest.h" |
| +#include "chrome/browser/ui/website_settings/permission_bubble_view.h" |
| + |
| +namespace base { |
| +class CommandLine; |
| +} |
| +class PermissionBubbleRequest; |
| +class Browser; |
| + |
| +class TestPermissionBubbleViewDelegate : public PermissionBubbleView::Delegate { |
| + public: |
| + TestPermissionBubbleViewDelegate(); |
| + |
| + void ToggleAccept(int, bool) override {} |
| + void Accept() override {} |
| + void Deny() override {} |
| + void Closing() override {} |
| + void SetView(PermissionBubbleView*) override {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(TestPermissionBubbleViewDelegate); |
| +}; |
| + |
| +// Use this class to test on a default window. |
| +// Inherit from ExtensionBrowserTest instead of InProcessBrowserTest because |
| +// testing app mode requires extensions. |
|
felt
2015/04/17 21:14:58
Is this class then specific to apps/extensions? Sh
hcarmona
2015/04/17 22:21:05
Updated classes so that only PermissionBubbleAppBr
felt
2015/04/17 22:23:23
Thanks, the new inheritance structure looks better
|
| +class PermissionBubbleBrowsertest : public ExtensionBrowserTest { |
| + public: |
| + PermissionBubbleBrowsertest(); |
| + ~PermissionBubbleBrowsertest() override; |
| + |
| + void SetUpOnMainThread() override; |
| + |
| + std::vector<PermissionBubbleRequest*> requests() { return requests_.get(); } |
| + std::vector<bool> accept_states() { return accept_states_; } |
| + PermissionBubbleView::Delegate* test_delegate() { return &test_delegate_; } |
| + |
| + private: |
| + TestPermissionBubbleViewDelegate test_delegate_; |
| + ScopedVector<PermissionBubbleRequest> requests_; |
| + std::vector<bool> accept_states_; |
| +}; |
| + |
| +// Use this class to test on an app window. |
| +class PermissionBubbleAppBrowsertest : public PermissionBubbleBrowsertest { |
| + public: |
| + PermissionBubbleAppBrowsertest(); |
| + ~PermissionBubbleAppBrowsertest() override; |
| + |
| + void SetUpOnMainThread() override; |
| + |
| + Browser* app_browser() { return app_browser_; } |
| + |
| + private: |
| + Browser* app_browser_; |
| + |
| + Browser* OpenExtensionAppWindow(const extensions::Extension* extension); |
| +}; |
| + |
| +// Use this class to test on a kiosk window. |
| +class PermissionBubbleKioskBrowsertest : public PermissionBubbleBrowsertest { |
| + public: |
| + PermissionBubbleKioskBrowsertest(); |
| + ~PermissionBubbleKioskBrowsertest() override; |
| + |
| + void SetUpCommandLine(base::CommandLine* command_line) override; |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H_ |