OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CONTENT_TEST_MOCK_PERMISSION_MANAGER_H_ | 5 #ifndef CONTENT_TEST_MOCK_PERMISSION_MANAGER_H_ |
6 #define CONTENT_TEST_MOCK_PERMISSION_MANAGER_H_ | 6 #define CONTENT_TEST_MOCK_PERMISSION_MANAGER_H_ |
7 | 7 |
8 #include "content/public/browser/permission_manager.h" | 8 #include "content/public/browser/permission_manager.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "url/gurl.h" | 10 #include "url/gurl.h" |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 enum class PermissionType; | 16 enum class PermissionType; |
17 | 17 |
18 // Mock of the permission manager for unit tests. | 18 // Mock of the permission manager for unit tests. |
19 class MockPermissionManager : public PermissionManager { | 19 class MockPermissionManager : public PermissionManager { |
20 public: | 20 public: |
21 MockPermissionManager(); | 21 MockPermissionManager(); |
22 | 22 |
23 ~MockPermissionManager() override; | 23 ~MockPermissionManager() override; |
24 | 24 |
25 // PermissionManager: | 25 // PermissionManager: |
26 MOCK_METHOD3(GetPermissionStatus, | 26 MOCK_METHOD2(GetPermissionStatusForWorker, |
27 blink::mojom::PermissionStatus(PermissionType permission, | 27 blink::mojom::PermissionStatus(PermissionType permission, |
28 const GURL& requesting_origin, | 28 const GURL& requesting_origin)); |
29 const GURL& embedding_origin)); | 29 MOCK_METHOD3(GetPermissionStatusForFrame, |
| 30 blink::mojom::PermissionStatus( |
| 31 PermissionType permission, |
| 32 content::RenderFrameHost* render_frame_host, |
| 33 const GURL& requesting_origin)); |
30 int RequestPermission( | 34 int RequestPermission( |
31 PermissionType permission, | 35 PermissionType permission, |
32 RenderFrameHost* render_frame_host, | 36 RenderFrameHost* render_frame_host, |
33 const GURL& requesting_origin, | 37 const GURL& requesting_origin, |
34 bool user_gesture, | 38 bool user_gesture, |
35 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) | 39 const base::Callback<void(blink::mojom::PermissionStatus)>& callback) |
36 override; | 40 override; |
37 int RequestPermissions( | 41 int RequestPermissions( |
38 const std::vector<PermissionType>& permission, | 42 const std::vector<PermissionType>& permission, |
39 RenderFrameHost* render_frame_host, | 43 RenderFrameHost* render_frame_host, |
(...skipping 14 matching lines...) Expand all Loading... |
54 override; | 58 override; |
55 void UnsubscribePermissionStatusChange(int subscription_id) override {} | 59 void UnsubscribePermissionStatusChange(int subscription_id) override {} |
56 | 60 |
57 private: | 61 private: |
58 DISALLOW_COPY_AND_ASSIGN(MockPermissionManager); | 62 DISALLOW_COPY_AND_ASSIGN(MockPermissionManager); |
59 }; | 63 }; |
60 | 64 |
61 } // namespace content | 65 } // namespace content |
62 | 66 |
63 #endif // CONTENT_TEST_MOCK_PERMISSION_MANAGER_H_ | 67 #endif // CONTENT_TEST_MOCK_PERMISSION_MANAGER_H_ |
OLD | NEW |