| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 5882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5893 registerMockedChromeURLLoad("test.pdf"); | 5893 registerMockedChromeURLLoad("test.pdf"); |
| 5894 | 5894 |
| 5895 RefPtr<blink::LocalFrame> frame = toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame()); | 5895 RefPtr<blink::LocalFrame> frame = toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame()); |
| 5896 | 5896 |
| 5897 MockDocumentThreadableLoaderClient client; | 5897 MockDocumentThreadableLoaderClient client; |
| 5898 blink::ThreadableLoaderOptions options; | 5898 blink::ThreadableLoaderOptions options; |
| 5899 | 5899 |
| 5900 // First try to load the request with regular access. Should fail. | 5900 // First try to load the request with regular access. Should fail. |
| 5901 options.crossOriginRequestPolicy = blink::UseAccessControl; | 5901 options.crossOriginRequestPolicy = blink::UseAccessControl; |
| 5902 blink::ResourceLoaderOptions resourceLoaderOptions; | 5902 blink::ResourceLoaderOptions resourceLoaderOptions; |
| 5903 blink::ResourceRequest request(resourceUrl); |
| 5904 request.setRequestContext(WebURLRequest::RequestContextInternal); |
| 5903 blink::DocumentThreadableLoader::loadResourceSynchronously( | 5905 blink::DocumentThreadableLoader::loadResourceSynchronously( |
| 5904 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); | 5906 *frame->document(), request, client, options, resourceLoaderOptions); |
| 5905 EXPECT_TRUE(client.failed()); | 5907 EXPECT_TRUE(client.failed()); |
| 5906 | 5908 |
| 5907 client.reset(); | 5909 client.reset(); |
| 5908 // Try to load the request with cross origin access. Should succeed. | 5910 // Try to load the request with cross origin access. Should succeed. |
| 5909 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; | 5911 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; |
| 5910 blink::DocumentThreadableLoader::loadResourceSynchronously( | 5912 blink::DocumentThreadableLoader::loadResourceSynchronously( |
| 5911 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); | 5913 *frame->document(), request, client, options, resourceLoaderOptions); |
| 5912 EXPECT_FALSE(client.failed()); | 5914 EXPECT_FALSE(client.failed()); |
| 5913 } | 5915 } |
| 5914 | 5916 |
| 5915 } // namespace | 5917 } // namespace |
| OLD | NEW |