| 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 "content/public/browser/push_messaging_service.h" | 5 #include "content/public/browser/push_messaging_service.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // Implementation of the PushMessagingPermissionContext that always allows usage | 59 // Implementation of the PushMessagingPermissionContext that always allows usage |
| 60 // of Push Messaging, regardless of the actual implementation. | 60 // of Push Messaging, regardless of the actual implementation. |
| 61 class FakePushMessagingPermissionContext | 61 class FakePushMessagingPermissionContext |
| 62 : public PushMessagingPermissionContext { | 62 : public PushMessagingPermissionContext { |
| 63 public: | 63 public: |
| 64 explicit FakePushMessagingPermissionContext(Profile* profile) | 64 explicit FakePushMessagingPermissionContext(Profile* profile) |
| 65 : PushMessagingPermissionContext(profile) {} | 65 : PushMessagingPermissionContext(profile) {} |
| 66 ~FakePushMessagingPermissionContext() override {} | 66 ~FakePushMessagingPermissionContext() override {} |
| 67 | 67 |
| 68 ContentSetting GetPermissionStatus( | 68 ContentSetting GetPermissionStatus( |
| 69 const GURL& requesting_origin, | 69 const url::Origin& requesting_origin, |
| 70 const GURL& embedding_origin) const override { | 70 const url::Origin& embedding_origin) const override { |
| 71 return CONTENT_SETTING_ALLOW; | 71 return CONTENT_SETTING_ALLOW; |
| 72 } | 72 } |
| 73 }; | 73 }; |
| 74 | 74 |
| 75 scoped_ptr<KeyedService> BuildFakePushMessagingPermissionContext( | 75 scoped_ptr<KeyedService> BuildFakePushMessagingPermissionContext( |
| 76 content::BrowserContext* context) { | 76 content::BrowserContext* context) { |
| 77 return scoped_ptr<KeyedService>( | 77 return scoped_ptr<KeyedService>( |
| 78 new FakePushMessagingPermissionContext(static_cast<Profile*>(context))); | 78 new FakePushMessagingPermissionContext(static_cast<Profile*>(context))); |
| 79 } | 79 } |
| 80 | 80 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 // (6) Verify that the message, as received by the Push Messaging Service, has | 212 // (6) Verify that the message, as received by the Push Messaging Service, has |
| 213 // indeed been decrypted by the GCM Driver, and has been forwarded to the | 213 // indeed been decrypted by the GCM Driver, and has been forwarded to the |
| 214 // Service Worker that has been associated with the subscription. | 214 // Service Worker that has been associated with the subscription. |
| 215 EXPECT_EQ(app_identifier.app_id(), app_id); | 215 EXPECT_EQ(app_identifier.app_id(), app_id); |
| 216 EXPECT_EQ(origin, dispatched_origin); | 216 EXPECT_EQ(origin, dispatched_origin); |
| 217 EXPECT_EQ(service_worker_registration_id, kTestServiceWorkerId); | 217 EXPECT_EQ(service_worker_registration_id, kTestServiceWorkerId); |
| 218 | 218 |
| 219 EXPECT_FALSE(payload.is_null); | 219 EXPECT_FALSE(payload.is_null); |
| 220 EXPECT_EQ(kTestPayload, payload.data); | 220 EXPECT_EQ(kTestPayload, payload.data); |
| 221 } | 221 } |
| OLD | NEW |