| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H
_ | 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
_ | 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTIL_H
_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
| 10 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" | 10 #include "chrome/browser/ui/website_settings/permission_prompt.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class CommandLine; | 13 class CommandLine; |
| 14 } | 14 } |
| 15 class PermissionRequest; | 15 class PermissionRequest; |
| 16 class Browser; | 16 class Browser; |
| 17 | 17 |
| 18 class TestPermissionBubbleViewDelegate : public PermissionBubbleView::Delegate { | 18 class TestPermissionBubbleViewDelegate |
| 19 : public PermissionPrompt::Delegate { |
| 19 public: | 20 public: |
| 20 TestPermissionBubbleViewDelegate(); | 21 TestPermissionBubbleViewDelegate(); |
| 21 | 22 |
| 22 void ToggleAccept(int, bool) override {} | 23 void ToggleAccept(int, bool) override {} |
| 23 void Accept() override {} | 24 void Accept() override {} |
| 24 void Deny() override {} | 25 void Deny() override {} |
| 25 void Closing() override {} | 26 void Closing() override {} |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 DISALLOW_COPY_AND_ASSIGN(TestPermissionBubbleViewDelegate); | 29 DISALLOW_COPY_AND_ASSIGN(TestPermissionBubbleViewDelegate); |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 // Use this class to test on a default window or an app window. Inheriting from | 32 // Use this class to test on a default window or an app window. Inheriting from |
| 32 // ExtensionBrowserTest allows us to easily load and launch apps, and doesn't | 33 // ExtensionBrowserTest allows us to easily load and launch apps, and doesn't |
| 33 // really add any extra work. | 34 // really add any extra work. |
| 34 class PermissionBubbleBrowserTest : public ExtensionBrowserTest { | 35 class PermissionBubbleBrowserTest : public ExtensionBrowserTest { |
| 35 public: | 36 public: |
| 36 PermissionBubbleBrowserTest(); | 37 PermissionBubbleBrowserTest(); |
| 37 ~PermissionBubbleBrowserTest() override; | 38 ~PermissionBubbleBrowserTest() override; |
| 38 | 39 |
| 39 void SetUpOnMainThread() override; | 40 void SetUpOnMainThread() override; |
| 40 | 41 |
| 41 // Opens an app window, and returns the associated browser. | 42 // Opens an app window, and returns the associated browser. |
| 42 Browser* OpenExtensionAppWindow(); | 43 Browser* OpenExtensionAppWindow(); |
| 43 | 44 |
| 44 std::vector<PermissionRequest*> requests() { return requests_.get(); } | 45 std::vector<PermissionRequest*> requests() { return requests_.get(); } |
| 45 std::vector<bool> accept_states() { return accept_states_; } | 46 std::vector<bool> accept_states() { return accept_states_; } |
| 46 PermissionBubbleView::Delegate* test_delegate() { return &test_delegate_; } | 47 PermissionPrompt::Delegate* test_delegate() { |
| 48 return &test_delegate_; |
| 49 } |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 TestPermissionBubbleViewDelegate test_delegate_; | 52 TestPermissionBubbleViewDelegate test_delegate_; |
| 50 ScopedVector<PermissionRequest> requests_; | 53 ScopedVector<PermissionRequest> requests_; |
| 51 std::vector<bool> accept_states_; | 54 std::vector<bool> accept_states_; |
| 52 | 55 |
| 53 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleBrowserTest); | 56 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleBrowserTest); |
| 54 }; | 57 }; |
| 55 | 58 |
| 56 // Use this class to test on a kiosk window. | 59 // Use this class to test on a kiosk window. |
| 57 class PermissionBubbleKioskBrowserTest : public PermissionBubbleBrowserTest { | 60 class PermissionBubbleKioskBrowserTest : public PermissionBubbleBrowserTest { |
| 58 public: | 61 public: |
| 59 PermissionBubbleKioskBrowserTest(); | 62 PermissionBubbleKioskBrowserTest(); |
| 60 ~PermissionBubbleKioskBrowserTest() override; | 63 ~PermissionBubbleKioskBrowserTest() override; |
| 61 | 64 |
| 62 void SetUpCommandLine(base::CommandLine* command_line) override; | 65 void SetUpCommandLine(base::CommandLine* command_line) override; |
| 63 | 66 |
| 64 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleKioskBrowserTest); | 67 DISALLOW_COPY_AND_ASSIGN(PermissionBubbleKioskBrowserTest); |
| 65 }; | 68 }; |
| 66 | 69 |
| 67 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTI
L_H_ | 70 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_BROWSER_TEST_UTI
L_H_ |
| OLD | NEW |