Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 5153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5164 ->root(); | 5164 ->root(); |
| 5165 ASSERT_EQ(1U, root->child_count()); | 5165 ASSERT_EQ(1U, root->child_count()); |
| 5166 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); | 5166 FrameTreeNode* mixed_child = root->child_at(0)->child_at(0); |
| 5167 ASSERT_TRUE(mixed_child); | 5167 ASSERT_TRUE(mixed_child); |
| 5168 // The child iframe attempted to create a mixed iframe; this should | 5168 // The child iframe attempted to create a mixed iframe; this should |
| 5169 // have been blocked, so the mixed iframe should not have committed a | 5169 // have been blocked, so the mixed iframe should not have committed a |
| 5170 // load. | 5170 // load. |
| 5171 EXPECT_FALSE(mixed_child->has_committed_real_load()); | 5171 EXPECT_FALSE(mixed_child->has_committed_real_load()); |
| 5172 } | 5172 } |
| 5173 | 5173 |
| 5174 // Test setting a cross-origin iframe to display: none. | |
| 5175 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteIframeDisplayNone) { | |
| 5176 GURL main_url(embedded_test_server()->GetURL( | |
| 5177 "a.com", "/cross_site_iframe_factory.html?a(b)")); | |
| 5178 NavigateToURL(shell(), main_url); | |
| 5179 | |
| 5180 // Set the iframe to display: none. | |
| 5181 EXPECT_TRUE( | |
| 5182 ExecuteScript(shell()->web_contents(), | |
| 5183 "document.querySelector('iframe').style.display = 'none'")); | |
| 5184 | |
| 5185 // Waits until pending frames are done. | |
| 5186 // TODO(lfg): We need to find a better way to wait on the renderer compositor | |
| 5187 // frames. | |
|
piman
2016/01/29 01:07:50
Agreed :)
Frames come via RenderWidgetHostViewBase
lfg
2016/01/29 01:10:45
The problem here is figuring out how many frames d
| |
| 5188 { | |
| 5189 base::RunLoop run_loop; | |
| 5190 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
| 5191 FROM_HERE, run_loop.QuitClosure(), | |
| 5192 base::TimeDelta::FromMilliseconds(1000)); | |
| 5193 run_loop.Run(); | |
| 5194 } | |
| 5195 | |
| 5196 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | |
| 5197 ->GetFrameTree() | |
| 5198 ->root(); | |
| 5199 RenderWidgetHostViewBase* root_view = static_cast<RenderWidgetHostViewBase*>( | |
| 5200 root->current_frame_host()->GetRenderWidgetHost()->GetView()); | |
| 5201 | |
| 5202 unsigned current_frame_number = root_view->RendererFrameNumber(); | |
| 5203 | |
| 5204 // Force the renderer to generate a new frame. | |
| 5205 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), | |
| 5206 "document.body.style.background = 'black'")); | |
| 5207 | |
| 5208 // Waits for the next frame. | |
| 5209 while (root_view->RendererFrameNumber() <= current_frame_number) { | |
| 5210 base::RunLoop run_loop; | |
| 5211 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | |
| 5212 FROM_HERE, run_loop.QuitClosure(), | |
| 5213 base::TimeDelta::FromMilliseconds(10)); | |
| 5214 run_loop.Run(); | |
| 5215 } | |
| 5216 } | |
| 5217 | |
| 5174 } // namespace content | 5218 } // namespace content |
| OLD | NEW |