| OLD | NEW |
| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 class ServiceWorkerPushMessagingTest : public ServiceWorkerTest { | 217 class ServiceWorkerPushMessagingTest : public ServiceWorkerTest { |
| 218 public: | 218 public: |
| 219 ServiceWorkerPushMessagingTest() | 219 ServiceWorkerPushMessagingTest() |
| 220 : gcm_driver_(nullptr), push_service_(nullptr) {} | 220 : gcm_driver_(nullptr), push_service_(nullptr) {} |
| 221 ~ServiceWorkerPushMessagingTest() override {} | 221 ~ServiceWorkerPushMessagingTest() override {} |
| 222 | 222 |
| 223 void GrantNotificationPermissionForTest(const GURL& url) { | 223 void GrantNotificationPermissionForTest(const GURL& url) { |
| 224 GURL origin = url.GetOrigin(); | 224 GURL origin = url.GetOrigin(); |
| 225 DesktopNotificationProfileUtil::GrantPermission(profile(), origin); | 225 DesktopNotificationProfileUtil::GrantPermission(profile(), origin); |
| 226 ASSERT_EQ(blink::mojom::PermissionStatus::GRANTED, | 226 ASSERT_EQ(CONTENT_SETTING_ALLOW, |
| 227 PermissionManager::Get(profile())->GetPermissionStatus( | 227 PermissionManager::Get(profile())->GetPermissionStatus( |
| 228 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin)); | 228 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin)); |
| 229 } | 229 } |
| 230 | 230 |
| 231 PushMessagingAppIdentifier GetAppIdentifierForServiceWorkerRegistration( | 231 PushMessagingAppIdentifier GetAppIdentifierForServiceWorkerRegistration( |
| 232 int64_t service_worker_registration_id, | 232 int64_t service_worker_registration_id, |
| 233 const GURL& origin) { | 233 const GURL& origin) { |
| 234 PushMessagingAppIdentifier app_identifier = | 234 PushMessagingAppIdentifier app_identifier = |
| 235 PushMessagingAppIdentifier::FindByServiceWorker( | 235 PushMessagingAppIdentifier::FindByServiceWorker( |
| 236 profile(), origin, service_worker_registration_id); | 236 profile(), origin, service_worker_registration_id); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 message.sender_id = "1234567890"; | 860 message.sender_id = "1234567890"; |
| 861 message.raw_data = "testdata"; | 861 message.raw_data = "testdata"; |
| 862 message.decrypted = true; | 862 message.decrypted = true; |
| 863 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); | 863 push_service()->SetMessageCallbackForTesting(run_loop.QuitClosure()); |
| 864 push_service()->OnMessage(app_identifier.app_id(), message); | 864 push_service()->OnMessage(app_identifier.app_id(), message); |
| 865 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); | 865 EXPECT_TRUE(push_message_listener.WaitUntilSatisfied()); |
| 866 run_loop.Run(); // Wait until the message is handled by push service. | 866 run_loop.Run(); // Wait until the message is handled by push service. |
| 867 } | 867 } |
| 868 | 868 |
| 869 } // namespace extensions | 869 } // namespace extensions |
| OLD | NEW |