OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "webkit/appcache/appcache.h" | 7 #include "webkit/appcache/appcache.h" |
8 #include "webkit/appcache/appcache_group.h" | 8 #include "webkit/appcache/appcache_group.h" |
9 #include "webkit/appcache/appcache_response.h" | 9 #include "webkit/appcache/appcache_response.h" |
10 #include "webkit/appcache/appcache_storage.h" | 10 #include "webkit/appcache/appcache_storage.h" |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 const GURL kFallbackEntryUrl1("http://blah/fallback_entry1"); | 454 const GURL kFallbackEntryUrl1("http://blah/fallback_entry1"); |
455 const GURL kFallbackNamespaceUrl1("http://blah/fallback_namespace/"); | 455 const GURL kFallbackNamespaceUrl1("http://blah/fallback_namespace/"); |
456 const GURL kFallbackEntryUrl2("http://blah/fallback_entry2"); | 456 const GURL kFallbackEntryUrl2("http://blah/fallback_entry2"); |
457 const GURL kFallbackNamespaceUrl2("http://blah/fallback_namespace/longer"); | 457 const GURL kFallbackNamespaceUrl2("http://blah/fallback_namespace/longer"); |
458 const GURL kManifestUrl("http://blah/manifest"); | 458 const GURL kManifestUrl("http://blah/manifest"); |
459 const int64 kResponseId1 = 1; | 459 const int64 kResponseId1 = 1; |
460 const int64 kResponseId2 = 2; | 460 const int64 kResponseId2 = 2; |
461 | 461 |
462 Manifest manifest; | 462 Manifest manifest; |
463 manifest.fallback_namespaces.push_back( | 463 manifest.fallback_namespaces.push_back( |
464 FallbackNamespace(kFallbackNamespaceUrl1, kFallbackEntryUrl1)); | 464 Namespace(FALLBACK_NAMESPACE, kFallbackNamespaceUrl1, |
| 465 kFallbackEntryUrl1)); |
465 manifest.fallback_namespaces.push_back( | 466 manifest.fallback_namespaces.push_back( |
466 FallbackNamespace(kFallbackNamespaceUrl2, kFallbackEntryUrl2)); | 467 Namespace(FALLBACK_NAMESPACE, kFallbackNamespaceUrl2, |
| 468 kFallbackEntryUrl2)); |
467 | 469 |
468 scoped_refptr<AppCache> cache(new AppCache(&service, kCacheId)); | 470 scoped_refptr<AppCache> cache(new AppCache(&service, kCacheId)); |
469 cache->InitializeWithManifest(&manifest); | 471 cache->InitializeWithManifest(&manifest); |
470 cache->AddEntry( | 472 cache->AddEntry(kFallbackEntryUrl1, |
471 kFallbackEntryUrl1, AppCacheEntry(AppCacheEntry::FALLBACK, kResponseId1)); | 473 AppCacheEntry(AppCacheEntry::FALLBACK, kResponseId1)); |
472 cache->AddEntry( | 474 cache->AddEntry(kFallbackEntryUrl2, |
473 kFallbackEntryUrl2, AppCacheEntry(AppCacheEntry::FALLBACK, kResponseId2)); | 475 AppCacheEntry(AppCacheEntry::FALLBACK, kResponseId2)); |
474 cache->set_complete(true); | 476 cache->set_complete(true); |
475 | 477 |
476 scoped_refptr<AppCacheGroup> group( | 478 scoped_refptr<AppCacheGroup> group( |
477 new AppCacheGroup(&service, kManifestUrl, 111)); | 479 new AppCacheGroup(&service, kManifestUrl, 111)); |
478 group->AddCache(cache); | 480 group->AddCache(cache); |
479 storage->AddStoredGroup(group); | 481 storage->AddStoredGroup(group); |
480 storage->AddStoredCache(cache); | 482 storage->AddStoredCache(cache); |
481 | 483 |
482 // The test url is in both fallback namespace urls, but should match | 484 // The test url is in both fallback namespace urls, but should match |
483 // the longer of the two. | 485 // the longer of the two. |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 EXPECT_EQ(kNoCacheId, delegate.found_cache_id_); | 613 EXPECT_EQ(kNoCacheId, delegate.found_cache_id_); |
612 EXPECT_EQ(kNoResponseId, delegate.found_entry_.response_id()); | 614 EXPECT_EQ(kNoResponseId, delegate.found_entry_.response_id()); |
613 EXPECT_EQ(kNoResponseId, delegate.found_fallback_entry_.response_id()); | 615 EXPECT_EQ(kNoResponseId, delegate.found_fallback_entry_.response_id()); |
614 EXPECT_TRUE(delegate.found_fallback_url_.is_empty()); | 616 EXPECT_TRUE(delegate.found_fallback_url_.is_empty()); |
615 EXPECT_EQ(0, delegate.found_entry_.types()); | 617 EXPECT_EQ(0, delegate.found_entry_.types()); |
616 EXPECT_EQ(0, delegate.found_fallback_entry_.types()); | 618 EXPECT_EQ(0, delegate.found_fallback_entry_.types()); |
617 } | 619 } |
618 | 620 |
619 } // namespace appcache | 621 } // namespace appcache |
620 | 622 |
OLD | NEW |