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 7359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7370 bool fullscreen_allowed = false; | 7370 bool fullscreen_allowed = false; |
| 7371 EXPECT_TRUE(ExecuteScriptAndExtractBool( | 7371 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 7372 ftn, | 7372 ftn, |
| 7373 "window.domAutomationController.send(document.webkitFullscreenEnabled)", | 7373 "window.domAutomationController.send(document.webkitFullscreenEnabled)", |
| 7374 &fullscreen_allowed)); | 7374 &fullscreen_allowed)); |
| 7375 return fullscreen_allowed; | 7375 return fullscreen_allowed; |
| 7376 }; | 7376 }; |
| 7377 | 7377 |
| 7378 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7378 EXPECT_TRUE(is_fullscreen_allowed(root)); |
| 7379 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); | 7379 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); |
| 7380 EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allowFullscreen); | 7380 EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allow_fullscreen); |
| 7381 | 7381 |
| 7382 // Now navigate to a page with two <iframe>'s, both without allowFullscreen. | 7382 // Now navigate to a page with two <iframe>'s, both without allowFullscreen. |
| 7383 GURL url_2(embedded_test_server()->GetURL( | 7383 GURL url_2(embedded_test_server()->GetURL( |
| 7384 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); | 7384 "a.com", "/cross_site_iframe_factory.html?a(b,c)")); |
| 7385 EXPECT_TRUE(NavigateToURL(shell(), url_2)); | 7385 EXPECT_TRUE(NavigateToURL(shell(), url_2)); |
| 7386 EXPECT_FALSE(root->child_at(0)->frame_owner_properties().allowFullscreen); | 7386 EXPECT_FALSE(root->child_at(0)->frame_owner_properties().allow_fullscreen); |
| 7387 EXPECT_FALSE(root->child_at(1)->frame_owner_properties().allowFullscreen); | 7387 EXPECT_FALSE(root->child_at(1)->frame_owner_properties().allow_fullscreen); |
| 7388 | 7388 |
| 7389 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7389 EXPECT_TRUE(is_fullscreen_allowed(root)); |
| 7390 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0))); | 7390 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0))); |
| 7391 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(1))); | 7391 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(1))); |
| 7392 | 7392 |
| 7393 // Dynamically enable fullscreen for first subframe and check that the | 7393 // Dynamically enable fullscreen for first subframe and check that the |
| 7394 // fullscreen property was updated on the FrameTreeNode. | 7394 // fullscreen property was updated on the FrameTreeNode. |
| 7395 EXPECT_TRUE(ExecuteScript( | 7395 EXPECT_TRUE(ExecuteScript( |
| 7396 root, "document.getElementById('child-0').allowFullscreen='true'")); | 7396 root, "document.getElementById('child-0').allow_fullscreen='true'")); |
|
alexmos
2016/07/19 00:15:56
I don't think you want to change this. This is th
raymes
2016/07/19 05:53:09
Oops - find/replace failed me :(
| |
| 7397 EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allowFullscreen); | 7397 EXPECT_TRUE(root->child_at(0)->frame_owner_properties().allow_fullscreen); |
| 7398 | 7398 |
| 7399 // Check that the first subframe is now allowed to go fullscreen. Other | 7399 // Check that the first subframe is now allowed to go fullscreen. Other |
| 7400 // frames shouldn't be affected. | 7400 // frames shouldn't be affected. |
| 7401 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7401 EXPECT_TRUE(is_fullscreen_allowed(root)); |
| 7402 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); | 7402 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); |
| 7403 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(1))); | 7403 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(1))); |
| 7404 | 7404 |
| 7405 // Now navigate to a page with two levels of nesting. | 7405 // Now navigate to a page with two levels of nesting. |
| 7406 GURL url_3(embedded_test_server()->GetURL( | 7406 GURL url_3(embedded_test_server()->GetURL( |
| 7407 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); | 7407 "a.com", "/cross_site_iframe_factory.html?a(b(c))")); |
| 7408 EXPECT_TRUE(NavigateToURL(shell(), url_3)); | 7408 EXPECT_TRUE(NavigateToURL(shell(), url_3)); |
| 7409 | 7409 |
| 7410 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7410 EXPECT_TRUE(is_fullscreen_allowed(root)); |
| 7411 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0))); | 7411 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0))); |
| 7412 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7412 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| 7413 | 7413 |
| 7414 // Dynamically enable fullscreen for bottom subframe. | 7414 // Dynamically enable fullscreen for bottom subframe. |
| 7415 EXPECT_TRUE(ExecuteScript( | 7415 EXPECT_TRUE(ExecuteScript( |
| 7416 root->child_at(0), | 7416 root->child_at(0), |
| 7417 "document.getElementById('child-0').allowFullscreen='true'")); | 7417 "document.getElementById('child-0').allow_fullscreen='true'")); |
|
alexmos
2016/07/19 00:15:56
Ditto.
raymes
2016/07/19 05:53:09
Done.
| |
| 7418 | 7418 |
| 7419 // This still shouldn't allow the bottom child to go fullscreen, since the | 7419 // This still shouldn't allow the bottom child to go fullscreen, since the |
| 7420 // top frame hasn't allowed fullscreen for the middle frame. | 7420 // top frame hasn't allowed fullscreen for the middle frame. |
| 7421 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7421 EXPECT_TRUE(is_fullscreen_allowed(root)); |
| 7422 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0))); | 7422 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0))); |
| 7423 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7423 EXPECT_FALSE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| 7424 | 7424 |
| 7425 // Now allow fullscreen for the middle frame. | 7425 // Now allow fullscreen for the middle frame. |
| 7426 EXPECT_TRUE(ExecuteScript( | 7426 EXPECT_TRUE(ExecuteScript( |
| 7427 root, "document.getElementById('child-0').allowFullscreen='true'")); | 7427 root, "document.getElementById('child-0').allow_fullscreen='true'")); |
|
alexmos
2016/07/19 00:15:56
Ditto.
raymes
2016/07/19 05:53:09
Done.
| |
| 7428 | 7428 |
| 7429 // All frames should be allowed to go fullscreen now. | 7429 // All frames should be allowed to go fullscreen now. |
| 7430 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7430 EXPECT_TRUE(is_fullscreen_allowed(root)); |
| 7431 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); | 7431 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); |
| 7432 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7432 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| 7433 | 7433 |
| 7434 // Cross-site navigation should preserve the fullscreen flags. | 7434 // Cross-site navigation should preserve the fullscreen flags. |
| 7435 NavigateFrameToURL(root->child_at(0)->child_at(0), | 7435 NavigateFrameToURL(root->child_at(0)->child_at(0), |
| 7436 embedded_test_server()->GetURL("d.com", "/title1.html")); | 7436 embedded_test_server()->GetURL("d.com", "/title1.html")); |
| 7437 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7437 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7502 | 7502 |
| 7503 shell()->web_contents()->WasShown(); | 7503 shell()->web_contents()->WasShown(); |
| 7504 | 7504 |
| 7505 EXPECT_TRUE(ExecuteScriptAndExtractInt( | 7505 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 7506 root->child_at(0)->current_frame_host(), | 7506 root->child_at(0)->current_frame_host(), |
| 7507 "window.domAutomationController.send(event_fired);", &event_fired)); | 7507 "window.domAutomationController.send(event_fired);", &event_fired)); |
| 7508 EXPECT_EQ(2, event_fired); | 7508 EXPECT_EQ(2, event_fired); |
| 7509 } | 7509 } |
| 7510 | 7510 |
| 7511 } // namespace content | 7511 } // namespace content |
| OLD | NEW |