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 <memory> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "chrome/browser/extensions/extension_browsertest.h" | |
13 #include "chrome/browser/ui/website_settings/permission_prompt.h" | |
14 | |
15 namespace base { | |
16 class CommandLine; | |
17 } | |
18 class PermissionRequest; | |
19 class Browser; | |
20 | |
21 class TestPermissionBubbleViewDelegate : public PermissionPrompt::Delegate { | |
22 public: | |
23 TestPermissionBubbleViewDelegate(); | |
24 | |
25 void ToggleAccept(int, bool) override {} | |
26 void TogglePersist(bool) override {} | |
27 void Accept() override {} | |
28 void Deny() override {} | |
29 void Closing() override {} | |
30 | |
31 private: | |
32 DISALLOW_COPY_AND_ASSIGN(TestPermissionBubbleViewDelegate); | |
33 }; | |
34 | |
35 // Use this class to test on a default window or an app window. Inheriting from | |
36 // ExtensionBrowserTest allows us to easily load and launch apps, and doesn't | |
37 // really add any extra work. | |
38 class PermissionBubbleBrowserTest : public ExtensionBrowserTest { | |
39 public: | |
40 PermissionBubbleBrowserTest(); | |
41 ~PermissionBubbleBrowserTest() override; | |
42 | |
43 void SetUpOnMainThread() override; | |
44 | |
45 // Opens an app window, and returns the associated browser. | |
46 Browser* OpenExtensionAppWindow(); | |
47 | |
48 std::vector<PermissionRequest*> requests(); | |
49 std::vector<bool> accept_states() { return accept_states_; } | |
50 PermissionPrompt::Delegate* test_delegate() { return &test_delegate_; } | |
51 | |
52 private: | |
53 TestPermissionBubbleViewDelegate test_delegate_; | |
54 std::vector<std::unique_ptr<PermissionRequest>> requests_; | |
55 std::vector<bool> accept_states_; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleBrowserTest); | |
58 }; | |
59 | |
60 // Use this class to test on a kiosk window. | |
61 class PermissionBubbleKioskBrowserTest : public PermissionBubbleBrowserTest { | |
62 public: | |
63 PermissionBubbleKioskBrowserTest(); | |
64 ~PermissionBubbleKioskBrowserTest() override; | |
65 | |
66 void SetUpCommandLine(base::CommandLine* command_line) override; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleKioskBrowserTest); | |
69 }; | |
70 | |
71 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTI
L_H_ | |
OLD | NEW |