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

Side by Side Diff: content/browser/service_worker/service_worker_storage_unittest.cc

Issue 2055433002: Revert of service worker: Don't control a subframe of an insecure context (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/browser/service_worker/service_worker_storage.h" 5 #include "content/browser/service_worker/service_worker_storage.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1269 } 1269 }
1270 1270
1271 TEST_F(ServiceWorkerResourceStorageTest, DeleteRegistration_ActiveVersion) { 1271 TEST_F(ServiceWorkerResourceStorageTest, DeleteRegistration_ActiveVersion) {
1272 // Promote the worker to active and add a controllee. 1272 // Promote the worker to active and add a controllee.
1273 registration_->SetActiveVersion(registration_->waiting_version()); 1273 registration_->SetActiveVersion(registration_->waiting_version());
1274 storage()->UpdateToActiveState( 1274 storage()->UpdateToActiveState(
1275 registration_.get(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 1275 registration_.get(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
1276 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( 1276 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost(
1277 33 /* dummy render process id */, MSG_ROUTING_NONE, 1277 33 /* dummy render process id */, MSG_ROUTING_NONE,
1278 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, 1278 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
1279 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
1280 context()->AsWeakPtr(), NULL)); 1279 context()->AsWeakPtr(), NULL));
1281 registration_->active_version()->AddControllee(host.get()); 1280 registration_->active_version()->AddControllee(host.get());
1282 1281
1283 bool was_called = false; 1282 bool was_called = false;
1284 ServiceWorkerStatusCode result = SERVICE_WORKER_ERROR_FAILED; 1283 ServiceWorkerStatusCode result = SERVICE_WORKER_ERROR_FAILED;
1285 std::set<int64_t> verify_ids; 1284 std::set<int64_t> verify_ids;
1286 1285
1287 // Deleting the registration should move the resources to the purgeable list 1286 // Deleting the registration should move the resources to the purgeable list
1288 // but keep them available. 1287 // but keep them available.
1289 storage()->DeleteRegistration( 1288 storage()->DeleteRegistration(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 1320
1322 TEST_F(ServiceWorkerResourceStorageDiskTest, CleanupOnRestart) { 1321 TEST_F(ServiceWorkerResourceStorageDiskTest, CleanupOnRestart) {
1323 // Promote the worker to active and add a controllee. 1322 // Promote the worker to active and add a controllee.
1324 registration_->SetActiveVersion(registration_->waiting_version()); 1323 registration_->SetActiveVersion(registration_->waiting_version());
1325 registration_->SetWaitingVersion(NULL); 1324 registration_->SetWaitingVersion(NULL);
1326 storage()->UpdateToActiveState( 1325 storage()->UpdateToActiveState(
1327 registration_.get(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 1326 registration_.get(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
1328 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( 1327 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost(
1329 33 /* dummy render process id */, MSG_ROUTING_NONE, 1328 33 /* dummy render process id */, MSG_ROUTING_NONE,
1330 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, 1329 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
1331 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
1332 context()->AsWeakPtr(), NULL)); 1330 context()->AsWeakPtr(), NULL));
1333 registration_->active_version()->AddControllee(host.get()); 1331 registration_->active_version()->AddControllee(host.get());
1334 1332
1335 bool was_called = false; 1333 bool was_called = false;
1336 ServiceWorkerStatusCode result = SERVICE_WORKER_ERROR_FAILED; 1334 ServiceWorkerStatusCode result = SERVICE_WORKER_ERROR_FAILED;
1337 std::set<int64_t> verify_ids; 1335 std::set<int64_t> verify_ids;
1338 1336
1339 // Deleting the registration should move the resources to the purgeable list 1337 // Deleting the registration should move the resources to the purgeable list
1340 // but keep them available. 1338 // but keep them available.
1341 storage()->DeleteRegistration( 1339 storage()->DeleteRegistration(
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 } 1479 }
1482 1480
1483 TEST_F(ServiceWorkerResourceStorageTest, UpdateRegistration) { 1481 TEST_F(ServiceWorkerResourceStorageTest, UpdateRegistration) {
1484 // Promote the worker to active worker and add a controllee. 1482 // Promote the worker to active worker and add a controllee.
1485 registration_->SetActiveVersion(registration_->waiting_version()); 1483 registration_->SetActiveVersion(registration_->waiting_version());
1486 storage()->UpdateToActiveState( 1484 storage()->UpdateToActiveState(
1487 registration_.get(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 1485 registration_.get(), base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
1488 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost( 1486 std::unique_ptr<ServiceWorkerProviderHost> host(new ServiceWorkerProviderHost(
1489 33 /* dummy render process id */, MSG_ROUTING_NONE, 1487 33 /* dummy render process id */, MSG_ROUTING_NONE,
1490 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, 1488 1 /* dummy provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW,
1491 ServiceWorkerProviderHost::FrameSecurityLevel::SECURE,
1492 context()->AsWeakPtr(), NULL)); 1489 context()->AsWeakPtr(), NULL));
1493 registration_->active_version()->AddControllee(host.get()); 1490 registration_->active_version()->AddControllee(host.get());
1494 1491
1495 bool was_called = false; 1492 bool was_called = false;
1496 ServiceWorkerStatusCode result = SERVICE_WORKER_ERROR_FAILED; 1493 ServiceWorkerStatusCode result = SERVICE_WORKER_ERROR_FAILED;
1497 std::set<int64_t> verify_ids; 1494 std::set<int64_t> verify_ids;
1498 1495
1499 // Make an updated registration. 1496 // Make an updated registration.
1500 scoped_refptr<ServiceWorkerVersion> live_version = new ServiceWorkerVersion( 1497 scoped_refptr<ServiceWorkerVersion> live_version = new ServiceWorkerVersion(
1501 registration_.get(), script_, storage()->NewVersionId(), 1498 registration_.get(), script_, storage()->NewVersionId(),
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 // Remove other registration at first origin. 1735 // Remove other registration at first origin.
1739 EXPECT_EQ(SERVICE_WORKER_OK, 1736 EXPECT_EQ(SERVICE_WORKER_OK,
1740 DeleteRegistration(kRegistrationId2, kScope2.GetOrigin())); 1737 DeleteRegistration(kRegistrationId2, kScope2.GetOrigin()));
1741 1738
1742 // No foreign fetch registrations remain. 1739 // No foreign fetch registrations remain.
1743 EXPECT_FALSE(storage()->OriginHasForeignFetchRegistrations(kOrigin1)); 1740 EXPECT_FALSE(storage()->OriginHasForeignFetchRegistrations(kOrigin1));
1744 EXPECT_FALSE(storage()->OriginHasForeignFetchRegistrations(kOrigin2)); 1741 EXPECT_FALSE(storage()->OriginHasForeignFetchRegistrations(kOrigin2));
1745 } 1742 }
1746 1743
1747 } // namespace content 1744 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698