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

Side by Side Diff: chrome/browser/permissions/permission_manager_unittest.cc

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 years, 3 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/permissions/permission_manager.h" 5 #include "chrome/browser/permissions/permission_manager.h"
6 6
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
7 #include "chrome/browser/permissions/permission_manager_factory.h" 8 #include "chrome/browser/permissions/permission_manager_factory.h"
8 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
9 #include "components/content_settings/core/browser/host_content_settings_map.h" 10 #include "components/content_settings/core/browser/host_content_settings_map.h"
10 #include "content/public/browser/permission_type.h" 11 #include "content/public/browser/permission_type.h"
11 #include "content/public/test/test_browser_thread_bundle.h" 12 #include "content/public/test/test_browser_thread_bundle.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 14
14 using content::PermissionType; 15 using content::PermissionType;
15 using content::PermissionStatus; 16 using content::PermissionStatus;
16 17
(...skipping 26 matching lines...) Expand all
43 other_url_("https://foo.com"), 44 other_url_("https://foo.com"),
44 callback_called_(false), 45 callback_called_(false),
45 callback_result_(content::PERMISSION_STATUS_ASK) { 46 callback_result_(content::PERMISSION_STATUS_ASK) {
46 } 47 }
47 48
48 PermissionManager* GetPermissionManager() { 49 PermissionManager* GetPermissionManager() {
49 return profile_.GetPermissionManager(); 50 return profile_.GetPermissionManager();
50 } 51 }
51 52
52 HostContentSettingsMap* GetHostContentSettingsMap() { 53 HostContentSettingsMap* GetHostContentSettingsMap() {
53 return profile_.GetHostContentSettingsMap(); 54 return HostContentSettingsMapFactory::GetForProfile(&profile_);
54 } 55 }
55 56
56 void CheckPermissionStatus(PermissionType type, 57 void CheckPermissionStatus(PermissionType type,
57 PermissionStatus expected) { 58 PermissionStatus expected) {
58 EXPECT_EQ(expected, GetPermissionManager()->GetPermissionStatus( 59 EXPECT_EQ(expected, GetPermissionManager()->GetPermissionStatus(
59 type, url_.GetOrigin(), url_.GetOrigin())); 60 type, url_.GetOrigin(), url_.GetOrigin()));
60 } 61 }
61 62
62 void SetPermission(ContentSettingsType type, ContentSetting value) { 63 void SetPermission(ContentSettingsType type, ContentSetting value) {
63 profile_.GetHostContentSettingsMap()->SetContentSetting( 64 HostContentSettingsMapFactory::GetForProfile(&profile_)->SetContentSetting(
64 ContentSettingsPattern::FromURLNoWildcard(url_), 65 ContentSettingsPattern::FromURLNoWildcard(url_),
65 ContentSettingsPattern::FromURLNoWildcard(url_), 66 ContentSettingsPattern::FromURLNoWildcard(url_),
66 type, std::string(), value); 67 type, std::string(), value);
67 } 68 }
68 69
69 const GURL& url() const { 70 const GURL& url() const {
70 return url_; 71 return url_;
71 } 72 }
72 73
73 const GURL& other_url() const { 74 const GURL& other_url() const {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 ContentSettingsPattern::FromURLNoWildcard(url()), 341 ContentSettingsPattern::FromURLNoWildcard(url()),
341 CONTENT_SETTINGS_TYPE_GEOLOCATION, 342 CONTENT_SETTINGS_TYPE_GEOLOCATION,
342 std::string(), 343 std::string(),
343 CONTENT_SETTING_ASK); 344 CONTENT_SETTING_ASK);
344 345
345 EXPECT_TRUE(callback_called()); 346 EXPECT_TRUE(callback_called());
346 EXPECT_EQ(content::PERMISSION_STATUS_ASK, callback_result()); 347 EXPECT_EQ(content::PERMISSION_STATUS_ASK, callback_result());
347 348
348 GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id); 349 GetPermissionManager()->UnsubscribePermissionStatusChange(subscription_id);
349 } 350 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_manager_factory.cc ('k') | chrome/browser/permissions/permission_queue_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698