| 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/mock_appcache_service.h" | 5 #include "content/browser/appcache/mock_appcache_service.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 #include "webkit/browser/appcache/appcache.h" | 7 #include "webkit/browser/appcache/appcache.h" |
| 8 #include "webkit/browser/appcache/appcache_host.h" | 8 #include "webkit/browser/appcache/appcache_host.h" |
| 9 | 9 |
| 10 using appcache::AppCache; | 10 using appcache::AppCache; |
| 11 using appcache::AppCacheDatabase; | 11 using appcache::AppCacheDatabase; |
| 12 using appcache::AppCacheEntry; | 12 using appcache::AppCacheEntry; |
| 13 using appcache::AppCacheFrontend; | 13 using appcache::AppCacheFrontend; |
| 14 using appcache::AppCacheGroup; | 14 using appcache::AppCacheGroup; |
| 15 using appcache::AppCacheHost; | 15 using appcache::AppCacheHost; |
| 16 using appcache::AppCacheInfo; | 16 using appcache::AppCacheInfo; |
| 17 using appcache::ErrorDetails; | 17 using appcache::ErrorDetails; |
| 18 using appcache::EventID; | 18 using appcache::EventID; |
| 19 using appcache::FALLBACK_NAMESPACE; | 19 using appcache::FALLBACK_NAMESPACE; |
| 20 using appcache::INTERCEPT_NAMESPACE; | 20 using appcache::INTERCEPT_NAMESPACE; |
| 21 using appcache::LogLevel; | 21 using appcache::LogLevel; |
| 22 using appcache::Manifest; | 22 using appcache::Manifest; |
| 23 using appcache::Namespace; | 23 using appcache::Namespace; |
| 24 using appcache::NamespaceVector; | 24 using appcache::NamespaceVector; |
| 25 using appcache::NETWORK_NAMESPACE; | 25 using appcache::NETWORK_NAMESPACE; |
| 26 using appcache::PARSE_MANIFEST_ALLOWING_INTERCEPTS; |
| 27 using appcache::PARSE_MANIFEST_PER_STANDARD; |
| 26 using appcache::Status; | 28 using appcache::Status; |
| 27 | 29 |
| 28 namespace content { | 30 namespace content { |
| 29 | 31 |
| 30 namespace { | 32 namespace { |
| 31 | 33 |
| 32 class MockAppCacheFrontend : public AppCacheFrontend { | 34 class MockAppCacheFrontend : public AppCacheFrontend { |
| 33 public: | 35 public: |
| 34 virtual void OnCacheSelected(int host_id, const AppCacheInfo& info) OVERRIDE { | 36 virtual void OnCacheSelected(int host_id, const AppCacheInfo& info) OVERRIDE { |
| 35 } | 37 } |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 "FALLBACK:\r" | 572 "FALLBACK:\r" |
| 571 "/ /fallback.html\r" | 573 "/ /fallback.html\r" |
| 572 "NETWORK:\r" | 574 "NETWORK:\r" |
| 573 "/whitelist* isPattern\r" | 575 "/whitelist* isPattern\r" |
| 574 "*\r"); | 576 "*\r"); |
| 575 MockAppCacheService service; | 577 MockAppCacheService service; |
| 576 scoped_refptr<AppCacheGroup> group = | 578 scoped_refptr<AppCacheGroup> group = |
| 577 new AppCacheGroup(service.storage(), kManifestUrl, kGroupId); | 579 new AppCacheGroup(service.storage(), kManifestUrl, kGroupId); |
| 578 scoped_refptr<AppCache> cache(new AppCache(service.storage(), kCacheId)); | 580 scoped_refptr<AppCache> cache(new AppCache(service.storage(), kCacheId)); |
| 579 Manifest manifest; | 581 Manifest manifest; |
| 580 EXPECT_TRUE( | 582 EXPECT_TRUE(ParseManifest(kManifestUrl, kData.c_str(), kData.length(), |
| 581 ParseManifest(kManifestUrl, kData.c_str(), kData.length(), manifest)); | 583 PARSE_MANIFEST_ALLOWING_INTERCEPTS, manifest)); |
| 582 cache->InitializeWithManifest(&manifest); | 584 cache->InitializeWithManifest(&manifest); |
| 583 EXPECT_EQ(NETWORK_NAMESPACE, cache->online_whitelist_namespaces_[0].type); | 585 EXPECT_EQ(NETWORK_NAMESPACE, cache->online_whitelist_namespaces_[0].type); |
| 584 EXPECT_TRUE(cache->online_whitelist_namespaces_[0].is_pattern); | 586 EXPECT_TRUE(cache->online_whitelist_namespaces_[0].is_pattern); |
| 585 EXPECT_EQ(kWhitelistUrl, | 587 EXPECT_EQ(kWhitelistUrl, |
| 586 cache->online_whitelist_namespaces_[0].namespace_url); | 588 cache->online_whitelist_namespaces_[0].namespace_url); |
| 587 cache->AddEntry( | 589 cache->AddEntry( |
| 588 kManifestUrl, | 590 kManifestUrl, |
| 589 AppCacheEntry(AppCacheEntry::MANIFEST, 1, 1)); | 591 AppCacheEntry(AppCacheEntry::MANIFEST, 1, 1)); |
| 590 cache->AddEntry( | 592 cache->AddEntry( |
| 591 kInterceptUrl, | 593 kInterceptUrl, |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 EXPECT_TRUE(star_greediness.IsMatch( | 706 EXPECT_TRUE(star_greediness.IsMatch( |
| 705 GURL("http://foo.com/a/b/01234567890abcdef/b"))); | 707 GURL("http://foo.com/a/b/01234567890abcdef/b"))); |
| 706 EXPECT_TRUE(star_greediness.IsMatch( | 708 EXPECT_TRUE(star_greediness.IsMatch( |
| 707 GURL("http://foo.com/a/b/01234567890abcdef/b01234567890abcdef/b"))); | 709 GURL("http://foo.com/a/b/01234567890abcdef/b01234567890abcdef/b"))); |
| 708 EXPECT_TRUE(star_greediness.IsMatch( | 710 EXPECT_TRUE(star_greediness.IsMatch( |
| 709 GURL("http://foo.com/a/b/01234567890abcdef_eat_some_more_characters_" | 711 GURL("http://foo.com/a/b/01234567890abcdef_eat_some_more_characters_" |
| 710 "/and_even_more_for_the_heck_of_it/01234567890abcdef/b"))); | 712 "/and_even_more_for_the_heck_of_it/01234567890abcdef/b"))); |
| 711 } | 713 } |
| 712 | 714 |
| 713 } // namespace content | 715 } // namespace content |
| OLD | NEW |