| 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 "base/run_loop.h" | 5 #include "base/run_loop.h" |
| 6 #include "content/browser/appcache/appcache.h" | 6 #include "content/browser/appcache/appcache.h" |
| 7 #include "content/browser/appcache/appcache_group.h" | 7 #include "content/browser/appcache/appcache_group.h" |
| 8 #include "content/browser/appcache/appcache_response.h" | 8 #include "content/browser/appcache/appcache_response.h" |
| 9 #include "content/browser/appcache/appcache_storage.h" | 9 #include "content/browser/appcache/appcache_storage.h" |
| 10 #include "content/browser/appcache/mock_appcache_service.h" | 10 #include "content/browser/appcache/mock_appcache_service.h" |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 // fallback namespace and entry. | 462 // fallback namespace and entry. |
| 463 const int64 kCacheId = storage->NewCacheId(); | 463 const int64 kCacheId = storage->NewCacheId(); |
| 464 const GURL kFallbackEntryUrl1("http://blah/fallback_entry1"); | 464 const GURL kFallbackEntryUrl1("http://blah/fallback_entry1"); |
| 465 const GURL kFallbackNamespaceUrl1("http://blah/fallback_namespace/"); | 465 const GURL kFallbackNamespaceUrl1("http://blah/fallback_namespace/"); |
| 466 const GURL kFallbackEntryUrl2("http://blah/fallback_entry2"); | 466 const GURL kFallbackEntryUrl2("http://blah/fallback_entry2"); |
| 467 const GURL kFallbackNamespaceUrl2("http://blah/fallback_namespace/longer"); | 467 const GURL kFallbackNamespaceUrl2("http://blah/fallback_namespace/longer"); |
| 468 const GURL kManifestUrl("http://blah/manifest"); | 468 const GURL kManifestUrl("http://blah/manifest"); |
| 469 const int64 kResponseId1 = 1; | 469 const int64 kResponseId1 = 1; |
| 470 const int64 kResponseId2 = 2; | 470 const int64 kResponseId2 = 2; |
| 471 | 471 |
| 472 Manifest manifest; | 472 AppCacheManifest manifest; |
| 473 manifest.fallback_namespaces.push_back( | 473 manifest.fallback_namespaces.push_back( |
| 474 AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl1, | 474 AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl1, |
| 475 kFallbackEntryUrl1, false)); | 475 kFallbackEntryUrl1, false)); |
| 476 manifest.fallback_namespaces.push_back( | 476 manifest.fallback_namespaces.push_back( |
| 477 AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl2, | 477 AppCacheNamespace(APPCACHE_FALLBACK_NAMESPACE, kFallbackNamespaceUrl2, |
| 478 kFallbackEntryUrl2, false)); | 478 kFallbackEntryUrl2, false)); |
| 479 | 479 |
| 480 scoped_refptr<AppCache> cache(new AppCache(service.storage(), kCacheId)); | 480 scoped_refptr<AppCache> cache(new AppCache(service.storage(), kCacheId)); |
| 481 cache->InitializeWithManifest(&manifest); | 481 cache->InitializeWithManifest(&manifest); |
| 482 cache->AddEntry(kFallbackEntryUrl1, | 482 cache->AddEntry(kFallbackEntryUrl1, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 // Setup some preconditions. Create a complete cache with a | 575 // Setup some preconditions. Create a complete cache with a |
| 576 // foreign entry and an online namespace. | 576 // foreign entry and an online namespace. |
| 577 | 577 |
| 578 const int64 kCacheId = storage->NewCacheId(); | 578 const int64 kCacheId = storage->NewCacheId(); |
| 579 const GURL kEntryUrl("http://blah/entry"); | 579 const GURL kEntryUrl("http://blah/entry"); |
| 580 const GURL kManifestUrl("http://blah/manifest"); | 580 const GURL kManifestUrl("http://blah/manifest"); |
| 581 const GURL kOnlineNamespaceUrl("http://blah/online_namespace"); | 581 const GURL kOnlineNamespaceUrl("http://blah/online_namespace"); |
| 582 const int64 kResponseId = 1; | 582 const int64 kResponseId = 1; |
| 583 | 583 |
| 584 Manifest manifest; | 584 AppCacheManifest manifest; |
| 585 manifest.online_whitelist_namespaces.push_back( | 585 manifest.online_whitelist_namespaces.push_back( |
| 586 AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, kOnlineNamespaceUrl, | 586 AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, kOnlineNamespaceUrl, |
| 587 GURL(), false)); | 587 GURL(), false)); |
| 588 scoped_refptr<AppCache> cache(new AppCache(service.storage(), kCacheId)); | 588 scoped_refptr<AppCache> cache(new AppCache(service.storage(), kCacheId)); |
| 589 cache->InitializeWithManifest(&manifest); | 589 cache->InitializeWithManifest(&manifest); |
| 590 cache->AddEntry( | 590 cache->AddEntry( |
| 591 kEntryUrl, | 591 kEntryUrl, |
| 592 AppCacheEntry(AppCacheEntry::EXPLICIT | AppCacheEntry::FOREIGN, | 592 AppCacheEntry(AppCacheEntry::EXPLICIT | AppCacheEntry::FOREIGN, |
| 593 kResponseId)); | 593 kResponseId)); |
| 594 cache->set_complete(true); | 594 cache->set_complete(true); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 625 EXPECT_EQ(kAppCacheNoCacheId, delegate.found_cache_id_); | 625 EXPECT_EQ(kAppCacheNoCacheId, delegate.found_cache_id_); |
| 626 EXPECT_EQ(kAppCacheNoResponseId, delegate.found_entry_.response_id()); | 626 EXPECT_EQ(kAppCacheNoResponseId, delegate.found_entry_.response_id()); |
| 627 EXPECT_EQ(kAppCacheNoResponseId, | 627 EXPECT_EQ(kAppCacheNoResponseId, |
| 628 delegate.found_fallback_entry_.response_id()); | 628 delegate.found_fallback_entry_.response_id()); |
| 629 EXPECT_TRUE(delegate.found_fallback_url_.is_empty()); | 629 EXPECT_TRUE(delegate.found_fallback_url_.is_empty()); |
| 630 EXPECT_EQ(0, delegate.found_entry_.types()); | 630 EXPECT_EQ(0, delegate.found_entry_.types()); |
| 631 EXPECT_EQ(0, delegate.found_fallback_entry_.types()); | 631 EXPECT_EQ(0, delegate.found_fallback_entry_.types()); |
| 632 } | 632 } |
| 633 | 633 |
| 634 } // namespace content | 634 } // namespace content |
| OLD | NEW |