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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp

Issue 2316573002: PlzNavigate: Support ResourceTiming API (Closed)
Patch Set: Move redirect response inside the final response. Created 4 years, 3 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
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013, Google Inc. All rights reserved. 2 * Copyright (c) 2013, Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 cleanUp(); 417 cleanUp();
418 } 418 }
419 419
420 void registerRedirect(const WebString& fromURL, const WebString& toURL) 420 void registerRedirect(const WebString& fromURL, const WebString& toURL)
421 { 421 {
422 KURL redirectURL(ParsedURLString, fromURL); 422 KURL redirectURL(ParsedURLString, fromURL);
423 WebURLResponse redirectResponse; 423 WebURLResponse redirectResponse;
424 redirectResponse.setURL(redirectURL); 424 redirectResponse.setURL(redirectURL);
425 redirectResponse.setHTTPStatusCode(301); 425 redirectResponse.setHTTPStatusCode(301);
426 redirectResponse.setHTTPHeaderField(HTTPNames::Location, toURL); 426 redirectResponse.setHTTPHeaderField(HTTPNames::Location, toURL);
427 redirectResponse.addToEncodedDataLength(kRedirectResponseOverheadBytes);
427 Platform::current()->getURLLoaderMockFactory()->registerURL(redirectURL, redirectResponse, ""); 428 Platform::current()->getURLLoaderMockFactory()->registerURL(redirectURL, redirectResponse, "");
428 } 429 }
429 430
430 void registerFinalResource(const WebString& url) 431 void registerFinalResource(const WebString& url)
431 { 432 {
432 KURL finalURL(ParsedURLString, url); 433 KURL finalURL(ParsedURLString, url);
433 WebURLResponse finalResponse; 434 WebURLResponse finalResponse;
434 finalResponse.setURL(finalURL); 435 finalResponse.setURL(finalURL);
435 finalResponse.setHTTPStatusCode(200); 436 finalResponse.setHTTPStatusCode(200);
436 URLTestHelpers::registerMockedURLLoadWithCustomResponse(finalURL, testIm ageFilename, "", finalResponse); 437 URLTestHelpers::registerMockedURLLoadWithCustomResponse(finalURL, testIm ageFilename, "", finalResponse);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 FetchRequest request(url, FetchInitiatorInfo()); 511 FetchRequest request(url, FetchInitiatorInfo());
511 request.makeSynchronous(); 512 request.makeSynchronous();
512 Resource* resource = fetcher->requestResource(request, TestResourceFactory() ); 513 Resource* resource = fetcher->requestResource(request, TestResourceFactory() );
513 EXPECT_TRUE(resource->isLoaded()); 514 EXPECT_TRUE(resource->isLoaded());
514 EXPECT_EQ(ResourceLoadPriorityHighest, resource->resourceRequest().priority( )); 515 EXPECT_EQ(ResourceLoadPriorityHighest, resource->resourceRequest().priority( ));
515 516
516 memoryCache()->remove(resource); 517 memoryCache()->remove(resource);
517 } 518 }
518 519
519 } // namespace blink 520 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698