| 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, | |
| 24 bool customization_state_) override; | |
| 25 bool CanAcceptRequestUpdate() override; | |
| 26 void Hide() override; | |
| 27 bool IsVisible() override; | |
| 28 | |
| 29 // Wrappers that update the state of the bubble. | |
| 30 void Accept(); | |
| 31 void Deny(); | |
| 32 void Close(); | |
| 33 void Clear(); | |
| 34 | |
| 35 // If we're in a browser test, we need to interact with the message loop. | |
| 36 // But that shouldn't be done in unit tests. | |
| 37 void SetBrowserTest(bool browser_test); | |
| 38 | |
| 39 private: | |
| 40 bool visible_; | |
| 41 bool can_accept_updates_; | |
| 42 Delegate* delegate_; | |
| 43 bool browser_test_; | |
| 44 std::vector<PermissionBubbleRequest*> permission_requests_; | |
| 45 std::vector<bool> permission_states_; | |
| 46 }; | |
| 47 | |
| 48 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_MOCK_PERMISSION_BUBBLE_VIEW_H_ | |
| OLD | NEW |