OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/geolocation/geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/geolocation_permission_context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
| 9 #include <map> |
9 #include <set> | 10 #include <set> |
10 #include <string> | 11 #include <string> |
11 #include <utility> | 12 #include <utility> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/bind.h" | 15 #include "base/bind.h" |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/containers/hash_tables.h" | |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/id_map.h" | 18 #include "base/id_map.h" |
19 #include "base/memory/ptr_util.h" | 19 #include "base/memory/ptr_util.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
22 #include "base/test/histogram_tester.h" | 22 #include "base/test/histogram_tester.h" |
23 #include "base/test/scoped_feature_list.h" | 23 #include "base/test/scoped_feature_list.h" |
24 #include "base/test/simple_test_clock.h" | 24 #include "base/test/simple_test_clock.h" |
25 #include "base/time/clock.h" | 25 #include "base/time/clock.h" |
26 #include "chrome/browser/chrome_notification_types.h" | 26 #include "chrome/browser/chrome_notification_types.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 // owned by the browser context | 204 // owned by the browser context |
205 GeolocationPermissionContext* geolocation_permission_context_; | 205 GeolocationPermissionContext* geolocation_permission_context_; |
206 ClosedInfoBarTracker closed_infobar_tracker_; | 206 ClosedInfoBarTracker closed_infobar_tracker_; |
207 std::vector<std::unique_ptr<content::WebContents>> extra_tabs_; | 207 std::vector<std::unique_ptr<content::WebContents>> extra_tabs_; |
208 std::vector<std::unique_ptr<MockPermissionPromptFactory>> | 208 std::vector<std::unique_ptr<MockPermissionPromptFactory>> |
209 mock_permission_prompt_factories_; | 209 mock_permission_prompt_factories_; |
210 | 210 |
211 // A map between renderer child id and a pair represending the bridge id and | 211 // A map between renderer child id and a pair represending the bridge id and |
212 // whether the requested permission was allowed. | 212 // whether the requested permission was allowed. |
213 base::hash_map<int, std::pair<int, bool> > responses_; | 213 std::map<int, std::pair<int, bool>> responses_; |
214 | 214 |
215 // For testing the PermissionRequestManager on Android | 215 // For testing the PermissionRequestManager on Android |
216 base::test::ScopedFeatureList scoped_feature_list_; | 216 base::test::ScopedFeatureList scoped_feature_list_; |
217 }; | 217 }; |
218 | 218 |
219 PermissionRequestID GeolocationPermissionContextTests::RequestID( | 219 PermissionRequestID GeolocationPermissionContextTests::RequestID( |
220 int request_id) { | 220 int request_id) { |
221 return PermissionRequestID( | 221 return PermissionRequestID( |
222 web_contents()->GetRenderProcessHost()->GetID(), | 222 web_contents()->GetRenderProcessHost()->GetID(), |
223 web_contents()->GetMainFrame()->GetRoutingID(), | 223 web_contents()->GetMainFrame()->GetRoutingID(), |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1443 GeolocationPermissionContextTestsInstance, | 1443 GeolocationPermissionContextTestsInstance, |
1444 GeolocationPermissionContextTests, | 1444 GeolocationPermissionContextTests, |
1445 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER, | 1445 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER, |
1446 TestType::PERMISSION_QUEUE_CONTROLLER)); | 1446 TestType::PERMISSION_QUEUE_CONTROLLER)); |
1447 #else | 1447 #else |
1448 INSTANTIATE_TEST_CASE_P( | 1448 INSTANTIATE_TEST_CASE_P( |
1449 GeolocationPermissionContextTestsInstance, | 1449 GeolocationPermissionContextTestsInstance, |
1450 GeolocationPermissionContextTests, | 1450 GeolocationPermissionContextTests, |
1451 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER)); | 1451 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER)); |
1452 #endif | 1452 #endif |
OLD | NEW |