| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/appcache/appcache_host.h" | 5 #include "content/browser/appcache/appcache_host.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 EXPECT_FALSE(host.group_being_updated_.get()); | 417 EXPECT_FALSE(host.group_being_updated_.get()); |
| 418 EXPECT_FALSE(host.swappable_cache_.get()); // group2 had no newest cache | 418 EXPECT_FALSE(host.swappable_cache_.get()); // group2 had no newest cache |
| 419 } | 419 } |
| 420 | 420 |
| 421 TEST_F(AppCacheHostTest, ForDedicatedWorker) { | 421 TEST_F(AppCacheHostTest, ForDedicatedWorker) { |
| 422 const int kMockProcessId = 1; | 422 const int kMockProcessId = 1; |
| 423 const int kParentHostId = 1; | 423 const int kParentHostId = 1; |
| 424 const int kWorkerHostId = 2; | 424 const int kWorkerHostId = 2; |
| 425 | 425 |
| 426 AppCacheBackendImpl backend_impl; | 426 AppCacheBackendImpl backend_impl; |
| 427 backend_impl.Initialize(&service_, &mock_frontend_, kMockProcessId); | 427 backend_impl.Initialize(&service_, &mock_frontend_, kMockProcessId, -1); |
| 428 backend_impl.RegisterHost(kParentHostId); | 428 backend_impl.RegisterHost(kParentHostId); |
| 429 backend_impl.RegisterHost(kWorkerHostId); | 429 backend_impl.RegisterHost(kWorkerHostId); |
| 430 | 430 |
| 431 AppCacheHost* parent_host = backend_impl.GetHost(kParentHostId); | 431 AppCacheHost* parent_host = backend_impl.GetHost(kParentHostId); |
| 432 EXPECT_FALSE(parent_host->is_for_dedicated_worker()); | 432 EXPECT_FALSE(parent_host->is_for_dedicated_worker()); |
| 433 | 433 |
| 434 AppCacheHost* worker_host = backend_impl.GetHost(kWorkerHostId); | 434 AppCacheHost* worker_host = backend_impl.GetHost(kWorkerHostId); |
| 435 worker_host->SelectCacheForWorker(kParentHostId, kMockProcessId); | 435 worker_host->SelectCacheForWorker(kParentHostId, kMockProcessId); |
| 436 EXPECT_TRUE(worker_host->is_for_dedicated_worker()); | 436 EXPECT_TRUE(worker_host->is_for_dedicated_worker()); |
| 437 EXPECT_EQ(parent_host, worker_host->GetParentAppCacheHost()); | 437 EXPECT_EQ(parent_host, worker_host->GetParentAppCacheHost()); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 EXPECT_TRUE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); | 541 EXPECT_TRUE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); |
| 542 | 542 |
| 543 // Select methods should bail if cache has already been selected. | 543 // Select methods should bail if cache has already been selected. |
| 544 EXPECT_FALSE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); | 544 EXPECT_FALSE(host.SelectCache(kDocAndOriginUrl, kAppCacheNoCacheId, GURL())); |
| 545 EXPECT_FALSE(host.SelectCacheForWorker(0, 0)); | 545 EXPECT_FALSE(host.SelectCacheForWorker(0, 0)); |
| 546 EXPECT_FALSE(host.SelectCacheForSharedWorker(kAppCacheNoCacheId)); | 546 EXPECT_FALSE(host.SelectCacheForSharedWorker(kAppCacheNoCacheId)); |
| 547 EXPECT_FALSE(host.MarkAsForeignEntry(kDocAndOriginUrl, kAppCacheNoCacheId)); | 547 EXPECT_FALSE(host.MarkAsForeignEntry(kDocAndOriginUrl, kAppCacheNoCacheId)); |
| 548 } | 548 } |
| 549 | 549 |
| 550 } // namespace content | 550 } // namespace content |
| OLD | NEW |