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_update_job.h" | 5 #include "content/browser/appcache/appcache_update_job.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 MakeService(); | 1002 MakeService(); |
1003 group_ = new AppCacheGroup( | 1003 group_ = new AppCacheGroup( |
1004 service_->storage(), MockHttpServer::GetMockUrl("files/manifest1"), | 1004 service_->storage(), MockHttpServer::GetMockUrl("files/manifest1"), |
1005 service_->storage()->NewGroupId()); | 1005 service_->storage()->NewGroupId()); |
1006 AppCacheUpdateJob* update = | 1006 AppCacheUpdateJob* update = |
1007 new AppCacheUpdateJob(service_.get(), group_.get()); | 1007 new AppCacheUpdateJob(service_.get(), group_.get()); |
1008 group_->update_job_ = update; | 1008 group_->update_job_ = update; |
1009 | 1009 |
1010 // Create response writer to get a response id. | 1010 // Create response writer to get a response id. |
1011 response_writer_.reset( | 1011 response_writer_.reset( |
1012 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 1012 service_->storage()->CreateResponseWriter(group_->manifest_url())); |
1013 group_->group_id())); | |
1014 | 1013 |
1015 AppCache* cache = MakeCacheForGroup(1, response_writer_->response_id()); | 1014 AppCache* cache = MakeCacheForGroup(1, response_writer_->response_id()); |
1016 MockFrontend* frontend1 = MakeMockFrontend(); | 1015 MockFrontend* frontend1 = MakeMockFrontend(); |
1017 MockFrontend* frontend2 = MakeMockFrontend(); | 1016 MockFrontend* frontend2 = MakeMockFrontend(); |
1018 AppCacheHost* host1 = MakeHost(1, frontend1); | 1017 AppCacheHost* host1 = MakeHost(1, frontend1); |
1019 AppCacheHost* host2 = MakeHost(2, frontend2); | 1018 AppCacheHost* host2 = MakeHost(2, frontend2); |
1020 host1->AssociateCompleteCache(cache); | 1019 host1->AssociateCompleteCache(cache); |
1021 host2->AssociateCompleteCache(cache); | 1020 host2->AssociateCompleteCache(cache); |
1022 | 1021 |
1023 // Set up checks for when update job finishes. | 1022 // Set up checks for when update job finishes. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 MakeService(); | 1153 MakeService(); |
1155 group_ = new AppCacheGroup( | 1154 group_ = new AppCacheGroup( |
1156 service_->storage(), MockHttpServer::GetMockUrl("files/manifest1"), | 1155 service_->storage(), MockHttpServer::GetMockUrl("files/manifest1"), |
1157 service_->storage()->NewGroupId()); | 1156 service_->storage()->NewGroupId()); |
1158 AppCacheUpdateJob* update = | 1157 AppCacheUpdateJob* update = |
1159 new AppCacheUpdateJob(service_.get(), group_.get()); | 1158 new AppCacheUpdateJob(service_.get(), group_.get()); |
1160 group_->update_job_ = update; | 1159 group_->update_job_ = update; |
1161 | 1160 |
1162 // Create a response writer to get a response id. | 1161 // Create a response writer to get a response id. |
1163 response_writer_.reset( | 1162 response_writer_.reset( |
1164 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 1163 service_->storage()->CreateResponseWriter(group_->manifest_url())); |
1165 group_->group_id())); | |
1166 | 1164 |
1167 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), | 1165 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), |
1168 response_writer_->response_id()); | 1166 response_writer_->response_id()); |
1169 MockFrontend* frontend1 = MakeMockFrontend(); | 1167 MockFrontend* frontend1 = MakeMockFrontend(); |
1170 MockFrontend* frontend2 = MakeMockFrontend(); | 1168 MockFrontend* frontend2 = MakeMockFrontend(); |
1171 AppCacheHost* host1 = MakeHost(1, frontend1); | 1169 AppCacheHost* host1 = MakeHost(1, frontend1); |
1172 AppCacheHost* host2 = MakeHost(2, frontend2); | 1170 AppCacheHost* host2 = MakeHost(2, frontend2); |
1173 host1->AssociateCompleteCache(cache); | 1171 host1->AssociateCompleteCache(cache); |
1174 host2->AssociateCompleteCache(cache); | 1172 host2->AssociateCompleteCache(cache); |
1175 frontend1->SetVerifyProgressEvents(true); | 1173 frontend1->SetVerifyProgressEvents(true); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1223 new AppCacheUpdateJob(service_.get(), group_.get()); | 1221 new AppCacheUpdateJob(service_.get(), group_.get()); |
1224 group_->update_job_ = update; | 1222 group_->update_job_ = update; |
1225 | 1223 |
1226 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); | 1224 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); |
1227 MockFrontend* frontend = MakeMockFrontend(); | 1225 MockFrontend* frontend = MakeMockFrontend(); |
1228 AppCacheHost* host = MakeHost(1, frontend); | 1226 AppCacheHost* host = MakeHost(1, frontend); |
1229 host->AssociateCompleteCache(cache); | 1227 host->AssociateCompleteCache(cache); |
1230 | 1228 |
1231 // Give the newest cache an entry that is in storage. | 1229 // Give the newest cache an entry that is in storage. |
1232 response_writer_.reset( | 1230 response_writer_.reset( |
1233 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 1231 service_->storage()->CreateResponseWriter(group_->manifest_url())); |
1234 group_->group_id())); | |
1235 cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"), | 1232 cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"), |
1236 AppCacheEntry(AppCacheEntry::EXPLICIT, | 1233 AppCacheEntry(AppCacheEntry::EXPLICIT, |
1237 response_writer_->response_id())); | 1234 response_writer_->response_id())); |
1238 | 1235 |
1239 // Set up checks for when update job finishes. | 1236 // Set up checks for when update job finishes. |
1240 do_checks_after_update_finished_ = true; | 1237 do_checks_after_update_finished_ = true; |
1241 expect_group_obsolete_ = false; | 1238 expect_group_obsolete_ = false; |
1242 expect_group_has_cache_ = true; | 1239 expect_group_has_cache_ = true; |
1243 expect_old_cache_ = cache; | 1240 expect_old_cache_ = cache; |
1244 expect_response_ids_.insert(std::map<GURL, int64_t>::value_type( | 1241 expect_response_ids_.insert(std::map<GURL, int64_t>::value_type( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1285 new AppCacheUpdateJob(service_.get(), group_.get()); | 1282 new AppCacheUpdateJob(service_.get(), group_.get()); |
1286 group_->update_job_ = update; | 1283 group_->update_job_ = update; |
1287 | 1284 |
1288 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); | 1285 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); |
1289 MockFrontend* frontend = MakeMockFrontend(); | 1286 MockFrontend* frontend = MakeMockFrontend(); |
1290 AppCacheHost* host = MakeHost(1, frontend); | 1287 AppCacheHost* host = MakeHost(1, frontend); |
1291 host->AssociateCompleteCache(cache); | 1288 host->AssociateCompleteCache(cache); |
1292 | 1289 |
1293 // Give the newest cache an entry that is in storage. | 1290 // Give the newest cache an entry that is in storage. |
1294 response_writer_.reset( | 1291 response_writer_.reset( |
1295 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 1292 service_->storage()->CreateResponseWriter(group_->manifest_url())); |
1296 group_->group_id())); | |
1297 cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"), | 1293 cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"), |
1298 AppCacheEntry(AppCacheEntry::EXPLICIT, | 1294 AppCacheEntry(AppCacheEntry::EXPLICIT, |
1299 response_writer_->response_id())); | 1295 response_writer_->response_id())); |
1300 | 1296 |
1301 // Set up checks for when update job finishes. | 1297 // Set up checks for when update job finishes. |
1302 do_checks_after_update_finished_ = true; | 1298 do_checks_after_update_finished_ = true; |
1303 expect_group_obsolete_ = false; | 1299 expect_group_obsolete_ = false; |
1304 expect_group_has_cache_ = true; | 1300 expect_group_has_cache_ = true; |
1305 expect_old_cache_ = cache; | 1301 expect_old_cache_ = cache; |
1306 tested_manifest_ = MANIFEST1; | 1302 tested_manifest_ = MANIFEST1; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1345 new AppCacheUpdateJob(service_.get(), group_.get()); | 1341 new AppCacheUpdateJob(service_.get(), group_.get()); |
1346 group_->update_job_ = update; | 1342 group_->update_job_ = update; |
1347 | 1343 |
1348 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); | 1344 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), 42); |
1349 MockFrontend* frontend = MakeMockFrontend(); | 1345 MockFrontend* frontend = MakeMockFrontend(); |
1350 AppCacheHost* host = MakeHost(1, frontend); | 1346 AppCacheHost* host = MakeHost(1, frontend); |
1351 host->AssociateCompleteCache(cache); | 1347 host->AssociateCompleteCache(cache); |
1352 | 1348 |
1353 // Give the newest cache an entry that is in storage. | 1349 // Give the newest cache an entry that is in storage. |
1354 response_writer_.reset( | 1350 response_writer_.reset( |
1355 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 1351 service_->storage()->CreateResponseWriter(group_->manifest_url())); |
1356 group_->group_id())); | |
1357 cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"), | 1352 cache->AddEntry(MockHttpServer::GetMockUrl("files/explicit1"), |
1358 AppCacheEntry(AppCacheEntry::EXPLICIT, | 1353 AppCacheEntry(AppCacheEntry::EXPLICIT, |
1359 response_writer_->response_id())); | 1354 response_writer_->response_id())); |
1360 | 1355 |
1361 // Set up checks for when update job finishes. | 1356 // Set up checks for when update job finishes. |
1362 do_checks_after_update_finished_ = true; | 1357 do_checks_after_update_finished_ = true; |
1363 expect_group_obsolete_ = false; | 1358 expect_group_obsolete_ = false; |
1364 expect_group_has_cache_ = true; | 1359 expect_group_has_cache_ = true; |
1365 expect_old_cache_ = cache; | 1360 expect_old_cache_ = cache; |
1366 tested_manifest_ = MANIFEST1; | 1361 tested_manifest_ = MANIFEST1; |
(...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2775 group_ = new AppCacheGroup( | 2770 group_ = new AppCacheGroup( |
2776 service_->storage(), | 2771 service_->storage(), |
2777 MockHttpServer::GetMockUrl("files/manifest1"), | 2772 MockHttpServer::GetMockUrl("files/manifest1"), |
2778 111); | 2773 111); |
2779 AppCacheUpdateJob* update = | 2774 AppCacheUpdateJob* update = |
2780 new AppCacheUpdateJob(service_.get(), group_.get()); | 2775 new AppCacheUpdateJob(service_.get(), group_.get()); |
2781 group_->update_job_ = update; | 2776 group_->update_job_ = update; |
2782 | 2777 |
2783 // Give the newest cache a manifest enry that is in storage. | 2778 // Give the newest cache a manifest enry that is in storage. |
2784 response_writer_.reset( | 2779 response_writer_.reset( |
2785 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 2780 service_->storage()->CreateResponseWriter(group_->manifest_url())); |
2786 group_->group_id())); | |
2787 | 2781 |
2788 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), | 2782 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), |
2789 response_writer_->response_id()); | 2783 response_writer_->response_id()); |
2790 MockFrontend* frontend = MakeMockFrontend(); | 2784 MockFrontend* frontend = MakeMockFrontend(); |
2791 AppCacheHost* host = MakeHost(1, frontend); | 2785 AppCacheHost* host = MakeHost(1, frontend); |
2792 host->AssociateCompleteCache(cache); | 2786 host->AssociateCompleteCache(cache); |
2793 | 2787 |
2794 // Set up checks for when update job finishes. | 2788 // Set up checks for when update job finishes. |
2795 do_checks_after_update_finished_ = true; | 2789 do_checks_after_update_finished_ = true; |
2796 expect_group_obsolete_ = false; | 2790 expect_group_obsolete_ = false; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2839 group_ = new AppCacheGroup( | 2833 group_ = new AppCacheGroup( |
2840 service_->storage(), | 2834 service_->storage(), |
2841 MockHttpServer::GetMockUrl("files/manifest1"), | 2835 MockHttpServer::GetMockUrl("files/manifest1"), |
2842 111); | 2836 111); |
2843 AppCacheUpdateJob* update = | 2837 AppCacheUpdateJob* update = |
2844 new AppCacheUpdateJob(service_.get(), group_.get()); | 2838 new AppCacheUpdateJob(service_.get(), group_.get()); |
2845 group_->update_job_ = update; | 2839 group_->update_job_ = update; |
2846 | 2840 |
2847 // Give the newest cache a manifest enry that is in storage. | 2841 // Give the newest cache a manifest enry that is in storage. |
2848 response_writer_.reset( | 2842 response_writer_.reset( |
2849 service_->storage()->CreateResponseWriter(group_->manifest_url(), | 2843 service_->storage()->CreateResponseWriter(group_->manifest_url())); |
2850 group_->group_id())); | |
2851 | 2844 |
2852 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), | 2845 AppCache* cache = MakeCacheForGroup(service_->storage()->NewCacheId(), |
2853 response_writer_->response_id()); | 2846 response_writer_->response_id()); |
2854 MockFrontend* frontend = MakeMockFrontend(); | 2847 MockFrontend* frontend = MakeMockFrontend(); |
2855 AppCacheHost* host = MakeHost(1, frontend); | 2848 AppCacheHost* host = MakeHost(1, frontend); |
2856 host->AssociateCompleteCache(cache); | 2849 host->AssociateCompleteCache(cache); |
2857 | 2850 |
2858 // Set up checks for when update job finishes. | 2851 // Set up checks for when update job finishes. |
2859 do_checks_after_update_finished_ = true; | 2852 do_checks_after_update_finished_ = true; |
2860 expect_group_obsolete_ = false; | 2853 expect_group_obsolete_ = false; |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3730 | 3723 |
3731 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { | 3724 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsSuccess) { |
3732 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); | 3725 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsSuccessTest); |
3733 } | 3726 } |
3734 | 3727 |
3735 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { | 3728 TEST_F(AppCacheUpdateJobTest, CrossOriginHttpsDenied) { |
3736 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); | 3729 RunTestOnIOThread(&AppCacheUpdateJobTest::CrossOriginHttpsDeniedTest); |
3737 } | 3730 } |
3738 | 3731 |
3739 } // namespace content | 3732 } // namespace content |
OLD | NEW |