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

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

Issue 1316973002: Pass WebPushError::ErrorTypePermissionDenied when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | content/child/push_messaging/push_provider.cc » ('j') | 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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/barrier_closure.h" 8 #include "base/barrier_closure.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, 300 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest,
301 SubscribeFailureNotificationsBlocked) { 301 SubscribeFailureNotificationsBlocked) {
302 std::string script_result; 302 std::string script_result;
303 303
304 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 304 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
305 ASSERT_EQ("ok - service worker registered", script_result); 305 ASSERT_EQ("ok - service worker registered", script_result);
306 306
307 RequestAndDenyPermission(); 307 RequestAndDenyPermission();
308 308
309 ASSERT_TRUE(RunScript("subscribePush()", &script_result)); 309 ASSERT_TRUE(RunScript("subscribePush()", &script_result));
310 EXPECT_EQ("AbortError - Registration failed - permission denied", 310 EXPECT_EQ("PermissionDeniedError - Registration failed - permission denied",
311 script_result); 311 script_result);
312 } 312 }
313 313
314 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureNoManifest) { 314 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribeFailureNoManifest) {
315 std::string script_result; 315 std::string script_result;
316 316
317 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 317 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
318 ASSERT_EQ("ok - service worker registered", script_result); 318 ASSERT_EQ("ok - service worker registered", script_result);
319 319
320 RequestAndAcceptPermission(); 320 RequestAndAcceptPermission();
(...skipping 11 matching lines...) Expand all
332 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTestEmptySubscriptionOptions, 332 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTestEmptySubscriptionOptions,
333 RegisterFailureEmptyPushSubscriptionOptions) { 333 RegisterFailureEmptyPushSubscriptionOptions) {
334 std::string script_result; 334 std::string script_result;
335 335
336 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 336 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
337 ASSERT_EQ("ok - service worker registered", script_result); 337 ASSERT_EQ("ok - service worker registered", script_result);
338 338
339 RequestAndAcceptPermission(); 339 RequestAndAcceptPermission();
340 340
341 ASSERT_TRUE(RunScript("subscribePush()", &script_result)); 341 ASSERT_TRUE(RunScript("subscribePush()", &script_result));
342 EXPECT_EQ("AbortError - Registration failed - permission denied", 342 EXPECT_EQ("PermissionDeniedError - Registration failed - permission denied",
343 script_result); 343 script_result);
344 } 344 }
345 345
346 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) { 346 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) {
347 std::string script_result; 347 std::string script_result;
348 348
349 // First, test that Service Worker registration IDs are assigned in order of 349 // First, test that Service Worker registration IDs are assigned in order of
350 // registering the Service Workers, and the (fake) push subscription ids are 350 // registering the Service Workers, and the (fake) push subscription ids are
351 // assigned in order of push subscription (even when these orders are 351 // assigned in order of push subscription (even when these orders are
352 // different). 352 // different).
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 699
700 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysDenied) { 700 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, PermissionStateSaysDenied) {
701 std::string script_result; 701 std::string script_result;
702 702
703 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 703 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
704 ASSERT_EQ("ok - service worker registered", script_result); 704 ASSERT_EQ("ok - service worker registered", script_result);
705 705
706 RequestAndDenyPermission(); 706 RequestAndDenyPermission();
707 707
708 ASSERT_TRUE(RunScript("subscribePush()", &script_result)); 708 ASSERT_TRUE(RunScript("subscribePush()", &script_result));
709 EXPECT_EQ("AbortError - Registration failed - permission denied", 709 EXPECT_EQ("PermissionDeniedError - Registration failed - permission denied",
710 script_result); 710 script_result);
711 711
712 ASSERT_TRUE(RunScript("permissionState()", &script_result)); 712 ASSERT_TRUE(RunScript("permissionState()", &script_result));
713 EXPECT_EQ("permission status - denied", script_result); 713 EXPECT_EQ("permission status - denied", script_result);
714 } 714 }
715 715
716 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeSuccess) { 716 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, UnsubscribeSuccess) {
717 std::string script_result; 717 std::string script_result;
718 718
719 EXPECT_TRUE(RunScript("registerServiceWorker()", &script_result)); 719 EXPECT_TRUE(RunScript("registerServiceWorker()", &script_result));
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 std::string script_result; 1139 std::string script_result;
1140 1140
1141 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); 1141 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result));
1142 ASSERT_EQ("ok - service worker registered", script_result); 1142 ASSERT_EQ("ok - service worker registered", script_result);
1143 1143
1144 // In Incognito mode the promise returned by getSubscription should not hang, 1144 // In Incognito mode the promise returned by getSubscription should not hang,
1145 // it should just fulfill with null. 1145 // it should just fulfill with null.
1146 ASSERT_TRUE(RunScript("hasSubscription()", &script_result)); 1146 ASSERT_TRUE(RunScript("hasSubscription()", &script_result));
1147 ASSERT_EQ("false - not subscribed", script_result); 1147 ASSERT_EQ("false - not subscribed", script_result);
1148 } 1148 }
OLDNEW
« no previous file with comments | « no previous file | content/child/push_messaging/push_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698