OLD | NEW |
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | 363 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
364 ASSERT_EQ("ok - service worker registered", script_result); | 364 ASSERT_EQ("ok - service worker registered", script_result); |
365 | 365 |
366 InfoBarResponder accepting_responder(GetInfoBarService(), true); | 366 InfoBarResponder accepting_responder(GetInfoBarService(), true); |
367 ASSERT_TRUE(RunScript("requestNotificationPermission();", &script_result)); | 367 ASSERT_TRUE(RunScript("requestNotificationPermission();", &script_result)); |
368 EXPECT_EQ("permission status - granted", script_result); | 368 EXPECT_EQ("permission status - granted", script_result); |
369 | 369 |
370 ASSERT_TRUE(RunScript("subscribePush()", &script_result)); | 370 ASSERT_TRUE(RunScript("subscribePush()", &script_result)); |
371 EXPECT_EQ(GetEndpointForSubscriptionId("1-0"), script_result); | 371 EXPECT_EQ(GetEndpointForSubscriptionId("1-0"), script_result); |
372 | 372 |
| 373 // permissionState has been introduced later so it does not |
| 374 // respect the manifest key. |
373 ASSERT_TRUE(RunScript("permissionState()", &script_result)); | 375 ASSERT_TRUE(RunScript("permissionState()", &script_result)); |
374 EXPECT_EQ("permission status - granted", script_result); | 376 EXPECT_EQ( |
| 377 "NotSupportedError - Push subscriptions that don't enable" |
| 378 " userVisibleOnly are not supported.", |
| 379 script_result); |
375 } | 380 } |
376 | 381 |
377 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) { | 382 IN_PROC_BROWSER_TEST_F(PushMessagingBrowserTest, SubscribePersisted) { |
378 std::string script_result; | 383 std::string script_result; |
379 | 384 |
380 // First, test that Service Worker registration IDs are assigned in order of | 385 // First, test that Service Worker registration IDs are assigned in order of |
381 // registering the Service Workers, and the (fake) push subscription ids are | 386 // registering the Service Workers, and the (fake) push subscription ids are |
382 // assigned in order of push subscription (even when these orders are | 387 // assigned in order of push subscription (even when these orders are |
383 // different). | 388 // different). |
384 | 389 |
(...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1092 std::string script_result; | 1097 std::string script_result; |
1093 | 1098 |
1094 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); | 1099 ASSERT_TRUE(RunScript("registerServiceWorker()", &script_result)); |
1095 ASSERT_EQ("ok - service worker registered", script_result); | 1100 ASSERT_EQ("ok - service worker registered", script_result); |
1096 | 1101 |
1097 // In Incognito mode the promise returned by getSubscription should not hang, | 1102 // In Incognito mode the promise returned by getSubscription should not hang, |
1098 // it should just fulfill with null. | 1103 // it should just fulfill with null. |
1099 ASSERT_TRUE(RunScript("hasSubscription()", &script_result)); | 1104 ASSERT_TRUE(RunScript("hasSubscription()", &script_result)); |
1100 ASSERT_EQ("false - not subscribed", script_result); | 1105 ASSERT_EQ("false - not subscribed", script_result); |
1101 } | 1106 } |
OLD | NEW |