Chromium Code Reviews| 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 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 } | 117 } |
| 118 | 118 |
| 119 void RequestGeolocationPermission(content::WebContents* web_contents, | 119 void RequestGeolocationPermission(content::WebContents* web_contents, |
| 120 const PermissionRequestID& id, | 120 const PermissionRequestID& id, |
| 121 const GURL& requesting_frame); | 121 const GURL& requesting_frame); |
| 122 void RequestGeolocationPermission(content::WebContents* web_contents, | 122 void RequestGeolocationPermission(content::WebContents* web_contents, |
| 123 const PermissionRequestID& id, | 123 const PermissionRequestID& id, |
| 124 const GURL& requesting_frame, | 124 const GURL& requesting_frame, |
| 125 base::Closure* cancel_callback); | 125 base::Closure* cancel_callback); |
| 126 void PermissionResponse(const PermissionRequestID& id, | 126 void PermissionResponse(const PermissionRequestID& id, |
| 127 bool allowed); | 127 bool allowed, |
| 128 int choice); | |
| 128 void CheckPermissionMessageSent(int bridge_id, bool allowed); | 129 void CheckPermissionMessageSent(int bridge_id, bool allowed); |
| 129 void CheckPermissionMessageSentForTab(int tab, int bridge_id, bool allowed); | 130 void CheckPermissionMessageSentForTab(int tab, int bridge_id, bool allowed); |
| 130 void CheckPermissionMessageSentInternal(MockRenderProcessHost* process, | 131 void CheckPermissionMessageSentInternal(MockRenderProcessHost* process, |
| 131 int bridge_id, | 132 int bridge_id, |
| 132 bool allowed); | 133 bool allowed); |
| 133 void AddNewTab(const GURL& url); | 134 void AddNewTab(const GURL& url); |
| 134 void CheckTabContentsState(const GURL& requesting_frame, | 135 void CheckTabContentsState(const GURL& requesting_frame, |
| 135 ContentSetting expected_content_setting); | 136 ContentSetting expected_content_setting); |
| 136 | 137 |
| 137 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; | 138 scoped_refptr<GeolocationPermissionContext> geolocation_permission_context_; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 178 web_contents, id.bridge_id(), requesting_frame, false, | 179 web_contents, id.bridge_id(), requesting_frame, false, |
| 179 base::Bind(&GeolocationPermissionContextTests::PermissionResponse, | 180 base::Bind(&GeolocationPermissionContextTests::PermissionResponse, |
| 180 base::Unretained(this), id), | 181 base::Unretained(this), id), |
| 181 cancel_callback); | 182 cancel_callback); |
| 182 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 183 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
| 183 base::RunLoop().RunUntilIdle(); | 184 base::RunLoop().RunUntilIdle(); |
| 184 } | 185 } |
| 185 | 186 |
| 186 void GeolocationPermissionContextTests::PermissionResponse( | 187 void GeolocationPermissionContextTests::PermissionResponse( |
| 187 const PermissionRequestID& id, | 188 const PermissionRequestID& id, |
| 188 bool allowed) { | 189 bool allowed, |
| 190 int choice) { | |
| 191 // (mohammed) test choice. | |
|
meacer
2014/08/15 23:34:46
nit: TODO(mohammed):
| |
| 189 responses_[id.render_process_id()] = std::make_pair(id.bridge_id(), allowed); | 192 responses_[id.render_process_id()] = std::make_pair(id.bridge_id(), allowed); |
| 190 } | 193 } |
| 191 | 194 |
| 192 void GeolocationPermissionContextTests::CheckPermissionMessageSent( | 195 void GeolocationPermissionContextTests::CheckPermissionMessageSent( |
| 193 int bridge_id, | 196 int bridge_id, |
| 194 bool allowed) { | 197 bool allowed) { |
| 195 CheckPermissionMessageSentInternal(process(), bridge_id, allowed); | 198 CheckPermissionMessageSentInternal(process(), bridge_id, allowed); |
| 196 } | 199 } |
| 197 | 200 |
| 198 void GeolocationPermissionContextTests::CheckPermissionMessageSentForTab( | 201 void GeolocationPermissionContextTests::CheckPermissionMessageSentForTab( |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 815 // it is the embedder. | 818 // it is the embedder. |
| 816 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), | 819 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), |
| 817 requesting_frame_0.GetOrigin(), | 820 requesting_frame_0.GetOrigin(), |
| 818 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 821 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
| 819 13); | 822 13); |
| 820 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), | 823 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), |
| 821 requesting_frame_0.GetOrigin(), | 824 requesting_frame_0.GetOrigin(), |
| 822 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), | 825 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), |
| 823 11); | 826 11); |
| 824 } | 827 } |
| OLD | NEW |