Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: chrome/browser/geolocation/geolocation_permission_context_unittest.cc

Issue 2182883002: Permissions: Rename PermissionBubbleView to PermissionPromptInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Further renames Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "content/public/test/test_utils.h" 49 #include "content/public/test/test_utils.h"
50 #include "content/public/test/web_contents_tester.h" 50 #include "content/public/test/web_contents_tester.h"
51 #include "testing/gtest/include/gtest/gtest.h" 51 #include "testing/gtest/include/gtest/gtest.h"
52 52
53 #if BUILDFLAG(ANDROID_JAVA_UI) 53 #if BUILDFLAG(ANDROID_JAVA_UI)
54 #include "chrome/browser/android/mock_location_settings.h" 54 #include "chrome/browser/android/mock_location_settings.h"
55 #include "chrome/browser/geolocation/geolocation_permission_context_android.h" 55 #include "chrome/browser/geolocation/geolocation_permission_context_android.h"
56 #include "components/prefs/pref_service.h" 56 #include "components/prefs/pref_service.h"
57 #else 57 #else
58 #include "chrome/browser/permissions/permission_request_manager.h" 58 #include "chrome/browser/permissions/permission_request_manager.h"
59 #include "chrome/browser/ui/website_settings/mock_permission_bubble_factory.h" 59 #include "chrome/browser/ui/website_settings/mock_permission_prompt_factory.h"
60 #endif 60 #endif
61 61
62 #if defined(ENABLE_EXTENSIONS) 62 #if defined(ENABLE_EXTENSIONS)
63 #include "extensions/browser/view_type_utils.h" 63 #include "extensions/browser/view_type_utils.h"
64 #endif 64 #endif
65 65
66 using content::MockRenderProcessHost; 66 using content::MockRenderProcessHost;
67 67
68 68
69 // ClosedInfoBarTracker ------------------------------------------------------- 69 // ClosedInfoBarTracker -------------------------------------------------------
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ContentSetting GetGeolocationContentSetting(GURL frame_0, GURL frame_1); 161 ContentSetting GetGeolocationContentSetting(GURL frame_0, GURL frame_1);
162 size_t GetNumberOfPrompts(); 162 size_t GetNumberOfPrompts();
163 void AcceptPrompt(); 163 void AcceptPrompt();
164 base::string16 GetPromptText(); 164 base::string16 GetPromptText();
165 165
166 // owned by the browser context 166 // owned by the browser context
167 GeolocationPermissionContext* geolocation_permission_context_; 167 GeolocationPermissionContext* geolocation_permission_context_;
168 ClosedInfoBarTracker closed_infobar_tracker_; 168 ClosedInfoBarTracker closed_infobar_tracker_;
169 std::vector<std::unique_ptr<content::WebContents>> extra_tabs_; 169 std::vector<std::unique_ptr<content::WebContents>> extra_tabs_;
170 #if !BUILDFLAG(ANDROID_JAVA_UI) 170 #if !BUILDFLAG(ANDROID_JAVA_UI)
171 std::vector<std::unique_ptr<MockPermissionBubbleFactory>> 171 std::vector<std::unique_ptr<MockPermissionPromptFactory>>
172 mock_permission_bubble_factories_; 172 mock_permission_request_factories_;
raymes 2016/08/01 00:58:13 prompt_factories_
tsergeant 2016/08/01 23:41:12 Done.
173 #endif 173 #endif
174 174
175 // A map between renderer child id and a pair represending the bridge id and 175 // A map between renderer child id and a pair represending the bridge id and
176 // whether the requested permission was allowed. 176 // whether the requested permission was allowed.
177 base::hash_map<int, std::pair<int, bool> > responses_; 177 base::hash_map<int, std::pair<int, bool> > responses_;
178 }; 178 };
179 179
180 PermissionRequestID GeolocationPermissionContextTests::RequestID( 180 PermissionRequestID GeolocationPermissionContextTests::RequestID(
181 int request_id) { 181 int request_id) {
182 return PermissionRequestID( 182 return PermissionRequestID(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 ->SetLocationSettingsForTesting( 294 ->SetLocationSettingsForTesting(
295 std::unique_ptr<LocationSettings>(new MockLocationSettings())); 295 std::unique_ptr<LocationSettings>(new MockLocationSettings()));
296 MockLocationSettings::SetLocationStatus(true, true); 296 MockLocationSettings::SetLocationStatus(true, true);
297 #else 297 #else
298 SetupRequestManager(web_contents()); 298 SetupRequestManager(web_contents());
299 #endif 299 #endif
300 } 300 }
301 301
302 void GeolocationPermissionContextTests::TearDown() { 302 void GeolocationPermissionContextTests::TearDown() {
303 #if !BUILDFLAG(ANDROID_JAVA_UI) 303 #if !BUILDFLAG(ANDROID_JAVA_UI)
304 mock_permission_bubble_factories_.clear(); 304 mock_permission_request_factories_.clear();
305 #endif 305 #endif
306 extra_tabs_.clear(); 306 extra_tabs_.clear();
307 ChromeRenderViewHostTestHarness::TearDown(); 307 ChromeRenderViewHostTestHarness::TearDown();
308 } 308 }
309 309
310 #if !BUILDFLAG(ANDROID_JAVA_UI) 310 #if !BUILDFLAG(ANDROID_JAVA_UI)
311 void GeolocationPermissionContextTests::SetupRequestManager( 311 void GeolocationPermissionContextTests::SetupRequestManager(
312 content::WebContents* web_contents) { 312 content::WebContents* web_contents) {
313 // Create PermissionRequestManager. 313 // Create PermissionRequestManager.
314 PermissionRequestManager::CreateForWebContents(web_contents); 314 PermissionRequestManager::CreateForWebContents(web_contents);
315 PermissionRequestManager* permission_request_manager = 315 PermissionRequestManager* permission_request_manager =
316 PermissionRequestManager::FromWebContents(web_contents); 316 PermissionRequestManager::FromWebContents(web_contents);
317 317
318 // Create a MockPermissionBubbleFactory for the PermissionRequestManager. 318 // Create a MockPermissionPromptFactory for the PermissionRequestManager.
319 mock_permission_bubble_factories_.push_back(base::WrapUnique( 319 mock_permission_request_factories_.push_back(base::WrapUnique(
320 new MockPermissionBubbleFactory(permission_request_manager))); 320 new MockPermissionPromptFactory(permission_request_manager)));
321 321
322 // Prepare the PermissionRequestManager to display a mock bubble. 322 // Prepare the PermissionRequestManager to display a mock bubble.
323 permission_request_manager->DisplayPendingRequests(); 323 permission_request_manager->DisplayPendingRequests();
324 } 324 }
325 325
326 size_t GeolocationPermissionContextTests::GetBubblesQueueSize( 326 size_t GeolocationPermissionContextTests::GetBubblesQueueSize(
327 PermissionRequestManager* manager) { 327 PermissionRequestManager* manager) {
328 return manager->requests_.size(); 328 return manager->requests_.size();
329 } 329 }
330 330
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 // it is the embedder. 999 // it is the embedder.
1000 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), 1000 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
1001 requesting_frame_0.GetOrigin(), 1001 requesting_frame_0.GetOrigin(),
1002 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 1002 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
1003 13); 1003 13);
1004 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), 1004 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
1005 requesting_frame_0.GetOrigin(), 1005 requesting_frame_0.GetOrigin(),
1006 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 1006 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
1007 11); 1007 11);
1008 } 1008 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698