| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 ScopedMockRedirectRequester() : m_context(nullptr) {} | 460 ScopedMockRedirectRequester() : m_context(nullptr) {} |
| 461 | 461 |
| 462 ~ScopedMockRedirectRequester() { cleanUp(); } | 462 ~ScopedMockRedirectRequester() { cleanUp(); } |
| 463 | 463 |
| 464 void registerRedirect(const WebString& fromURL, const WebString& toURL) { | 464 void registerRedirect(const WebString& fromURL, const WebString& toURL) { |
| 465 KURL redirectURL(ParsedURLString, fromURL); | 465 KURL redirectURL(ParsedURLString, fromURL); |
| 466 WebURLResponse redirectResponse; | 466 WebURLResponse redirectResponse; |
| 467 redirectResponse.setURL(redirectURL); | 467 redirectResponse.setURL(redirectURL); |
| 468 redirectResponse.setHTTPStatusCode(301); | 468 redirectResponse.setHTTPStatusCode(301); |
| 469 redirectResponse.setHTTPHeaderField(HTTPNames::Location, toURL); | 469 redirectResponse.setHTTPHeaderField(HTTPNames::Location, toURL); |
| 470 redirectResponse.addToEncodedDataLength(kRedirectResponseOverheadBytes); |
| 470 Platform::current()->getURLLoaderMockFactory()->registerURL( | 471 Platform::current()->getURLLoaderMockFactory()->registerURL( |
| 471 redirectURL, redirectResponse, ""); | 472 redirectURL, redirectResponse, ""); |
| 472 } | 473 } |
| 473 | 474 |
| 474 void registerFinalResource(const WebString& url) { | 475 void registerFinalResource(const WebString& url) { |
| 475 KURL finalURL(ParsedURLString, url); | 476 KURL finalURL(ParsedURLString, url); |
| 476 WebURLResponse finalResponse; | 477 WebURLResponse finalResponse; |
| 477 finalResponse.setURL(finalURL); | 478 finalResponse.setURL(finalURL); |
| 478 finalResponse.setHTTPStatusCode(200); | 479 finalResponse.setHTTPStatusCode(200); |
| 479 URLTestHelpers::registerMockedURLLoadWithCustomResponse( | 480 URLTestHelpers::registerMockedURLLoadWithCustomResponse( |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 url, WebURLResponse(), ""); | 745 url, WebURLResponse(), ""); |
| 745 Resource* newResource = fetcher->requestResource( | 746 Resource* newResource = fetcher->requestResource( |
| 746 fetchRequest, TestResourceFactory(Resource::Raw)); | 747 fetchRequest, TestResourceFactory(Resource::Raw)); |
| 747 fetcher->stopFetching(); | 748 fetcher->stopFetching(); |
| 748 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); | 749 Platform::current()->getURLLoaderMockFactory()->unregisterURL(url); |
| 749 | 750 |
| 750 EXPECT_NE(resource, newResource); | 751 EXPECT_NE(resource, newResource); |
| 751 } | 752 } |
| 752 | 753 |
| 753 } // namespace blink | 754 } // namespace blink |
| OLD | NEW |