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 3350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | |
3396 TEST_P(ParameterizedWebFrameTest, ClearFocusedNodeTest) | 3371 TEST_P(ParameterizedWebFrameTest, ClearFocusedNodeTest) |
3397 { | 3372 { |
3398 registerMockedHttpURLLoad("iframe_clear_focused_node_test.html"); | 3373 registerMockedHttpURLLoad("iframe_clear_focused_node_test.html"); |
3399 registerMockedHttpURLLoad("autofocus_input_field_iframe.html"); | 3374 registerMockedHttpURLLoad("autofocus_input_field_iframe.html"); |
3400 | 3375 |
3401 FrameTestHelpers::WebViewHelper webViewHelper(this); | 3376 FrameTestHelpers::WebViewHelper webViewHelper(this); |
3402 webViewHelper.initializeAndLoad(m_baseURL + "iframe_clear_focused_node_test.
html", true); | 3377 webViewHelper.initializeAndLoad(m_baseURL + "iframe_clear_focused_node_test.
html", true); |
3403 | 3378 |
3404 // Clear the focused node. | 3379 // Clear the focused node. |
3405 webViewHelper.webView()->clearFocusedElement(); | 3380 webViewHelper.webView()->clearFocusedElement(); |
(...skipping 5257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8663 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); | 8638 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); |
8664 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 8639 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
8665 mainFrame->executeScript(WebScriptSource("hello = 'world';")); | 8640 mainFrame->executeScript(WebScriptSource("hello = 'world';")); |
8666 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); | 8641 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); |
8667 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); | 8642 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri
ptSource("hello")); |
8668 ASSERT_TRUE(result->IsString()); | 8643 ASSERT_TRUE(result->IsString()); |
8669 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); | 8644 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC
ontext()).ToLocalChecked())); |
8670 } | 8645 } |
8671 | 8646 |
8672 } // namespace blink | 8647 } // namespace blink |
OLD | NEW |