| OLD | NEW |
| 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 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 ScopedMockRedirectRequester requester; | 495 ScopedMockRedirectRequester requester; |
| 496 requester.registerRedirect(redirectURL1, redirectURL2); | 496 requester.registerRedirect(redirectURL1, redirectURL2); |
| 497 requester.registerRedirect(redirectURL2, redirectURL3); | 497 requester.registerRedirect(redirectURL2, redirectURL3); |
| 498 requester.registerRedirect(redirectURL3, finalURL); | 498 requester.registerRedirect(redirectURL3, finalURL); |
| 499 requester.registerFinalResource(finalURL); | 499 requester.registerFinalResource(finalURL); |
| 500 requester.request(redirectURL1); | 500 requester.request(redirectURL1); |
| 501 | 501 |
| 502 EXPECT_EQ(testImageSize, requester.context()->getTransferSize()); | 502 EXPECT_EQ(testImageSize, requester.context()->getTransferSize()); |
| 503 } | 503 } |
| 504 | 504 |
| 505 TEST_F(ResourceFetcherTest, SynchronousRequest) |
| 506 { |
| 507 KURL url(ParsedURLString, "http://127.0.0.1:8000/foo.html"); |
| 508 ResourceResponse response; |
| 509 response.setURL(url); |
| 510 response.setHTTPStatusCode(200); |
| 511 URLTestHelpers::registerMockedURLLoadWithCustomResponse(url, testImageFilena
me, WebString::fromUTF8(""), WrappedResourceResponse(response)); |
| 512 |
| 513 ResourceFetcher* fetcher = ResourceFetcher::create(ResourceFetcherTestMockFe
tchContext::create()); |
| 514 FetchRequest request(url, FetchInitiatorInfo()); |
| 515 request.makeSynchronous(); |
| 516 Resource* resource = fetcher->requestResource(request, TestResourceFactory()
); |
| 517 EXPECT_TRUE(resource->isLoaded()); |
| 518 EXPECT_EQ(ResourceLoadPriorityHighest, resource->resourceRequest().priority(
)); |
| 519 |
| 520 memoryCache()->remove(resource); |
| 521 } |
| 522 |
| 505 } // namespace blink | 523 } // namespace blink |
| OLD | NEW |