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

Side by Side Diff: content/browser/notifications/platform_notification_context_unittest.cc

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: change useCache to updateViaCache Created 3 years, 6 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
OLDNEW
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 321
322 OverrideTaskRunnerForTesting(notification_context.get()); 322 OverrideTaskRunnerForTesting(notification_context.get());
323 323
324 GURL origin("https://example.com"); 324 GURL origin("https://example.com");
325 GURL script_url("https://example.com/worker.js"); 325 GURL script_url("https://example.com/worker.js");
326 326
327 int64_t service_worker_registration_id = kInvalidServiceWorkerRegistrationId; 327 int64_t service_worker_registration_id = kInvalidServiceWorkerRegistrationId;
328 328
329 // Register a Service Worker to get a valid registration id. 329 // Register a Service Worker to get a valid registration id.
330 embedded_worker_test_helper->context()->RegisterServiceWorker( 330 embedded_worker_test_helper->context()->RegisterServiceWorker(
331 origin, script_url, nullptr /* provider_host */, 331 script_url, ServiceWorkerRegistrationOptions(origin),
332 nullptr /* provider_host */,
332 base::Bind(&PlatformNotificationContextTest::DidRegisterServiceWorker, 333 base::Bind(&PlatformNotificationContextTest::DidRegisterServiceWorker,
333 base::Unretained(this), &service_worker_registration_id)); 334 base::Unretained(this), &service_worker_registration_id));
334 335
335 base::RunLoop().RunUntilIdle(); 336 base::RunLoop().RunUntilIdle();
336 ASSERT_NE(service_worker_registration_id, 337 ASSERT_NE(service_worker_registration_id,
337 kInvalidServiceWorkerRegistrationId); 338 kInvalidServiceWorkerRegistrationId);
338 339
339 NotificationDatabaseData notification_database_data; 340 NotificationDatabaseData notification_database_data;
340 341
341 // Create a notification for that Service Worker registration. 342 // Create a notification for that Service Worker registration.
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 base::Unretained(this))); 560 base::Unretained(this)));
560 561
561 base::RunLoop().RunUntilIdle(); 562 base::RunLoop().RunUntilIdle();
562 563
563 // The notification was removed, so we shouldn't be able to read it from 564 // The notification was removed, so we shouldn't be able to read it from
564 // the database anymore. 565 // the database anymore.
565 EXPECT_FALSE(success()); 566 EXPECT_FALSE(success());
566 } 567 }
567 568
568 } // namespace content 569 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698