Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / website_settings / permission_bubble_browser_test_util.h
blobaed83ef524e5085ba80c6938aeb21ac202b30754
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H_
8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/ui/website_settings/permission_bubble_view.h"
11 namespace base {
12 class CommandLine;
14 class PermissionBubbleRequest;
15 class Browser;
17 class TestPermissionBubbleViewDelegate : public PermissionBubbleView::Delegate {
18 public:
19 TestPermissionBubbleViewDelegate();
21 void ToggleAccept(int, bool) override {}
22 void Accept() override {}
23 void Deny() override {}
24 void Closing() override {}
26 private:
27 DISALLOW_COPY_AND_ASSIGN(TestPermissionBubbleViewDelegate);
30 // Use this class to test on a default window or an app window. Inheriting from
31 // ExtensionBrowserTest allows us to easily load and launch apps, and doesn't
32 // really add any extra work.
33 class PermissionBubbleBrowserTest : public ExtensionBrowserTest {
34 public:
35 PermissionBubbleBrowserTest();
36 ~PermissionBubbleBrowserTest() override;
38 void SetUpOnMainThread() override;
40 // Opens an app window, and returns the associated browser.
41 Browser* OpenExtensionAppWindow();
43 std::vector<PermissionBubbleRequest*> requests() { return requests_.get(); }
44 std::vector<bool> accept_states() { return accept_states_; }
45 PermissionBubbleView::Delegate* test_delegate() { return &test_delegate_; }
47 private:
48 TestPermissionBubbleViewDelegate test_delegate_;
49 ScopedVector<PermissionBubbleRequest> requests_;
50 std::vector<bool> accept_states_;
52 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleBrowserTest);
55 // Use this class to test on a kiosk window.
56 class PermissionBubbleKioskBrowserTest : public PermissionBubbleBrowserTest {
57 public:
58 PermissionBubbleKioskBrowserTest();
59 ~PermissionBubbleKioskBrowserTest() override;
61 void SetUpCommandLine(base::CommandLine* command_line) override;
63 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleKioskBrowserTest);
66 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H_