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 5898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5909 registerMockedChromeURLLoad("test.pdf"); | 5909 registerMockedChromeURLLoad("test.pdf"); |
5910 | 5910 |
5911 RefPtr<blink::LocalFrame> frame = toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame()); | 5911 RefPtr<blink::LocalFrame> frame = toLocalFrame(webViewHelper.webViewImpl()->
page()->mainFrame()); |
5912 | 5912 |
5913 MockDocumentThreadableLoaderClient client; | 5913 MockDocumentThreadableLoaderClient client; |
5914 blink::ThreadableLoaderOptions options; | 5914 blink::ThreadableLoaderOptions options; |
5915 | 5915 |
5916 // First try to load the request with regular access. Should fail. | 5916 // First try to load the request with regular access. Should fail. |
5917 options.crossOriginRequestPolicy = blink::UseAccessControl; | 5917 options.crossOriginRequestPolicy = blink::UseAccessControl; |
5918 blink::ResourceLoaderOptions resourceLoaderOptions; | 5918 blink::ResourceLoaderOptions resourceLoaderOptions; |
5919 blink::ResourceRequest request(resourceUrl); | |
5920 request.setRequestContext(WebURLRequest::RequestContextInternal); | |
5921 blink::DocumentThreadableLoader::loadResourceSynchronously( | 5919 blink::DocumentThreadableLoader::loadResourceSynchronously( |
5922 *frame->document(), request, client, options, resourceLoaderOptions); | 5920 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); |
5923 EXPECT_TRUE(client.failed()); | 5921 EXPECT_TRUE(client.failed()); |
5924 | 5922 |
5925 client.reset(); | 5923 client.reset(); |
5926 // Try to load the request with cross origin access. Should succeed. | 5924 // Try to load the request with cross origin access. Should succeed. |
5927 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; | 5925 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; |
5928 blink::DocumentThreadableLoader::loadResourceSynchronously( | 5926 blink::DocumentThreadableLoader::loadResourceSynchronously( |
5929 *frame->document(), request, client, options, resourceLoaderOptions); | 5927 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); |
5930 EXPECT_FALSE(client.failed()); | 5928 EXPECT_FALSE(client.failed()); |
5931 } | 5929 } |
5932 | 5930 |
5933 } // namespace | 5931 } // namespace |
OLD | NEW |