| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 | 205 |
| 206 // owned by the browser context | 206 // owned by the browser context |
| 207 GeolocationPermissionContext* geolocation_permission_context_; | 207 GeolocationPermissionContext* geolocation_permission_context_; |
| 208 ClosedInfoBarTracker closed_infobar_tracker_; | 208 ClosedInfoBarTracker closed_infobar_tracker_; |
| 209 std::vector<std::unique_ptr<content::WebContents>> extra_tabs_; | 209 std::vector<std::unique_ptr<content::WebContents>> extra_tabs_; |
| 210 std::vector<std::unique_ptr<MockPermissionPromptFactory>> | 210 std::vector<std::unique_ptr<MockPermissionPromptFactory>> |
| 211 mock_permission_prompt_factories_; | 211 mock_permission_prompt_factories_; |
| 212 | 212 |
| 213 // A map between renderer child id and a pair represending the bridge id and | 213 // A map between renderer child id and a pair represending the bridge id and |
| 214 // whether the requested permission was allowed. | 214 // whether the requested permission was allowed. |
| 215 base::hash_map<int, std::pair<int, bool> > responses_; | 215 std::map<int, std::pair<int, bool>> responses_; |
| 216 | 216 |
| 217 // For testing the PermissionRequestManager on Android | 217 // For testing the PermissionRequestManager on Android |
| 218 base::test::ScopedFeatureList scoped_feature_list_; | 218 base::test::ScopedFeatureList scoped_feature_list_; |
| 219 }; | 219 }; |
| 220 | 220 |
| 221 PermissionRequestID GeolocationPermissionContextTests::RequestID( | 221 PermissionRequestID GeolocationPermissionContextTests::RequestID( |
| 222 int request_id) { | 222 int request_id) { |
| 223 return PermissionRequestID( | 223 return PermissionRequestID( |
| 224 web_contents()->GetRenderProcessHost()->GetID(), | 224 web_contents()->GetRenderProcessHost()->GetID(), |
| 225 web_contents()->GetMainFrame()->GetRoutingID(), | 225 web_contents()->GetMainFrame()->GetRoutingID(), |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 GeolocationPermissionContextTestsInstance, | 1445 GeolocationPermissionContextTestsInstance, |
| 1446 GeolocationPermissionContextTests, | 1446 GeolocationPermissionContextTests, |
| 1447 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER, | 1447 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER, |
| 1448 TestType::PERMISSION_QUEUE_CONTROLLER)); | 1448 TestType::PERMISSION_QUEUE_CONTROLLER)); |
| 1449 #else | 1449 #else |
| 1450 INSTANTIATE_TEST_CASE_P( | 1450 INSTANTIATE_TEST_CASE_P( |
| 1451 GeolocationPermissionContextTestsInstance, | 1451 GeolocationPermissionContextTestsInstance, |
| 1452 GeolocationPermissionContextTests, | 1452 GeolocationPermissionContextTests, |
| 1453 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER)); | 1453 ::testing::Values(TestType::PERMISSION_REQUEST_MANAGER)); |
| 1454 #endif | 1454 #endif |
| OLD | NEW |