OLD | NEW |
| (Empty) |
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. | |
4 | |
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
_ | |
7 | |
8 #include "chrome/browser/extensions/extension_browsertest.h" | |
9 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" | |
10 | |
11 namespace base { | |
12 class CommandLine; | |
13 } | |
14 class PermissionBubbleRequest; | |
15 class Browser; | |
16 | |
17 class TestPermissionBubbleViewDelegate : public PermissionBubbleView::Delegate { | |
18 public: | |
19 TestPermissionBubbleViewDelegate(); | |
20 | |
21 void ToggleAccept(int, bool) override {} | |
22 void Accept() override {} | |
23 void Deny() override {} | |
24 void Closing() override {} | |
25 void SetView(PermissionBubbleView*) override {} | |
26 | |
27 private: | |
28 DISALLOW_COPY_AND_ASSIGN(TestPermissionBubbleViewDelegate); | |
29 }; | |
30 | |
31 // Use this class to test on a default window. | |
32 class PermissionBubbleBrowserTest : public virtual InProcessBrowserTest { | |
33 public: | |
34 PermissionBubbleBrowserTest(); | |
35 ~PermissionBubbleBrowserTest() override; | |
36 | |
37 void SetUpOnMainThread() override; | |
38 | |
39 std::vector<PermissionBubbleRequest*> requests() { return requests_.get(); } | |
40 std::vector<bool> accept_states() { return accept_states_; } | |
41 PermissionBubbleView::Delegate* test_delegate() { return &test_delegate_; } | |
42 | |
43 private: | |
44 TestPermissionBubbleViewDelegate test_delegate_; | |
45 ScopedVector<PermissionBubbleRequest> requests_; | |
46 std::vector<bool> accept_states_; | |
47 }; | |
48 | |
49 // Use this class to test on an app window. | |
50 class PermissionBubbleAppBrowserTest : public PermissionBubbleBrowserTest, | |
51 public ExtensionBrowserTest { | |
52 public: | |
53 PermissionBubbleAppBrowserTest(); | |
54 ~PermissionBubbleAppBrowserTest() override; | |
55 | |
56 void SetUpOnMainThread() override; | |
57 | |
58 // Override from ExtensionBrowserTest to avoid "inheritance via dominance". | |
59 void SetUp() override; | |
60 void SetUpCommandLine(base::CommandLine* command_line) override; | |
61 | |
62 Browser* app_browser() { return app_browser_; } | |
63 | |
64 private: | |
65 Browser* app_browser_; | |
66 | |
67 Browser* OpenExtensionAppWindow(const extensions::Extension* extension); | |
68 }; | |
69 | |
70 // Use this class to test on a kiosk window. | |
71 class PermissionBubbleKioskBrowserTest : public PermissionBubbleBrowserTest { | |
72 public: | |
73 PermissionBubbleKioskBrowserTest(); | |
74 ~PermissionBubbleKioskBrowserTest() override; | |
75 | |
76 void SetUpCommandLine(base::CommandLine* command_line) override; | |
77 }; | |
78 | |
79 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTI
L_H_ | |
OLD | NEW |