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

Side by Side Diff: chrome/browser/push_messaging/push_messaging_permission_context_unittest.cc

Issue 2200263002: CL #2204863002 for M52: Ensure push permission is denied when dismissed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2743
Patch Set: 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
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_permission_context.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/content_settings/host_content_settings_map_factory.h"
8 #include "chrome/browser/permissions/permission_request_id.h" 8 #include "chrome/browser/permissions/permission_request_id.h"
9 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 9 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
10 #include "chrome/test/base/testing_profile.h" 10 #include "chrome/test/base/testing_profile.h"
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 context.GetPermissionStatus(GURL(kOriginA), GURL(kOriginA))); 157 context.GetPermissionStatus(GURL(kOriginA), GURL(kOriginA)));
158 } 158 }
159 159
160 TEST_F(PushMessagingPermissionContextTest, DecidePushPermission) { 160 TEST_F(PushMessagingPermissionContextTest, DecidePushPermission) {
161 TestingProfile profile; 161 TestingProfile profile;
162 TestPushMessagingPermissionContext context(&profile); 162 TestPushMessagingPermissionContext context(&profile);
163 PermissionRequestID request_id(-1, -1, -1); 163 PermissionRequestID request_id(-1, -1, -1);
164 BrowserPermissionCallback callback = base::Bind(DoNothing); 164 BrowserPermissionCallback callback = base::Bind(DoNothing);
165 165
166 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA), 166 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA),
167 callback, blink::mojom::PermissionStatus::ASK);
168 EXPECT_FALSE(context.was_persisted());
169 EXPECT_FALSE(context.was_granted());
170
171 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA),
167 callback, 172 callback,
168 blink::mojom::PermissionStatus::DENIED); 173 blink::mojom::PermissionStatus::DENIED);
169 EXPECT_FALSE(context.was_persisted()); 174 EXPECT_FALSE(context.was_persisted());
170 EXPECT_FALSE(context.was_granted()); 175 EXPECT_FALSE(context.was_granted());
171 176
172 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, 177 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING,
173 CONTENT_SETTING_ALLOW); 178 CONTENT_SETTING_ALLOW);
174 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA), 179 context.DecidePushPermission(request_id, GURL(kOriginA), GURL(kOriginA),
175 callback, 180 callback,
176 blink::mojom::PermissionStatus::GRANTED); 181 blink::mojom::PermissionStatus::GRANTED);
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 EXPECT_EQ(CONTENT_SETTING_BLOCK, 310 EXPECT_EQ(CONTENT_SETTING_BLOCK,
306 context.GetPermissionStatus(GURL(kInsecureOrigin), 311 context.GetPermissionStatus(GURL(kInsecureOrigin),
307 GURL(kInsecureOrigin))); 312 GURL(kInsecureOrigin)));
308 313
309 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, 314 SetContentSetting(&profile, CONTENT_SETTINGS_TYPE_PUSH_MESSAGING,
310 CONTENT_SETTING_ASK); 315 CONTENT_SETTING_ASK);
311 EXPECT_EQ(CONTENT_SETTING_BLOCK, 316 EXPECT_EQ(CONTENT_SETTING_BLOCK,
312 context.GetPermissionStatus(GURL(kInsecureOrigin), 317 context.GetPermissionStatus(GURL(kInsecureOrigin),
313 GURL(kInsecureOrigin))); 318 GURL(kInsecureOrigin)));
314 } 319 }
OLDNEW
« no previous file with comments | « chrome/browser/push_messaging/push_messaging_permission_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698