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_MOCK_PERMISSION_BUBBLE_VIEW_H_ | |
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_MOCK_PERMISSION_BUBBLE_VIEW_H_ | |
7 | |
8 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | |
9 #include "chrome/browser/ui/website_settings/permission_bubble_view.h" | |
10 | |
11 // Provides a skeleton class for unit testing, when trying to test the bubble | |
12 // manager logic. Should not be used for anything that requires actual UI. | |
13 // See example usage in | |
14 // chrome/browser/geolocation/geolocation_permission_context_unittest.cc. | |
15 class MockPermissionBubbleView : public PermissionBubbleView { | |
16 public: | |
17 MockPermissionBubbleView(); | |
18 ~MockPermissionBubbleView() override; | |
19 | |
20 // PermissionBubbleView: | |
21 void SetDelegate(Delegate* delegate) override; | |
22 void Show(const std::vector<PermissionBubbleRequest*>& requests, | |
23 const std::vector<bool>& accept_state) override; | |
24 bool CanAcceptRequestUpdate() override; | |
25 void Hide() override; | |
26 bool IsVisible() override; | |
27 | |
28 // Wrappers that update the state of the bubble. | |
29 void Accept(); | |
30 void Deny(); | |
31 void Close(); | |
32 void Clear(); | |
33 | |
34 // If we're in a browser test, we need to interact with the message loop. | |
35 // But that shouldn't be done in unit tests. | |
36 void SetBrowserTest(bool browser_test); | |
37 | |
38 private: | |
39 bool visible_; | |
40 bool can_accept_updates_; | |
41 Delegate* delegate_; | |
42 bool browser_test_; | |
43 std::vector<PermissionBubbleRequest*> permission_requests_; | |
44 std::vector<bool> permission_states_; | |
45 }; | |
46 | |
47 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_MOCK_PERMISSION_BUBBLE_VIEW_H_ | |
OLD | NEW |