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

Side by Side Diff: webkit/appcache/appcache_storage_impl_unittest.cc

Issue 8343018: More groundwork for flat file based response storage. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « webkit/appcache/appcache_storage_impl.cc ('k') | webkit/appcache/appcache_update_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <stack> 5 #include <stack>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 void OnGroupMadeObsolete(AppCacheGroup* group, bool success) { 85 void OnGroupMadeObsolete(AppCacheGroup* group, bool success) {
86 obsoleted_group_ = group; 86 obsoleted_group_ = group;
87 obsoleted_success_ = success; 87 obsoleted_success_ = success;
88 test_->ScheduleNextTask(); 88 test_->ScheduleNextTask();
89 } 89 }
90 90
91 void OnMainResponseFound(const GURL& url, const AppCacheEntry& entry, 91 void OnMainResponseFound(const GURL& url, const AppCacheEntry& entry,
92 const GURL& fallback_url, 92 const GURL& fallback_url,
93 const AppCacheEntry& fallback_entry, 93 const AppCacheEntry& fallback_entry,
94 int64 cache_id, const GURL& manifest_url) { 94 int64 cache_id, int64 group_id,
95 const GURL& manifest_url) {
95 found_url_ = url; 96 found_url_ = url;
96 found_entry_ = entry; 97 found_entry_ = entry;
97 found_fallback_url_ = fallback_url; 98 found_fallback_url_ = fallback_url;
98 found_fallback_entry_ = fallback_entry; 99 found_fallback_entry_ = fallback_entry;
99 found_cache_id_ = cache_id; 100 found_cache_id_ = cache_id;
101 found_group_id_ = group_id;
100 found_manifest_url_ = manifest_url; 102 found_manifest_url_ = manifest_url;
101 test_->ScheduleNextTask(); 103 test_->ScheduleNextTask();
102 } 104 }
103 105
104 scoped_refptr<AppCache> loaded_cache_; 106 scoped_refptr<AppCache> loaded_cache_;
105 int64 loaded_cache_id_; 107 int64 loaded_cache_id_;
106 scoped_refptr<AppCacheGroup> loaded_group_; 108 scoped_refptr<AppCacheGroup> loaded_group_;
107 GURL loaded_manifest_url_; 109 GURL loaded_manifest_url_;
108 scoped_refptr<AppCache> loaded_groups_newest_cache_; 110 scoped_refptr<AppCache> loaded_groups_newest_cache_;
109 scoped_refptr<AppCacheGroup> stored_group_; 111 scoped_refptr<AppCacheGroup> stored_group_;
110 bool stored_group_success_; 112 bool stored_group_success_;
111 bool would_exceed_quota_; 113 bool would_exceed_quota_;
112 scoped_refptr<AppCacheGroup> obsoleted_group_; 114 scoped_refptr<AppCacheGroup> obsoleted_group_;
113 bool obsoleted_success_; 115 bool obsoleted_success_;
114 GURL found_url_; 116 GURL found_url_;
115 AppCacheEntry found_entry_; 117 AppCacheEntry found_entry_;
116 GURL found_fallback_url_; 118 GURL found_fallback_url_;
117 AppCacheEntry found_fallback_entry_; 119 AppCacheEntry found_fallback_entry_;
118 int64 found_cache_id_; 120 int64 found_cache_id_;
121 int64 found_group_id_;
119 GURL found_manifest_url_; 122 GURL found_manifest_url_;
120 AppCacheStorageImplTest* test_; 123 AppCacheStorageImplTest* test_;
121 }; 124 };
122 125
123 class MockQuotaManager : public quota::QuotaManager { 126 class MockQuotaManager : public quota::QuotaManager {
124 public: 127 public:
125 MockQuotaManager() 128 MockQuotaManager()
126 : QuotaManager(true /* is_incognito */, FilePath(), 129 : QuotaManager(true /* is_incognito */, FilePath(),
127 io_thread->message_loop_proxy(), 130 io_thread->message_loop_proxy(),
128 db_thread->message_loop_proxy(), 131 db_thread->message_loop_proxy(),
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 void BasicFindMainResponseInWorkingSet() { 823 void BasicFindMainResponseInWorkingSet() {
821 BasicFindMainResponse(false); 824 BasicFindMainResponse(false);
822 } 825 }
823 826
824 void BasicFindMainResponse(bool drop_from_working_set) { 827 void BasicFindMainResponse(bool drop_from_working_set) {
825 PushNextTask(NewRunnableMethod( 828 PushNextTask(NewRunnableMethod(
826 this, &AppCacheStorageImplTest::Verify_BasicFindMainResponse)); 829 this, &AppCacheStorageImplTest::Verify_BasicFindMainResponse));
827 830
828 // Setup some preconditions. Create a complete cache with an entry 831 // Setup some preconditions. Create a complete cache with an entry
829 // in storage. 832 // in storage.
830 MakeCacheAndGroup(kManifestUrl, 1, 1, true); 833 MakeCacheAndGroup(kManifestUrl, 2, 1, true);
831 cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, 1)); 834 cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, 1));
832 AppCacheDatabase::EntryRecord entry_record; 835 AppCacheDatabase::EntryRecord entry_record;
833 entry_record.cache_id = 1; 836 entry_record.cache_id = 1;
834 entry_record.url = kEntryUrl; 837 entry_record.url = kEntryUrl;
835 entry_record.flags = AppCacheEntry::EXPLICIT; 838 entry_record.flags = AppCacheEntry::EXPLICIT;
836 entry_record.response_id = 1; 839 entry_record.response_id = 1;
837 EXPECT_TRUE(database()->InsertEntry(&entry_record)); 840 EXPECT_TRUE(database()->InsertEntry(&entry_record));
838 841
839 // Optionally drop the cache/group pair from the working set. 842 // Optionally drop the cache/group pair from the working set.
840 if (drop_from_working_set) { 843 if (drop_from_working_set) {
841 EXPECT_TRUE(cache_->HasOneRef()); 844 EXPECT_TRUE(cache_->HasOneRef());
842 cache_ = NULL; 845 cache_ = NULL;
843 EXPECT_TRUE(group_->HasOneRef()); 846 EXPECT_TRUE(group_->HasOneRef());
844 group_ = NULL; 847 group_ = NULL;
845 } 848 }
846 849
847 // Conduct the test. 850 // Conduct the test.
848 storage()->FindResponseForMainRequest(kEntryUrl, GURL(), delegate()); 851 storage()->FindResponseForMainRequest(kEntryUrl, GURL(), delegate());
849 EXPECT_NE(kEntryUrl, delegate()->found_url_); 852 EXPECT_NE(kEntryUrl, delegate()->found_url_);
850 } 853 }
851 854
852 void Verify_BasicFindMainResponse() { 855 void Verify_BasicFindMainResponse() {
853 EXPECT_EQ(kEntryUrl, delegate()->found_url_); 856 EXPECT_EQ(kEntryUrl, delegate()->found_url_);
854 EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_); 857 EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_);
855 EXPECT_EQ(1, delegate()->found_cache_id_); 858 EXPECT_EQ(1, delegate()->found_cache_id_);
859 EXPECT_EQ(2, delegate()->found_group_id_);
856 EXPECT_EQ(1, delegate()->found_entry_.response_id()); 860 EXPECT_EQ(1, delegate()->found_entry_.response_id());
857 EXPECT_TRUE(delegate()->found_entry_.IsExplicit()); 861 EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
858 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id()); 862 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id());
859 TestFinished(); 863 TestFinished();
860 } 864 }
861 865
862 // BasicFindMainFallbackResponse ------------------------------- 866 // BasicFindMainFallbackResponse -------------------------------
863 867
864 void BasicFindMainFallbackResponseInDatabase() { 868 void BasicFindMainFallbackResponseInDatabase() {
865 BasicFindMainFallbackResponse(true); 869 BasicFindMainFallbackResponse(true);
866 } 870 }
867 871
868 void BasicFindMainFallbackResponseInWorkingSet() { 872 void BasicFindMainFallbackResponseInWorkingSet() {
869 BasicFindMainFallbackResponse(false); 873 BasicFindMainFallbackResponse(false);
870 } 874 }
871 875
872 void BasicFindMainFallbackResponse(bool drop_from_working_set) { 876 void BasicFindMainFallbackResponse(bool drop_from_working_set) {
873 PushNextTask(NewRunnableMethod( 877 PushNextTask(NewRunnableMethod(
874 this, &AppCacheStorageImplTest::Verify_BasicFindMainFallbackResponse)); 878 this, &AppCacheStorageImplTest::Verify_BasicFindMainFallbackResponse));
875 879
876 // Setup some preconditions. Create a complete cache with a 880 // Setup some preconditions. Create a complete cache with a
877 // fallback namespace and entry. 881 // fallback namespace and entry.
878 MakeCacheAndGroup(kManifestUrl, 1, 1, true); 882 MakeCacheAndGroup(kManifestUrl, 2, 1, true);
879 cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::FALLBACK, 1)); 883 cache_->AddEntry(kEntryUrl, AppCacheEntry(AppCacheEntry::FALLBACK, 1));
880 cache_->AddEntry(kEntryUrl2, AppCacheEntry(AppCacheEntry::FALLBACK, 2)); 884 cache_->AddEntry(kEntryUrl2, AppCacheEntry(AppCacheEntry::FALLBACK, 2));
881 cache_->fallback_namespaces_.push_back( 885 cache_->fallback_namespaces_.push_back(
882 FallbackNamespace(kFallbackNamespace2, kEntryUrl2)); 886 FallbackNamespace(kFallbackNamespace2, kEntryUrl2));
883 cache_->fallback_namespaces_.push_back( 887 cache_->fallback_namespaces_.push_back(
884 FallbackNamespace(kFallbackNamespace, kEntryUrl)); 888 FallbackNamespace(kFallbackNamespace, kEntryUrl));
885 AppCacheDatabase::CacheRecord cache_record; 889 AppCacheDatabase::CacheRecord cache_record;
886 std::vector<AppCacheDatabase::EntryRecord> entries; 890 std::vector<AppCacheDatabase::EntryRecord> entries;
887 std::vector<AppCacheDatabase::FallbackNameSpaceRecord> fallbacks; 891 std::vector<AppCacheDatabase::FallbackNameSpaceRecord> fallbacks;
888 std::vector<AppCacheDatabase::OnlineWhiteListRecord> whitelists; 892 std::vector<AppCacheDatabase::OnlineWhiteListRecord> whitelists;
(...skipping 21 matching lines...) Expand all
910 // Conduct the test. The test url is in both fallback namespace urls, 914 // Conduct the test. The test url is in both fallback namespace urls,
911 // but should match the longer of the two. 915 // but should match the longer of the two.
912 storage()->FindResponseForMainRequest(kFallbackTestUrl, GURL(), delegate()); 916 storage()->FindResponseForMainRequest(kFallbackTestUrl, GURL(), delegate());
913 EXPECT_NE(kFallbackTestUrl, delegate()->found_url_); 917 EXPECT_NE(kFallbackTestUrl, delegate()->found_url_);
914 } 918 }
915 919
916 void Verify_BasicFindMainFallbackResponse() { 920 void Verify_BasicFindMainFallbackResponse() {
917 EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_); 921 EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_);
918 EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_); 922 EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_);
919 EXPECT_EQ(1, delegate()->found_cache_id_); 923 EXPECT_EQ(1, delegate()->found_cache_id_);
924 EXPECT_EQ(2, delegate()->found_group_id_);
920 EXPECT_FALSE(delegate()->found_entry_.has_response_id()); 925 EXPECT_FALSE(delegate()->found_entry_.has_response_id());
921 EXPECT_EQ(2, delegate()->found_fallback_entry_.response_id()); 926 EXPECT_EQ(2, delegate()->found_fallback_entry_.response_id());
922 EXPECT_EQ(kEntryUrl2, delegate()->found_fallback_url_); 927 EXPECT_EQ(kEntryUrl2, delegate()->found_fallback_url_);
923 EXPECT_TRUE(delegate()->found_fallback_entry_.IsFallback()); 928 EXPECT_TRUE(delegate()->found_fallback_entry_.IsFallback());
924 TestFinished(); 929 TestFinished();
925 } 930 }
926 931
927 // FindMainResponseWithMultipleHits ------------------------------- 932 // FindMainResponseWithMultipleHits -------------------------------
928 933
929 void FindMainResponseWithMultipleHits() { 934 void FindMainResponseWithMultipleHits() {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
984 EXPECT_TRUE( 989 EXPECT_TRUE(
985 database()->InsertFallbackNameSpace(&fallback_namespace_record)); 990 database()->InsertFallbackNameSpace(&fallback_namespace_record));
986 cache_->fallback_namespaces_.push_back( 991 cache_->fallback_namespaces_.push_back(
987 FallbackNamespace(kFallbackNamespace, kEntryUrl2)); 992 FallbackNamespace(kFallbackNamespace, kEntryUrl2));
988 } 993 }
989 994
990 void Verify_FindMainResponseWithMultipleHits() { 995 void Verify_FindMainResponseWithMultipleHits() {
991 EXPECT_EQ(kEntryUrl, delegate()->found_url_); 996 EXPECT_EQ(kEntryUrl, delegate()->found_url_);
992 EXPECT_EQ(kManifestUrl3, delegate()->found_manifest_url_); 997 EXPECT_EQ(kManifestUrl3, delegate()->found_manifest_url_);
993 EXPECT_EQ(3, delegate()->found_cache_id_); 998 EXPECT_EQ(3, delegate()->found_cache_id_);
999 EXPECT_EQ(3, delegate()->found_group_id_);
994 EXPECT_EQ(3, delegate()->found_entry_.response_id()); 1000 EXPECT_EQ(3, delegate()->found_entry_.response_id());
995 EXPECT_TRUE(delegate()->found_entry_.IsExplicit()); 1001 EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
996 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id()); 1002 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id());
997 1003
998 // Conduct another test perferring kManifestUrl 1004 // Conduct another test perferring kManifestUrl
999 delegate_.reset(new MockStorageDelegate(this)); 1005 delegate_.reset(new MockStorageDelegate(this));
1000 PushNextTask(NewRunnableMethod(this, 1006 PushNextTask(NewRunnableMethod(this,
1001 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits2)); 1007 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits2));
1002 storage()->FindResponseForMainRequest(kEntryUrl, kManifestUrl, delegate()); 1008 storage()->FindResponseForMainRequest(kEntryUrl, kManifestUrl, delegate());
1003 EXPECT_NE(kEntryUrl, delegate()->found_url_); 1009 EXPECT_NE(kEntryUrl, delegate()->found_url_);
1004 } 1010 }
1005 1011
1006 void Verify_FindMainResponseWithMultipleHits2() { 1012 void Verify_FindMainResponseWithMultipleHits2() {
1007 EXPECT_EQ(kEntryUrl, delegate()->found_url_); 1013 EXPECT_EQ(kEntryUrl, delegate()->found_url_);
1008 EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_); 1014 EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_);
1009 EXPECT_EQ(1, delegate()->found_cache_id_); 1015 EXPECT_EQ(1, delegate()->found_cache_id_);
1016 EXPECT_EQ(1, delegate()->found_group_id_);
1010 EXPECT_EQ(1, delegate()->found_entry_.response_id()); 1017 EXPECT_EQ(1, delegate()->found_entry_.response_id());
1011 EXPECT_TRUE(delegate()->found_entry_.IsExplicit()); 1018 EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
1012 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id()); 1019 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id());
1013 1020
1014 // Conduct the another test perferring kManifestUrl2 1021 // Conduct the another test perferring kManifestUrl2
1015 delegate_.reset(new MockStorageDelegate(this)); 1022 delegate_.reset(new MockStorageDelegate(this));
1016 PushNextTask(NewRunnableMethod(this, 1023 PushNextTask(NewRunnableMethod(this,
1017 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits3)); 1024 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits3));
1018 storage()->FindResponseForMainRequest(kEntryUrl, kManifestUrl2, delegate()); 1025 storage()->FindResponseForMainRequest(kEntryUrl, kManifestUrl2, delegate());
1019 EXPECT_NE(kEntryUrl, delegate()->found_url_); 1026 EXPECT_NE(kEntryUrl, delegate()->found_url_);
1020 } 1027 }
1021 1028
1022 void Verify_FindMainResponseWithMultipleHits3() { 1029 void Verify_FindMainResponseWithMultipleHits3() {
1023 EXPECT_EQ(kEntryUrl, delegate()->found_url_); 1030 EXPECT_EQ(kEntryUrl, delegate()->found_url_);
1024 EXPECT_EQ(kManifestUrl2, delegate()->found_manifest_url_); 1031 EXPECT_EQ(kManifestUrl2, delegate()->found_manifest_url_);
1025 EXPECT_EQ(2, delegate()->found_cache_id_); 1032 EXPECT_EQ(2, delegate()->found_cache_id_);
1033 EXPECT_EQ(2, delegate()->found_group_id_);
1026 EXPECT_EQ(2, delegate()->found_entry_.response_id()); 1034 EXPECT_EQ(2, delegate()->found_entry_.response_id());
1027 EXPECT_TRUE(delegate()->found_entry_.IsExplicit()); 1035 EXPECT_TRUE(delegate()->found_entry_.IsExplicit());
1028 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id()); 1036 EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id());
1029 1037
1030 // Conduct another test with no preferred manifest that hits the fallback. 1038 // Conduct another test with no preferred manifest that hits the fallback.
1031 delegate_.reset(new MockStorageDelegate(this)); 1039 delegate_.reset(new MockStorageDelegate(this));
1032 PushNextTask(NewRunnableMethod(this, 1040 PushNextTask(NewRunnableMethod(this,
1033 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits4)); 1041 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits4));
1034 storage()->FindResponseForMainRequest( 1042 storage()->FindResponseForMainRequest(
1035 kFallbackTestUrl, GURL(), delegate()); 1043 kFallbackTestUrl, GURL(), delegate());
1036 EXPECT_NE(kFallbackTestUrl, delegate()->found_url_); 1044 EXPECT_NE(kFallbackTestUrl, delegate()->found_url_);
1037 } 1045 }
1038 1046
1039 void Verify_FindMainResponseWithMultipleHits4() { 1047 void Verify_FindMainResponseWithMultipleHits4() {
1040 EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_); 1048 EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_);
1041 EXPECT_EQ(kManifestUrl3, delegate()->found_manifest_url_); 1049 EXPECT_EQ(kManifestUrl3, delegate()->found_manifest_url_);
1042 EXPECT_EQ(3, delegate()->found_cache_id_); 1050 EXPECT_EQ(3, delegate()->found_cache_id_);
1051 EXPECT_EQ(3, delegate()->found_group_id_);
1043 EXPECT_FALSE(delegate()->found_entry_.has_response_id()); 1052 EXPECT_FALSE(delegate()->found_entry_.has_response_id());
1044 EXPECT_EQ(3 + kFallbackEntryIdOffset, 1053 EXPECT_EQ(3 + kFallbackEntryIdOffset,
1045 delegate()->found_fallback_entry_.response_id()); 1054 delegate()->found_fallback_entry_.response_id());
1046 EXPECT_TRUE(delegate()->found_fallback_entry_.IsFallback()); 1055 EXPECT_TRUE(delegate()->found_fallback_entry_.IsFallback());
1047 EXPECT_EQ(kEntryUrl2, delegate()->found_fallback_url_); 1056 EXPECT_EQ(kEntryUrl2, delegate()->found_fallback_url_);
1048 1057
1049 // Conduct another test preferring kManifestUrl2 that hits the fallback. 1058 // Conduct another test preferring kManifestUrl2 that hits the fallback.
1050 delegate_.reset(new MockStorageDelegate(this)); 1059 delegate_.reset(new MockStorageDelegate(this));
1051 PushNextTask(NewRunnableMethod(this, 1060 PushNextTask(NewRunnableMethod(this,
1052 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits5)); 1061 &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits5));
1053 storage()->FindResponseForMainRequest( 1062 storage()->FindResponseForMainRequest(
1054 kFallbackTestUrl, kManifestUrl2, delegate()); 1063 kFallbackTestUrl, kManifestUrl2, delegate());
1055 EXPECT_NE(kFallbackTestUrl, delegate()->found_url_); 1064 EXPECT_NE(kFallbackTestUrl, delegate()->found_url_);
1056 } 1065 }
1057 1066
1058 void Verify_FindMainResponseWithMultipleHits5() { 1067 void Verify_FindMainResponseWithMultipleHits5() {
1059 EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_); 1068 EXPECT_EQ(kFallbackTestUrl, delegate()->found_url_);
1060 EXPECT_EQ(kManifestUrl2, delegate()->found_manifest_url_); 1069 EXPECT_EQ(kManifestUrl2, delegate()->found_manifest_url_);
1061 EXPECT_EQ(2, delegate()->found_cache_id_); 1070 EXPECT_EQ(2, delegate()->found_cache_id_);
1071 EXPECT_EQ(2, delegate()->found_group_id_);
1062 EXPECT_FALSE(delegate()->found_entry_.has_response_id()); 1072 EXPECT_FALSE(delegate()->found_entry_.has_response_id());
1063 EXPECT_EQ(2 + kFallbackEntryIdOffset, 1073 EXPECT_EQ(2 + kFallbackEntryIdOffset,
1064 delegate()->found_fallback_entry_.response_id()); 1074 delegate()->found_fallback_entry_.response_id());
1065 EXPECT_TRUE(delegate()->found_fallback_entry_.IsFallback()); 1075 EXPECT_TRUE(delegate()->found_fallback_entry_.IsFallback());
1066 EXPECT_EQ(kEntryUrl2, delegate()->found_fallback_url_); 1076 EXPECT_EQ(kEntryUrl2, delegate()->found_fallback_url_);
1067 1077
1068 TestFinished(); 1078 TestFinished();
1069 } 1079 }
1070 1080
1071 // FindMainResponseExclusions ------------------------------- 1081 // FindMainResponseExclusions -------------------------------
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1122 PushNextTask(NewRunnableMethod( 1132 PushNextTask(NewRunnableMethod(
1123 this, &AppCacheStorageImplTest::Verify_ExclusionNotFound, 1133 this, &AppCacheStorageImplTest::Verify_ExclusionNotFound,
1124 kEntryUrl, 1)); 1134 kEntryUrl, 1));
1125 storage()->FindResponseForMainRequest(kEntryUrl, GURL(), delegate()); 1135 storage()->FindResponseForMainRequest(kEntryUrl, GURL(), delegate());
1126 } 1136 }
1127 1137
1128 void Verify_ExclusionNotFound(GURL expected_url, int phase) { 1138 void Verify_ExclusionNotFound(GURL expected_url, int phase) {
1129 EXPECT_EQ(expected_url, delegate()->found_url_); 1139 EXPECT_EQ(expected_url, delegate()->found_url_);
1130 EXPECT_TRUE(delegate()->found_manifest_url_.is_empty()); 1140 EXPECT_TRUE(delegate()->found_manifest_url_.is_empty());
1131 EXPECT_EQ(kNoCacheId, delegate()->found_cache_id_); 1141 EXPECT_EQ(kNoCacheId, delegate()->found_cache_id_);
1142 EXPECT_EQ(0, delegate()->found_group_id_);
1132 EXPECT_EQ(kNoResponseId, delegate()->found_entry_.response_id()); 1143 EXPECT_EQ(kNoResponseId, delegate()->found_entry_.response_id());
1133 EXPECT_EQ(kNoResponseId, delegate()->found_fallback_entry_.response_id()); 1144 EXPECT_EQ(kNoResponseId, delegate()->found_fallback_entry_.response_id());
1134 EXPECT_TRUE(delegate()->found_fallback_url_.is_empty()); 1145 EXPECT_TRUE(delegate()->found_fallback_url_.is_empty());
1135 EXPECT_EQ(0, delegate()->found_entry_.types()); 1146 EXPECT_EQ(0, delegate()->found_entry_.types());
1136 EXPECT_EQ(0, delegate()->found_fallback_entry_.types()); 1147 EXPECT_EQ(0, delegate()->found_fallback_entry_.types());
1137 1148
1138 if (phase == 1) { 1149 if (phase == 1) {
1139 // We should not find anything for the online namespace. 1150 // We should not find anything for the online namespace.
1140 PushNextTask(NewRunnableMethod(this, 1151 PushNextTask(NewRunnableMethod(this,
1141 &AppCacheStorageImplTest::Verify_ExclusionNotFound, 1152 &AppCacheStorageImplTest::Verify_ExclusionNotFound,
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet); 1325 &AppCacheStorageImplTest::FindMainResponseExclusionsInWorkingSet);
1315 } 1326 }
1316 1327
1317 // That's all folks! 1328 // That's all folks!
1318 1329
1319 } // namespace appcache 1330 } // namespace appcache
1320 1331
1321 // AppCacheStorageImplTest is expected to always live longer than the 1332 // AppCacheStorageImplTest is expected to always live longer than the
1322 // runnable methods. This lets us call NewRunnableMethod on its instances. 1333 // runnable methods. This lets us call NewRunnableMethod on its instances.
1323 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheStorageImplTest); 1334 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheStorageImplTest);
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_storage_impl.cc ('k') | webkit/appcache/appcache_update_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698