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 7093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7104 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); | 7104 WebRemoteFrame* remoteFrame = WebRemoteFrame::create(WebTreeScopeType::Docum
ent, nullptr); |
7105 WebFrame* targetFrame = mainFrame()->firstChild()->nextSibling(); | 7105 WebFrame* targetFrame = mainFrame()->firstChild()->nextSibling(); |
7106 EXPECT_TRUE(targetFrame); | 7106 EXPECT_TRUE(targetFrame); |
7107 swapAndVerifySubframeConsistency("local->remote", targetFrame, remoteFrame); | 7107 swapAndVerifySubframeConsistency("local->remote", targetFrame, remoteFrame); |
7108 | 7108 |
7109 targetFrame = mainFrame()->firstChild()->nextSibling(); | 7109 targetFrame = mainFrame()->firstChild()->nextSibling(); |
7110 EXPECT_TRUE(targetFrame); | 7110 EXPECT_TRUE(targetFrame); |
7111 | 7111 |
7112 // Create child frames in the target frame before testing the swap. | 7112 // Create child frames in the target frame before testing the swap. |
7113 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; | 7113 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; |
7114 remoteFrame->createRemoteChild(WebTreeScopeType::Document, "", WebSandboxFla
gs::None, &remoteFrameClient); | 7114 WebRemoteFrame* childRemoteFrame = remoteFrame->createRemoteChild(WebTreeSco
peType::Document, "", WebSandboxFlags::None, &remoteFrameClient); |
7115 | 7115 |
7116 FrameTestHelpers::TestWebFrameClient client; | 7116 FrameTestHelpers::TestWebFrameClient client; |
7117 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); | 7117 WebLocalFrame* localFrame = WebLocalFrame::create(WebTreeScopeType::Document
, &client); |
7118 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); | 7118 localFrame->initializeToReplaceRemoteFrame(remoteFrame, "", WebSandboxFlags:
:None); |
7119 swapAndVerifySubframeConsistency("remote->local", targetFrame, localFrame); | 7119 swapAndVerifySubframeConsistency("remote->local", targetFrame, localFrame); |
7120 | 7120 |
7121 // FIXME: This almost certainly fires more load events on the iframe element | 7121 // FIXME: This almost certainly fires more load events on the iframe element |
7122 // than it should. | 7122 // than it should. |
7123 // Finally, make sure an embedder triggered load in the local frame swapped | 7123 // Finally, make sure an embedder triggered load in the local frame swapped |
7124 // back in works. | 7124 // back in works. |
7125 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); | 7125 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "subframe-hello.html"); |
7126 std::string content = localFrame->contentAsText(1024).utf8(); | 7126 std::string content = localFrame->contentAsText(1024).utf8(); |
7127 EXPECT_EQ("hello", content); | 7127 EXPECT_EQ("hello", content); |
7128 | 7128 |
7129 // Manually reset to break WebViewHelper's dependency on the stack allocated | 7129 // Manually reset to break WebViewHelper's dependency on the stack allocated |
7130 // TestWebFrameClient. | 7130 // TestWebFrameClient. |
7131 reset(); | 7131 reset(); |
7132 remoteFrame->close(); | 7132 remoteFrame->close(); |
| 7133 childRemoteFrame->close(); |
7133 } | 7134 } |
7134 | 7135 |
7135 TEST_F(WebFrameSwapTest, SwapPreservesGlobalContext) | 7136 TEST_F(WebFrameSwapTest, SwapPreservesGlobalContext) |
7136 { | 7137 { |
7137 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 7138 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
7138 v8::Local<v8::Value> windowTop = mainFrame()->executeScriptAndReturnValue(We
bScriptSource("window")); | 7139 v8::Local<v8::Value> windowTop = mainFrame()->executeScriptAndReturnValue(We
bScriptSource("window")); |
7139 ASSERT_TRUE(windowTop->IsObject()); | 7140 ASSERT_TRUE(windowTop->IsObject()); |
7140 v8::Local<v8::Value> originalWindow = mainFrame()->executeScriptAndReturnVal
ue(WebScriptSource( | 7141 v8::Local<v8::Value> originalWindow = mainFrame()->executeScriptAndReturnVal
ue(WebScriptSource( |
7141 "document.querySelector('#frame2').contentWindow;")); | 7142 "document.querySelector('#frame2').contentWindow;")); |
7142 ASSERT_TRUE(originalWindow->IsObject()); | 7143 ASSERT_TRUE(originalWindow->IsObject()); |
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7986 | 7987 |
7987 TEST_F(WebFrameTest, MaxFramesDetach) | 7988 TEST_F(WebFrameTest, MaxFramesDetach) |
7988 { | 7989 { |
7989 registerMockedHttpURLLoad("max-frames-detach.html"); | 7990 registerMockedHttpURLLoad("max-frames-detach.html"); |
7990 FrameTestHelpers::WebViewHelper webViewHelper; | 7991 FrameTestHelpers::WebViewHelper webViewHelper; |
7991 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); | 7992 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "max-
frames-detach.html", true); |
7992 webViewImpl->mainFrameImpl()->collectGarbage(); | 7993 webViewImpl->mainFrameImpl()->collectGarbage(); |
7993 } | 7994 } |
7994 | 7995 |
7995 } // namespace blink | 7996 } // namespace blink |
OLD | NEW |