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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_permission_context_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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/push_messaging/push_messaging_permission_context.h" 5 #include "chrome/browser/push_messaging/push_messaging_permission_context.h"
6 6
7 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
7 #include "chrome/browser/permissions/permission_request_id.h" 8 #include "chrome/browser/permissions/permission_request_id.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 "components/content_settings/core/common/content_settings.h" 11 #include "components/content_settings/core/common/content_settings.h"
11 #include "components/content_settings/core/common/content_settings_types.h" 12 #include "components/content_settings/core/common/content_settings_types.h"
12 #include "content/public/test/test_browser_thread_bundle.h" 13 #include "content/public/test/test_browser_thread_bundle.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 const char kOriginA[] = "https://origina.org"; 16 const char kOriginA[] = "https://origina.org";
16 const char kOriginB[] = "https://originb.org"; 17 const char kOriginB[] = "https://originb.org";
(...skipping 29 matching lines...) Expand all
46 public: 47 public:
47 PushMessagingPermissionContextTest() {} 48 PushMessagingPermissionContextTest() {}
48 49
49 protected: 50 protected:
50 void SetContentSetting(Profile* profile, 51 void SetContentSetting(Profile* profile,
51 ContentSettingsType setting, 52 ContentSettingsType setting,
52 ContentSetting value) { 53 ContentSetting value) {
53 ContentSettingsPattern pattern = 54 ContentSettingsPattern pattern =
54 ContentSettingsPattern::FromString(kOriginA); 55 ContentSettingsPattern::FromString(kOriginA);
55 HostContentSettingsMap* host_content_settings_map = 56 HostContentSettingsMap* host_content_settings_map =
56 profile->GetHostContentSettingsMap(); 57 HostContentSettingsMapFactory::GetForProfile(profile);
57 host_content_settings_map->SetContentSetting(pattern, pattern, setting, 58 host_content_settings_map->SetContentSetting(pattern, pattern, setting,
58 std::string(), value); 59 std::string(), value);
59 } 60 }
60 61
61 content::TestBrowserThreadBundle thread_bundle_; 62 content::TestBrowserThreadBundle thread_bundle_;
62 }; 63 };
63 64
64 TEST_F(PushMessagingPermissionContextTest, HasPermissionPrompt) { 65 TEST_F(PushMessagingPermissionContextTest, HasPermissionPrompt) {
65 TestingProfile profile; 66 TestingProfile profile;
66 PushMessagingPermissionContext context(&profile); 67 PushMessagingPermissionContext context(&profile);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 EXPECT_TRUE(context.was_persisted()); 155 EXPECT_TRUE(context.was_persisted());
155 EXPECT_FALSE(context.was_granted()); 156 EXPECT_FALSE(context.was_granted());
156 157
157 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, 158 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING,
158 CONTENT_SETTING_ASK); 159 CONTENT_SETTING_ASK);
159 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA), 160 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA),
160 callback, CONTENT_SETTING_ALLOW); 161 callback, CONTENT_SETTING_ALLOW);
161 EXPECT_TRUE(context.was_persisted()); 162 EXPECT_TRUE(context.was_persisted());
162 EXPECT_TRUE(context.was_granted()); 163 EXPECT_TRUE(context.was_granted());
163 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698