OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "content/browser/permissions/permission_service_impl.h" | 5 #include "content/browser/permissions/permission_service_impl.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/test/scoped_feature_list.h" | 8 #include "base/test/scoped_feature_list.h" |
9 #include "content/browser/permissions/permission_service_context.h" | 9 #include "content/browser/permissions/permission_service_context.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 PermissionName name) { | 28 PermissionName name) { |
29 auto descriptor = blink::mojom::PermissionDescriptor::New(); | 29 auto descriptor = blink::mojom::PermissionDescriptor::New(); |
30 descriptor->name = name; | 30 descriptor->name = name; |
31 return descriptor; | 31 return descriptor; |
32 } | 32 } |
33 | 33 |
34 class TestPermissionManager : public MockPermissionManager { | 34 class TestPermissionManager : public MockPermissionManager { |
35 public: | 35 public: |
36 ~TestPermissionManager() override = default; | 36 ~TestPermissionManager() override = default; |
37 | 37 |
38 PermissionStatus GetPermissionStatus(PermissionType permission, | 38 PermissionStatus GetPermissionStatusForFrame( |
39 const GURL& requesting_origin, | 39 content::PermissionType permission, |
40 const GURL& embedding_origin) override { | 40 content::RenderFrameHost* render_frame_host, |
| 41 const GURL& requesting_origin) override { |
41 // Always return granted. | 42 // Always return granted. |
42 return PermissionStatus::GRANTED; | 43 return PermissionStatus::GRANTED; |
43 } | 44 } |
44 | 45 |
45 int RequestPermissions( | 46 int RequestPermissions( |
46 const std::vector<PermissionType>& permissions, | 47 const std::vector<PermissionType>& permissions, |
47 RenderFrameHost* render_frame_host, | 48 RenderFrameHost* render_frame_host, |
48 const GURL& requesting_origin, | 49 const GURL& requesting_origin, |
49 bool user_gesture, | 50 bool user_gesture, |
50 const base::Callback<void(const std::vector<PermissionStatus>&)>& | 51 const base::Callback<void(const std::vector<PermissionStatus>&)>& |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 EXPECT_EQ(PermissionStatus::DENIED, result[0]); | 180 EXPECT_EQ(PermissionStatus::DENIED, result[0]); |
180 | 181 |
181 // Request midi along with geolocation. Geolocation should be granted. | 182 // Request midi along with geolocation. Geolocation should be granted. |
182 result = RequestPermissions(std::vector<PermissionName>{ | 183 result = RequestPermissions(std::vector<PermissionName>{ |
183 PermissionName::MIDI, PermissionName::GEOLOCATION}); | 184 PermissionName::MIDI, PermissionName::GEOLOCATION}); |
184 EXPECT_EQ(2u, result.size()); | 185 EXPECT_EQ(2u, result.size()); |
185 EXPECT_EQ(PermissionStatus::DENIED, result[0]); | 186 EXPECT_EQ(PermissionStatus::DENIED, result[0]); |
186 EXPECT_EQ(PermissionStatus::GRANTED, result[1]); | 187 EXPECT_EQ(PermissionStatus::GRANTED, result[1]); |
187 } | 188 } |
188 | 189 |
189 } // namespace | 190 } // namespace |
OLD | NEW |