Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(689)

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 1976513002: Set the request mode and the credentials mode even if the request will not go to ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: introduce IsNoCORSAllowedContext Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 7885 matching lines...) Expand 10 before | Expand all | Expand 10 after
7896 // and convert it to a unittest. 7896 // and convert it to a unittest.
7897 TEST_P(ParameterizedWebFrameTest, LoaderOriginAccess) 7897 TEST_P(ParameterizedWebFrameTest, LoaderOriginAccess)
7898 { 7898 {
7899 FrameTestHelpers::WebViewHelper webViewHelper(this); 7899 FrameTestHelpers::WebViewHelper webViewHelper(this);
7900 webViewHelper.initializeAndLoad("about:blank"); 7900 webViewHelper.initializeAndLoad("about:blank");
7901 7901
7902 SchemeRegistry::registerURLSchemeAsDisplayIsolated("chrome"); 7902 SchemeRegistry::registerURLSchemeAsDisplayIsolated("chrome");
7903 7903
7904 // Cross-origin request. 7904 // Cross-origin request.
7905 KURL resourceUrl(ParsedURLString, "chrome://test.pdf"); 7905 KURL resourceUrl(ParsedURLString, "chrome://test.pdf");
7906 ResourceRequest request(resourceUrl);
7907 request.setRequestContext(WebURLRequest::RequestContextObject);
7906 registerMockedChromeURLLoad("test.pdf"); 7908 registerMockedChromeURLLoad("test.pdf");
7907 7909
7908 LocalFrame* frame(toLocalFrame(webViewHelper.webViewImpl()->page()->mainFram e())); 7910 LocalFrame* frame(toLocalFrame(webViewHelper.webViewImpl()->page()->mainFram e()));
7909 7911
7910 MockDocumentThreadableLoaderClient client; 7912 MockDocumentThreadableLoaderClient client;
7911 ThreadableLoaderOptions options; 7913 ThreadableLoaderOptions options;
7912 7914
7913 // First try to load the request with regular access. Should fail. 7915 // First try to load the request with regular access. Should fail.
7914 options.crossOriginRequestPolicy = UseAccessControl; 7916 options.crossOriginRequestPolicy = UseAccessControl;
7915 ResourceLoaderOptions resourceLoaderOptions; 7917 ResourceLoaderOptions resourceLoaderOptions;
7916 DocumentThreadableLoader::loadResourceSynchronously( 7918 DocumentThreadableLoader::loadResourceSynchronously(
7917 *frame->document(), ResourceRequest(resourceUrl), client, options, resou rceLoaderOptions); 7919 *frame->document(), request, client, options, resourceLoaderOptions);
7918 EXPECT_TRUE(client.failed()); 7920 EXPECT_TRUE(client.failed());
7919 7921
7920 client.reset(); 7922 client.reset();
7921 // Try to load the request with cross origin access. Should succeed. 7923 // Try to load the request with cross origin access. Should succeed.
7922 options.crossOriginRequestPolicy = AllowCrossOriginRequests; 7924 options.crossOriginRequestPolicy = AllowCrossOriginRequests;
7923 DocumentThreadableLoader::loadResourceSynchronously( 7925 DocumentThreadableLoader::loadResourceSynchronously(
7924 *frame->document(), ResourceRequest(resourceUrl), client, options, resou rceLoaderOptions); 7926 *frame->document(), request, client, options, resourceLoaderOptions);
7925 EXPECT_FALSE(client.failed()); 7927 EXPECT_FALSE(client.failed());
7926 } 7928 }
7927 7929
7928 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame) 7930 TEST_P(ParameterizedWebFrameTest, DetachRemoteFrame)
7929 { 7931 {
7930 FrameTestHelpers::TestWebViewClient viewClient; 7932 FrameTestHelpers::TestWebViewClient viewClient;
7931 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 7933 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
7932 WebView* view = WebView::create(&viewClient); 7934 WebView* view = WebView::create(&viewClient);
7933 view->setMainFrame(remoteClient.frame()); 7935 view->setMainFrame(remoteClient.frame());
7934 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient; 7936 FrameTestHelpers::TestWebRemoteFrameClient childFrameClient;
(...skipping 747 matching lines...) Expand 10 before | Expand all | Expand 10 after
8682 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8683 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8685 v8::HandleScope scope(v8::Isolate::GetCurrent());
8684 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8686 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8685 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8686 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8687 ASSERT_TRUE(result->IsString()); 8689 ASSERT_TRUE(result->IsString());
8688 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8689 } 8691 }
8690 8692
8691 } // namespace blink 8693 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/web/AssociatedURLLoaderTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698