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

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

Issue 2022083002: Move 'frame-src' CSP checks into FrameFetchContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: redirects Created 4 years, 6 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
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 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after
3361 ASSERT_TRUE(iframe); 3361 ASSERT_TRUE(iframe);
3362 WebDataSource* iframeDataSource = iframe->dataSource(); 3362 WebDataSource* iframeDataSource = iframe->dataSource();
3363 ASSERT_TRUE(iframeDataSource); 3363 ASSERT_TRUE(iframeDataSource);
3364 WebVector<WebURL> redirects; 3364 WebVector<WebURL> redirects;
3365 iframeDataSource->redirectChain(redirects); 3365 iframeDataSource->redirectChain(redirects);
3366 ASSERT_EQ(2U, redirects.size()); 3366 ASSERT_EQ(2U, redirects.size());
3367 EXPECT_EQ(toKURL("about:blank"), KURL(redirects[0])); 3367 EXPECT_EQ(toKURL("about:blank"), KURL(redirects[0]));
3368 EXPECT_EQ(toKURL("http://internal.test/visible_iframe.html"), KURL(redirects [1])); 3368 EXPECT_EQ(toKURL("http://internal.test/visible_iframe.html"), KURL(redirects [1]));
3369 } 3369 }
3370 3370
3371 TEST_P(ParameterizedWebFrameTest, IframeRedirectBlocked)
3372 {
3373 registerMockedHttpURLLoad("iframe_redirect_blocked.html");
3374 registerMockedHttpURLLoad("visible_iframe.html");
3375
3376 FrameTestHelpers::WebViewHelper webViewHelper(this);
3377 webViewHelper.initializeAndLoad(m_baseURL + "iframe_redirect_blocked.html", true);
3378 // Pump pending requests one more time. The test page loads script that navi gates
3379 // to a resource which is blocked.
3380 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()- >mainFrame());
3381 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(webViewHelper.webView()- >mainFrame());
3382
3383 WebFrame* iframe = webViewHelper.webView()->findFrameByName(WebString::fromU TF8("ifr"));
3384 FrameTestHelpers::pumpPendingRequestsForFrameToLoad(iframe);
3385 ASSERT_TRUE(iframe);
3386 WebDataSource* iframeDataSource = iframe->dataSource();
3387 ASSERT_TRUE(iframeDataSource);
3388 WebVector<WebURL> redirects;
3389 iframeDataSource->redirectChain(redirects);
3390 ASSERT_EQ(3U, redirects.size());
3391 EXPECT_EQ(toKURL("about:blank"), KURL(redirects[0]));
3392 EXPECT_EQ(toKURL("http://internal.test/visible_iframe.html"), KURL(redirects [1]));
3393 EXPECT_EQ(toKURL("data:,"), KURL(redirects[2]));
3394 }
3395
3371 TEST_P(ParameterizedWebFrameTest, ClearFocusedNodeTest) 3396 TEST_P(ParameterizedWebFrameTest, ClearFocusedNodeTest)
3372 { 3397 {
3373 registerMockedHttpURLLoad("iframe_clear_focused_node_test.html"); 3398 registerMockedHttpURLLoad("iframe_clear_focused_node_test.html");
3374 registerMockedHttpURLLoad("autofocus_input_field_iframe.html"); 3399 registerMockedHttpURLLoad("autofocus_input_field_iframe.html");
3375 3400
3376 FrameTestHelpers::WebViewHelper webViewHelper(this); 3401 FrameTestHelpers::WebViewHelper webViewHelper(this);
3377 webViewHelper.initializeAndLoad(m_baseURL + "iframe_clear_focused_node_test. html", true); 3402 webViewHelper.initializeAndLoad(m_baseURL + "iframe_clear_focused_node_test. html", true);
3378 3403
3379 // Clear the focused node. 3404 // Clear the focused node.
3380 webViewHelper.webView()->clearFocusedElement(); 3405 webViewHelper.webView()->clearFocusedElement();
(...skipping 5303 matching lines...) Expand 10 before | Expand all | Expand 10 after
8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8709 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8685 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8710 v8::HandleScope scope(v8::Isolate::GetCurrent());
8686 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8711 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8712 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8713 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8689 ASSERT_TRUE(result->IsString()); 8714 ASSERT_TRUE(result->IsString());
8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8715 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8691 } 8716 }
8692 8717
8693 } // namespace blink 8718 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698