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

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

Issue 1871343002: Remove PermissionContext factories (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/containers/hash_tables.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/synchronization/waitable_event.h" 19 #include "base/synchronization/waitable_event.h"
20 #include "base/test/simple_test_clock.h" 20 #include "base/test/simple_test_clock.h"
21 #include "base/time/clock.h" 21 #include "base/time/clock.h"
22 #include "chrome/browser/chrome_notification_types.h" 22 #include "chrome/browser/chrome_notification_types.h"
23 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 23 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
24 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 24 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
25 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h" 25 #include "chrome/browser/geolocation/geolocation_permission_context.h"
26 #include "chrome/browser/infobars/infobar_service.h" 26 #include "chrome/browser/infobars/infobar_service.h"
27 #include "chrome/browser/permissions/permission_context_base.h"
28 #include "chrome/browser/permissions/permission_manager.h"
27 #include "chrome/browser/permissions/permission_request_id.h" 29 #include "chrome/browser/permissions/permission_request_id.h"
28 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" 30 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
29 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
30 #include "chrome/common/features.h" 32 #include "chrome/common/features.h"
31 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 33 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
32 #include "chrome/test/base/testing_profile.h" 34 #include "chrome/test/base/testing_profile.h"
33 #include "components/content_settings/core/browser/host_content_settings_map.h" 35 #include "components/content_settings/core/browser/host_content_settings_map.h"
34 #include "components/infobars/core/confirm_infobar_delegate.h" 36 #include "components/infobars/core/confirm_infobar_delegate.h"
35 #include "components/infobars/core/infobar.h" 37 #include "components/infobars/core/infobar.h"
36 #include "content/public/browser/browser_thread.h" 38 #include "content/public/browser/browser_thread.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 275
274 void GeolocationPermissionContextTests::SetUp() { 276 void GeolocationPermissionContextTests::SetUp() {
275 ChromeRenderViewHostTestHarness::SetUp(); 277 ChromeRenderViewHostTestHarness::SetUp();
276 278
277 // Set up required helpers, and make this be as "tabby" as the code requires. 279 // Set up required helpers, and make this be as "tabby" as the code requires.
278 #if defined(ENABLE_EXTENSIONS) 280 #if defined(ENABLE_EXTENSIONS)
279 extensions::SetViewType(web_contents(), extensions::VIEW_TYPE_TAB_CONTENTS); 281 extensions::SetViewType(web_contents(), extensions::VIEW_TYPE_TAB_CONTENTS);
280 #endif 282 #endif
281 InfoBarService::CreateForWebContents(web_contents()); 283 InfoBarService::CreateForWebContents(web_contents());
282 TabSpecificContentSettings::CreateForWebContents(web_contents()); 284 TabSpecificContentSettings::CreateForWebContents(web_contents());
283 geolocation_permission_context_ = 285 geolocation_permission_context_ = static_cast<GeolocationPermissionContext*>(
284 GeolocationPermissionContextFactory::GetForProfile(profile()); 286 PermissionManager::Get(profile())->GetPermissionContext(
287 content::PermissionType::GEOLOCATION));
285 #if BUILDFLAG(ANDROID_JAVA_UI) 288 #if BUILDFLAG(ANDROID_JAVA_UI)
286 static_cast<GeolocationPermissionContextAndroid*>( 289 static_cast<GeolocationPermissionContextAndroid*>(
287 geolocation_permission_context_) 290 geolocation_permission_context_)
288 ->SetLocationSettingsForTesting( 291 ->SetLocationSettingsForTesting(
289 scoped_ptr<LocationSettings>(new MockLocationSettings())); 292 scoped_ptr<LocationSettings>(new MockLocationSettings()));
290 MockLocationSettings::SetLocationStatus(true, true); 293 MockLocationSettings::SetLocationStatus(true, true);
291 #else 294 #else
292 SetupBubbleManager(web_contents()); 295 SetupBubbleManager(web_contents());
293 #endif 296 #endif
294 } 297 }
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 // it is the embedder. 973 // it is the embedder.
971 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(), 974 EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
972 requesting_frame_0.GetOrigin(), 975 requesting_frame_0.GetOrigin(),
973 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 976 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
974 13); 977 13);
975 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(), 978 EXPECT_EQ(map->GetLastUsage(requesting_frame_1.GetOrigin(),
976 requesting_frame_0.GetOrigin(), 979 requesting_frame_0.GetOrigin(),
977 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(), 980 CONTENT_SETTINGS_TYPE_GEOLOCATION).ToDoubleT(),
978 11); 981 11);
979 } 982 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698