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 <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/id_map.h" | 13 #include "base/id_map.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/synchronization/waitable_event.h" | 15 #include "base/synchronization/waitable_event.h" |
16 #include "base/test/simple_test_clock.h" | 16 #include "base/test/simple_test_clock.h" |
17 #include "base/time/clock.h" | 17 #include "base/time/clock.h" |
18 #include "chrome/browser/chrome_notification_types.h" | 18 #include "chrome/browser/chrome_notification_types.h" |
19 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 19 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
20 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" | 20 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" |
21 #include "chrome/browser/infobars/infobar_service.h" | 21 #include "chrome/browser/infobars/infobar_service.h" |
22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
23 #include "chrome/test/base/testing_profile.h" | 23 #include "chrome/test/base/testing_profile.h" |
24 #include "components/content_settings/core/browser/host_content_settings_map.h" | 24 #include "components/content_settings/core/browser/host_content_settings_map.h" |
25 #include "components/content_settings/core/common/permission_request_id.h" | 25 #include "components/content_settings/core/common/permission_request_id.h" |
26 #include "components/infobars/core/confirm_infobar_delegate.h" | 26 #include "components/infobars/core/confirm_infobar_delegate.h" |
27 #include "components/infobars/core/infobar.h" | 27 #include "components/infobars/core/infobar.h" |
28 #include "components/infobars/test/test_confirm_infobar_delegate_factory.h" | |
28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
29 #include "content/public/browser/navigation_details.h" | 30 #include "content/public/browser/navigation_details.h" |
30 #include "content/public/browser/notification_observer.h" | 31 #include "content/public/browser/notification_observer.h" |
31 #include "content/public/browser/notification_registrar.h" | 32 #include "content/public/browser/notification_registrar.h" |
32 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
33 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
34 #include "content/public/test/mock_render_process_host.h" | 35 #include "content/public/test/mock_render_process_host.h" |
35 #include "content/public/test/test_renderer_host.h" | 36 #include "content/public/test/test_renderer_host.h" |
36 #include "content/public/test/test_utils.h" | 37 #include "content/public/test/test_utils.h" |
37 #include "content/public/test/web_contents_tester.h" | 38 #include "content/public/test/web_contents_tester.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 int bridge_id, | 130 int bridge_id, |
130 bool allowed); | 131 bool allowed); |
131 void AddNewTab(const GURL& url); | 132 void AddNewTab(const GURL& url); |
132 void CheckTabContentsState(const GURL& requesting_frame, | 133 void CheckTabContentsState(const GURL& requesting_frame, |
133 ContentSetting expected_content_setting); | 134 ContentSetting expected_content_setting); |
134 | 135 |
135 // owned by the browser context | 136 // owned by the browser context |
136 GeolocationPermissionContext* geolocation_permission_context_; | 137 GeolocationPermissionContext* geolocation_permission_context_; |
137 ClosedInfoBarTracker closed_infobar_tracker_; | 138 ClosedInfoBarTracker closed_infobar_tracker_; |
138 ScopedVector<content::WebContents> extra_tabs_; | 139 ScopedVector<content::WebContents> extra_tabs_; |
140 TestConfirmInfoBarDelegateFactory confirm_info_bar_delegate_factory_; | |
Michael van Ouwerkerk
2014/12/17 19:23:43
Why is this needed? It appears to be unused.
sdefresne
2014/12/18 14:48:59
The TestConfirmInfoBarDelegateFactory used to do w
| |
139 | 141 |
140 // A map between renderer child id and a pair represending the bridge id and | 142 // A map between renderer child id and a pair represending the bridge id and |
141 // whether the requested permission was allowed. | 143 // whether the requested permission was allowed. |
142 base::hash_map<int, std::pair<int, bool> > responses_; | 144 base::hash_map<int, std::pair<int, bool> > responses_; |
143 }; | 145 }; |
144 | 146 |
145 PermissionRequestID GeolocationPermissionContextTests::RequestID( | 147 PermissionRequestID GeolocationPermissionContextTests::RequestID( |
146 int bridge_id) { | 148 int bridge_id) { |
147 return PermissionRequestID( | 149 return PermissionRequestID( |
148 web_contents()->GetRenderProcessHost()->GetID(), | 150 web_contents()->GetRenderProcessHost()->GetID(), |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
774 // it is the embedder. | 776 // it is the embedder. |
775 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), | 777 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), |
776 requesting_frame_0.GetOrigin(), | 778 requesting_frame_0.GetOrigin(), |
777 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 779 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
778 13); | 780 13); |
779 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), | 781 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), |
780 requesting_frame_0.GetOrigin(), | 782 requesting_frame_0.GetOrigin(), |
781 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 783 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
782 11); | 784 11); |
783 } | 785 } |
OLD | NEW |