| 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 8711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8722 std::string content = | 8722 std::string content = |
| 8723 WebFrameContentDumper::dumpWebViewAsText(webView(), 1024).utf8(); | 8723 WebFrameContentDumper::dumpWebViewAsText(webView(), 1024).utf8(); |
| 8724 EXPECT_EQ(" \n\na\n\nb \n\na\n\nhello", content); | 8724 EXPECT_EQ(" \n\na\n\nb \n\na\n\nhello", content); |
| 8725 | 8725 |
| 8726 // Manually reset to break WebViewHelper's dependency on the stack allocated | 8726 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 8727 // TestWebFrameClient. | 8727 // TestWebFrameClient. |
| 8728 reset(); | 8728 reset(); |
| 8729 remoteFrame->close(); | 8729 remoteFrame->close(); |
| 8730 } | 8730 } |
| 8731 | 8731 |
| 8732 TEST_F(WebFrameSwapTest, DetachProvisionalFrame) { |
| 8733 FrameTestHelpers::TestWebRemoteFrameClient remoteFrameClient; |
| 8734 WebRemoteFrameImpl* remoteFrame = WebRemoteFrameImpl::create( |
| 8735 WebTreeScopeType::Document, &remoteFrameClient); |
| 8736 swapAndVerifyMiddleChildConsistency("local->remote", mainFrame(), |
| 8737 remoteFrame); |
| 8738 |
| 8739 FrameTestHelpers::TestWebFrameClient client; |
| 8740 WebLocalFrameImpl* provisionalFrame = WebLocalFrameImpl::createProvisional( |
| 8741 &client, remoteFrame, WebSandboxFlags::None); |
| 8742 |
| 8743 // The provisional frame should have a local frame owner. |
| 8744 FrameOwner* owner = provisionalFrame->frame()->owner(); |
| 8745 ASSERT_TRUE(owner->isLocal()); |
| 8746 |
| 8747 // But the owner should point to |remoteFrame|, since the new frame is still |
| 8748 // provisional. |
| 8749 EXPECT_EQ(remoteFrame->frame(), owner->contentFrame()); |
| 8750 |
| 8751 // After detaching the provisional frame, the frame owner should still point |
| 8752 // at |remoteFrame|. |
| 8753 provisionalFrame->detach(); |
| 8754 |
| 8755 // The owner should not be affected by detaching the provisional frame, so it |
| 8756 // should still point to |remoteFrame|. |
| 8757 EXPECT_EQ(remoteFrame->frame(), owner->contentFrame()); |
| 8758 |
| 8759 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 8760 // TestWebFrameClient. |
| 8761 reset(); |
| 8762 } |
| 8763 |
| 8732 void WebFrameTest::swapAndVerifySubframeConsistency(const char* const message, | 8764 void WebFrameTest::swapAndVerifySubframeConsistency(const char* const message, |
| 8733 WebFrame* oldFrame, | 8765 WebFrame* oldFrame, |
| 8734 WebFrame* newFrame) { | 8766 WebFrame* newFrame) { |
| 8735 SCOPED_TRACE(message); | 8767 SCOPED_TRACE(message); |
| 8736 | 8768 |
| 8737 EXPECT_TRUE(oldFrame->firstChild()); | 8769 EXPECT_TRUE(oldFrame->firstChild()); |
| 8738 oldFrame->swap(newFrame); | 8770 oldFrame->swap(newFrame); |
| 8739 | 8771 |
| 8740 EXPECT_FALSE(newFrame->firstChild()); | 8772 EXPECT_FALSE(newFrame->firstChild()); |
| 8741 EXPECT_FALSE(newFrame->m_lastChild); | 8773 EXPECT_FALSE(newFrame->m_lastChild); |
| (...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11235 | 11267 |
| 11236 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); | 11268 EXPECT_TRUE(mainFrameClient.childClient().didCallFrameDetached()); |
| 11237 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); | 11269 EXPECT_TRUE(mainFrameClient.childClient().didCallDidStopLoading()); |
| 11238 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); | 11270 EXPECT_TRUE(mainFrameClient.childClient().didCallDidFinishDocumentLoad()); |
| 11239 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); | 11271 EXPECT_TRUE(mainFrameClient.childClient().didCallDidHandleOnloadEvents()); |
| 11240 | 11272 |
| 11241 webViewHelper.reset(); | 11273 webViewHelper.reset(); |
| 11242 } | 11274 } |
| 11243 | 11275 |
| 11244 } // namespace blink | 11276 } // namespace blink |
| OLD | NEW |