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.
5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_MOCK_PERMISSION_BUBBLE_VIEW_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_MOCK_PERMISSION_BUBBLE_VIEW_H_
8 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
9 #include "chrome/browser/ui/website_settings/permission_bubble_view.h"
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
{
17 MockPermissionBubbleView();
18 ~MockPermissionBubbleView() override
;
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
;
26 bool IsVisible() override
;
28 // Wrappers that update the state of the bubble.
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
);
40 bool can_accept_updates_
;
43 std::vector
<PermissionBubbleRequest
*> permission_requests_
;
44 std::vector
<bool> permission_states_
;
47 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_MOCK_PERMISSION_BUBBLE_VIEW_H_