| 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.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 OverrideTaskRunnerForTesting(notification_context.get()); | 306 OverrideTaskRunnerForTesting(notification_context.get()); |
| 307 | 307 |
| 308 GURL origin("https://example.com"); | 308 GURL origin("https://example.com"); |
| 309 GURL script_url("https://example.com/worker.js"); | 309 GURL script_url("https://example.com/worker.js"); |
| 310 | 310 |
| 311 int64_t service_worker_registration_id = kInvalidServiceWorkerRegistrationId; | 311 int64_t service_worker_registration_id = kInvalidServiceWorkerRegistrationId; |
| 312 | 312 |
| 313 // Register a Service Worker to get a valid registration id. | 313 // Register a Service Worker to get a valid registration id. |
| 314 embedded_worker_test_helper->context()->RegisterServiceWorker( | 314 embedded_worker_test_helper->context()->RegisterServiceWorker( |
| 315 origin, script_url, nullptr /* provider_host */, | 315 script_url, ServiceWorkerRegistrationOptions(origin), |
| 316 nullptr /* provider_host */, |
| 316 base::Bind(&PlatformNotificationContextTest::DidRegisterServiceWorker, | 317 base::Bind(&PlatformNotificationContextTest::DidRegisterServiceWorker, |
| 317 base::Unretained(this), &service_worker_registration_id)); | 318 base::Unretained(this), &service_worker_registration_id)); |
| 318 | 319 |
| 319 base::RunLoop().RunUntilIdle(); | 320 base::RunLoop().RunUntilIdle(); |
| 320 ASSERT_NE(service_worker_registration_id, | 321 ASSERT_NE(service_worker_registration_id, |
| 321 kInvalidServiceWorkerRegistrationId); | 322 kInvalidServiceWorkerRegistrationId); |
| 322 | 323 |
| 323 NotificationDatabaseData notification_database_data; | 324 NotificationDatabaseData notification_database_data; |
| 324 | 325 |
| 325 // Create a notification for that Service Worker registration. | 326 // Create a notification for that Service Worker registration. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 ASSERT_EQ(10u, notification_database_datas.size()); | 479 ASSERT_EQ(10u, notification_database_datas.size()); |
| 479 | 480 |
| 480 for (int i = 0; i < 10; ++i) { | 481 for (int i = 0; i < 10; ++i) { |
| 481 EXPECT_EQ(origin, notification_database_datas[i].origin); | 482 EXPECT_EQ(origin, notification_database_datas[i].origin); |
| 482 EXPECT_EQ(kFakeServiceWorkerRegistrationId, | 483 EXPECT_EQ(kFakeServiceWorkerRegistrationId, |
| 483 notification_database_datas[i].service_worker_registration_id); | 484 notification_database_datas[i].service_worker_registration_id); |
| 484 } | 485 } |
| 485 } | 486 } |
| 486 | 487 |
| 487 } // namespace content | 488 } // namespace content |
| OLD | NEW |