Chromium Code Reviews| 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 // Inherit from ExtensionBrowserTest instead of InProcessBrowserTest because | |
| 33 // 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
| |
| 34 class PermissionBubbleBrowsertest : public ExtensionBrowserTest { | |
| 35 public: | |
| 36 PermissionBubbleBrowsertest(); | |
| 37 ~PermissionBubbleBrowsertest() override; | |
| 38 | |
| 39 void SetUpOnMainThread() override; | |
| 40 | |
| 41 std::vector<PermissionBubbleRequest*> requests() { return requests_.get(); } | |
| 42 std::vector<bool> accept_states() { return accept_states_; } | |
| 43 PermissionBubbleView::Delegate* test_delegate() { return &test_delegate_; } | |
| 44 | |
| 45 private: | |
| 46 TestPermissionBubbleViewDelegate test_delegate_; | |
| 47 ScopedVector<PermissionBubbleRequest> requests_; | |
| 48 std::vector<bool> accept_states_; | |
| 49 }; | |
| 50 | |
| 51 // Use this class to test on an app window. | |
| 52 class PermissionBubbleAppBrowsertest : public PermissionBubbleBrowsertest { | |
| 53 public: | |
| 54 PermissionBubbleAppBrowsertest(); | |
| 55 ~PermissionBubbleAppBrowsertest() override; | |
| 56 | |
| 57 void SetUpOnMainThread() override; | |
| 58 | |
| 59 Browser* app_browser() { return app_browser_; } | |
| 60 | |
| 61 private: | |
| 62 Browser* app_browser_; | |
| 63 | |
| 64 Browser* OpenExtensionAppWindow(const extensions::Extension* extension); | |
| 65 }; | |
| 66 | |
| 67 // Use this class to test on a kiosk window. | |
| 68 class PermissionBubbleKioskBrowsertest : public PermissionBubbleBrowsertest { | |
| 69 public: | |
| 70 PermissionBubbleKioskBrowsertest(); | |
| 71 ~PermissionBubbleKioskBrowsertest() override; | |
| 72 | |
| 73 void SetUpCommandLine(base::CommandLine* command_line) override; | |
| 74 }; | |
| 75 | |
| 76 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTI L_H_ | |
| OLD | NEW |