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

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

Issue 3529009: Fix http/tests/appcache/foreign-fallback.html (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/thread.h" 10 #include "base/thread.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 void MainResource_Hit() { 230 void MainResource_Hit() {
231 PushNextTask(NewRunnableMethod( 231 PushNextTask(NewRunnableMethod(
232 this, &AppCacheRequestHandlerTest::Verify_MainResource_Hit)); 232 this, &AppCacheRequestHandlerTest::Verify_MainResource_Hit));
233 233
234 request_.reset(new MockURLRequest(GURL("http://blah/"))); 234 request_.reset(new MockURLRequest(GURL("http://blah/")));
235 handler_.reset(host_->CreateRequestHandler(request_.get(), 235 handler_.reset(host_->CreateRequestHandler(request_.get(),
236 ResourceType::MAIN_FRAME)); 236 ResourceType::MAIN_FRAME));
237 EXPECT_TRUE(handler_.get()); 237 EXPECT_TRUE(handler_.get());
238 238
239 mock_storage()->SimulateFindMainResource( 239 mock_storage()->SimulateFindMainResource(
240 AppCacheEntry(AppCacheEntry::EXPLICIT, 1), AppCacheEntry(), 240 AppCacheEntry(AppCacheEntry::EXPLICIT, 1),
241 GURL(), AppCacheEntry(),
241 1, GURL("http://blah/manifest/")); 242 1, GURL("http://blah/manifest/"));
242 243
243 job_ = handler_->MaybeLoadResource(request_.get()); 244 job_ = handler_->MaybeLoadResource(request_.get());
244 EXPECT_TRUE(job_.get()); 245 EXPECT_TRUE(job_.get());
245 EXPECT_TRUE(job_->is_waiting()); 246 EXPECT_TRUE(job_->is_waiting());
246 247
247 // We have to wait for completion of storage->FindResponseForMainRequest. 248 // We have to wait for completion of storage->FindResponseForMainRequest.
248 ScheduleNextTask(); 249 ScheduleNextTask();
249 } 250 }
250 251
(...skipping 19 matching lines...) Expand all
270 void MainResource_Fallback() { 271 void MainResource_Fallback() {
271 PushNextTask(NewRunnableMethod( 272 PushNextTask(NewRunnableMethod(
272 this, &AppCacheRequestHandlerTest::Verify_MainResource_Fallback)); 273 this, &AppCacheRequestHandlerTest::Verify_MainResource_Fallback));
273 274
274 request_.reset(new MockURLRequest(GURL("http://blah/"))); 275 request_.reset(new MockURLRequest(GURL("http://blah/")));
275 handler_.reset(host_->CreateRequestHandler(request_.get(), 276 handler_.reset(host_->CreateRequestHandler(request_.get(),
276 ResourceType::MAIN_FRAME)); 277 ResourceType::MAIN_FRAME));
277 EXPECT_TRUE(handler_.get()); 278 EXPECT_TRUE(handler_.get());
278 279
279 mock_storage()->SimulateFindMainResource( 280 mock_storage()->SimulateFindMainResource(
280 AppCacheEntry(), AppCacheEntry(AppCacheEntry::EXPLICIT, 1), 281 AppCacheEntry(),
282 GURL("http://blah/fallbackurl"),
283 AppCacheEntry(AppCacheEntry::EXPLICIT, 1),
281 1, GURL("http://blah/manifest/")); 284 1, GURL("http://blah/manifest/"));
282 285
283 job_ = handler_->MaybeLoadResource(request_.get()); 286 job_ = handler_->MaybeLoadResource(request_.get());
284 EXPECT_TRUE(job_.get()); 287 EXPECT_TRUE(job_.get());
285 EXPECT_TRUE(job_->is_waiting()); 288 EXPECT_TRUE(job_->is_waiting());
286 289
287 // We have to wait for completion of storage->FindResponseForMainRequest. 290 // We have to wait for completion of storage->FindResponseForMainRequest.
288 ScheduleNextTask(); 291 ScheduleNextTask();
289 } 292 }
290 293
(...skipping 12 matching lines...) Expand all
303 306
304 job_ = handler_->MaybeLoadFallbackForResponse(request_.get()); 307 job_ = handler_->MaybeLoadFallbackForResponse(request_.get());
305 EXPECT_TRUE(job_); 308 EXPECT_TRUE(job_);
306 EXPECT_TRUE(job_->is_delivering_appcache_response()); 309 EXPECT_TRUE(job_->is_delivering_appcache_response());
307 310
308 int64 cache_id = kNoCacheId; 311 int64 cache_id = kNoCacheId;
309 GURL manifest_url; 312 GURL manifest_url;
310 handler_->GetExtraResponseInfo(&cache_id, &manifest_url); 313 handler_->GetExtraResponseInfo(&cache_id, &manifest_url);
311 EXPECT_EQ(1, cache_id); 314 EXPECT_EQ(1, cache_id);
312 EXPECT_EQ(GURL("http://blah/manifest/"), manifest_url); 315 EXPECT_EQ(GURL("http://blah/manifest/"), manifest_url);
316 EXPECT_TRUE(host_->main_resource_was_fallback_);
317 EXPECT_EQ(GURL("http://blah/fallbackurl"), host_->fallback_url_);
313 318
314 TestFinished(); 319 TestFinished();
315 } 320 }
316 321
317 // SubResource_Miss_WithNoCacheSelected ---------------------------------- 322 // SubResource_Miss_WithNoCacheSelected ----------------------------------
318 323
319 void SubResource_Miss_WithNoCacheSelected() { 324 void SubResource_Miss_WithNoCacheSelected() {
320 request_.reset(new MockURLRequest(GURL("http://blah/"))); 325 request_.reset(new MockURLRequest(GURL("http://blah/")));
321 handler_.reset(host_->CreateRequestHandler(request_.get(), 326 handler_.reset(host_->CreateRequestHandler(request_.get(),
322 ResourceType::SUB_RESOURCE)); 327 ResourceType::SUB_RESOURCE));
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 738
734 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) { 739 TEST_F(AppCacheRequestHandlerTest, WorkerRequest) {
735 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest); 740 RunTestOnIOThread(&AppCacheRequestHandlerTest::WorkerRequest);
736 } 741 }
737 742
738 } // namespace appcache 743 } // namespace appcache
739 744
740 // AppCacheRequestHandlerTest is expected to always live longer than the 745 // AppCacheRequestHandlerTest is expected to always live longer than the
741 // runnable methods. This lets us call NewRunnableMethod on its instances. 746 // runnable methods. This lets us call NewRunnableMethod on its instances.
742 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheRequestHandlerTest); 747 DISABLE_RUNNABLE_METHOD_REFCOUNT(appcache::AppCacheRequestHandlerTest);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698