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