| 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 9006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9017 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); | 9017 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); |
| 9018 SwapAndVerifyFirstChildConsistency("remote->local", MainFrame(), local_frame); | 9018 SwapAndVerifyFirstChildConsistency("remote->local", MainFrame(), local_frame); |
| 9019 | 9019 |
| 9020 // FIXME: This almost certainly fires more load events on the iframe element | 9020 // FIXME: This almost certainly fires more load events on the iframe element |
| 9021 // than it should. | 9021 // than it should. |
| 9022 // Finally, make sure an embedder triggered load in the local frame swapped | 9022 // Finally, make sure an embedder triggered load in the local frame swapped |
| 9023 // back in works. | 9023 // back in works. |
| 9024 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); | 9024 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); |
| 9025 std::string content = | 9025 std::string content = |
| 9026 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); | 9026 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); |
| 9027 EXPECT_EQ(" \n\nhello\n\nb \n\na\n\nc", content); | 9027 EXPECT_EQ("\n\nhello\n\nb \n\na\n\nc", content); |
| 9028 | 9028 |
| 9029 // Manually reset to break WebViewHelper's dependency on the stack allocated | 9029 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 9030 // TestWebFrameClient. | 9030 // TestWebFrameClient. |
| 9031 Reset(); | 9031 Reset(); |
| 9032 remote_frame->Close(); | 9032 remote_frame->Close(); |
| 9033 } | 9033 } |
| 9034 | 9034 |
| 9035 void WebFrameTest::SwapAndVerifyMiddleChildConsistency( | 9035 void WebFrameTest::SwapAndVerifyMiddleChildConsistency( |
| 9036 const char* const message, | 9036 const char* const message, |
| 9037 WebFrame* parent, | 9037 WebFrame* parent, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 9061 SwapAndVerifyMiddleChildConsistency("remote->local", MainFrame(), | 9061 SwapAndVerifyMiddleChildConsistency("remote->local", MainFrame(), |
| 9062 local_frame); | 9062 local_frame); |
| 9063 | 9063 |
| 9064 // FIXME: This almost certainly fires more load events on the iframe element | 9064 // FIXME: This almost certainly fires more load events on the iframe element |
| 9065 // than it should. | 9065 // than it should. |
| 9066 // Finally, make sure an embedder triggered load in the local frame swapped | 9066 // Finally, make sure an embedder triggered load in the local frame swapped |
| 9067 // back in works. | 9067 // back in works. |
| 9068 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); | 9068 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); |
| 9069 std::string content = | 9069 std::string content = |
| 9070 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); | 9070 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); |
| 9071 EXPECT_EQ(" \n\na\n\nhello\n\nc", content); | 9071 EXPECT_EQ("\n\na\n\nhello\n\nc", content); |
| 9072 | 9072 |
| 9073 // Manually reset to break WebViewHelper's dependency on the stack allocated | 9073 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 9074 // TestWebFrameClient. | 9074 // TestWebFrameClient. |
| 9075 Reset(); | 9075 Reset(); |
| 9076 remote_frame->Close(); | 9076 remote_frame->Close(); |
| 9077 } | 9077 } |
| 9078 | 9078 |
| 9079 void WebFrameTest::SwapAndVerifyLastChildConsistency(const char* const message, | 9079 void WebFrameTest::SwapAndVerifyLastChildConsistency(const char* const message, |
| 9080 WebFrame* parent, | 9080 WebFrame* parent, |
| 9081 WebFrame* new_child) { | 9081 WebFrame* new_child) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 9099 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); | 9099 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); |
| 9100 SwapAndVerifyLastChildConsistency("remote->local", MainFrame(), local_frame); | 9100 SwapAndVerifyLastChildConsistency("remote->local", MainFrame(), local_frame); |
| 9101 | 9101 |
| 9102 // FIXME: This almost certainly fires more load events on the iframe element | 9102 // FIXME: This almost certainly fires more load events on the iframe element |
| 9103 // than it should. | 9103 // than it should. |
| 9104 // Finally, make sure an embedder triggered load in the local frame swapped | 9104 // Finally, make sure an embedder triggered load in the local frame swapped |
| 9105 // back in works. | 9105 // back in works. |
| 9106 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); | 9106 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); |
| 9107 std::string content = | 9107 std::string content = |
| 9108 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); | 9108 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); |
| 9109 EXPECT_EQ(" \n\na\n\nb \n\na\n\nhello", content); | 9109 EXPECT_EQ("\n\na\n\nb \n\na\n\nhello", content); |
| 9110 | 9110 |
| 9111 // Manually reset to break WebViewHelper's dependency on the stack allocated | 9111 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 9112 // TestWebFrameClient. | 9112 // TestWebFrameClient. |
| 9113 Reset(); | 9113 Reset(); |
| 9114 remote_frame->Close(); | 9114 remote_frame->Close(); |
| 9115 } | 9115 } |
| 9116 | 9116 |
| 9117 TEST_F(WebFrameSwapTest, DetachProvisionalFrame) { | 9117 TEST_F(WebFrameSwapTest, DetachProvisionalFrame) { |
| 9118 FrameTestHelpers::TestWebRemoteFrameClient remote_frame_client; | 9118 FrameTestHelpers::TestWebRemoteFrameClient remote_frame_client; |
| 9119 WebRemoteFrameImpl* remote_frame = WebRemoteFrameImpl::Create( | 9119 WebRemoteFrameImpl* remote_frame = WebRemoteFrameImpl::Create( |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9179 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); | 9179 &client, nullptr, nullptr, remote_frame, WebSandboxFlags::kNone); |
| 9180 SwapAndVerifySubframeConsistency("remote->local", target_frame, local_frame); | 9180 SwapAndVerifySubframeConsistency("remote->local", target_frame, local_frame); |
| 9181 | 9181 |
| 9182 // FIXME: This almost certainly fires more load events on the iframe element | 9182 // FIXME: This almost certainly fires more load events on the iframe element |
| 9183 // than it should. | 9183 // than it should. |
| 9184 // Finally, make sure an embedder triggered load in the local frame swapped | 9184 // Finally, make sure an embedder triggered load in the local frame swapped |
| 9185 // back in works. | 9185 // back in works. |
| 9186 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); | 9186 FrameTestHelpers::LoadFrame(local_frame, base_url_ + "subframe-hello.html"); |
| 9187 std::string content = | 9187 std::string content = |
| 9188 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); | 9188 WebFrameContentDumper::DumpWebViewAsText(WebView(), 1024).Utf8(); |
| 9189 EXPECT_EQ(" \n\na\n\nhello\n\nc", content); | 9189 EXPECT_EQ("\n\na\n\nhello\n\nc", content); |
| 9190 | 9190 |
| 9191 // Manually reset to break WebViewHelper's dependency on the stack allocated | 9191 // Manually reset to break WebViewHelper's dependency on the stack allocated |
| 9192 // TestWebFrameClient. | 9192 // TestWebFrameClient. |
| 9193 Reset(); | 9193 Reset(); |
| 9194 remote_frame->Close(); | 9194 remote_frame->Close(); |
| 9195 child_remote_frame->Close(); | 9195 child_remote_frame->Close(); |
| 9196 } | 9196 } |
| 9197 | 9197 |
| 9198 TEST_F(WebFrameSwapTest, SwapPreservesGlobalContext) { | 9198 TEST_F(WebFrameSwapTest, SwapPreservesGlobalContext) { |
| 9199 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 9199 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| (...skipping 2947 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12147 | 12147 |
| 12148 // Failing the original child frame navigation and trying to render fallback | 12148 // Failing the original child frame navigation and trying to render fallback |
| 12149 // content shouldn't crash. It should return NoLoadInProgress. This is so the | 12149 // content shouldn't crash. It should return NoLoadInProgress. This is so the |
| 12150 // caller won't attempt to replace the correctly empty frame with an error | 12150 // caller won't attempt to replace the correctly empty frame with an error |
| 12151 // page. | 12151 // page. |
| 12152 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, | 12152 EXPECT_EQ(WebLocalFrame::NoLoadInProgress, |
| 12153 child->MaybeRenderFallbackContent(WebURLError())); | 12153 child->MaybeRenderFallbackContent(WebURLError())); |
| 12154 } | 12154 } |
| 12155 | 12155 |
| 12156 } // namespace blink | 12156 } // namespace blink |
| OLD | NEW |