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 7197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7208 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7208 EXPECT_TRUE(is_fullscreen_allowed(root)); |
7209 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); | 7209 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); |
7210 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7210 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
7211 | 7211 |
7212 // Cross-site navigation should preserve the fullscreen flags. | 7212 // Cross-site navigation should preserve the fullscreen flags. |
7213 NavigateFrameToURL(root->child_at(0)->child_at(0), | 7213 NavigateFrameToURL(root->child_at(0)->child_at(0), |
7214 embedded_test_server()->GetURL("d.com", "/title1.html")); | 7214 embedded_test_server()->GetURL("d.com", "/title1.html")); |
7215 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7215 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
7216 } | 7216 } |
7217 | 7217 |
| 7218 // Tests that an out-of-process iframe receives the visibilitychange event. |
| 7219 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChange) { |
| 7220 GURL main_url(embedded_test_server()->GetURL( |
| 7221 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 7222 NavigateToURL(shell(), main_url); |
| 7223 |
| 7224 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 7225 ->GetFrameTree() |
| 7226 ->root(); |
| 7227 |
| 7228 EXPECT_EQ( |
| 7229 " Site A ------------ proxies for B\n" |
| 7230 " +--Site B ------- proxies for A\n" |
| 7231 "Where A = http://a.com/\n" |
| 7232 " B = http://b.com/", |
| 7233 DepictFrameTree(root)); |
| 7234 |
| 7235 EXPECT_TRUE(ExecuteScript( |
| 7236 root->child_at(0)->current_frame_host(), |
| 7237 "var event_fired = 0;\n" |
| 7238 "document.addEventListener('visibilitychange',\n" |
| 7239 " function() { event_fired++; });\n")); |
| 7240 |
| 7241 shell()->web_contents()->WasHidden(); |
| 7242 |
| 7243 int event_fired = 0; |
| 7244 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 7245 root->child_at(0)->current_frame_host(), |
| 7246 "window.domAutomationController.send(event_fired);", &event_fired)); |
| 7247 EXPECT_EQ(1, event_fired); |
| 7248 |
| 7249 shell()->web_contents()->WasShown(); |
| 7250 |
| 7251 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 7252 root->child_at(0)->current_frame_host(), |
| 7253 "window.domAutomationController.send(event_fired);", &event_fired)); |
| 7254 EXPECT_EQ(2, event_fired); |
| 7255 } |
| 7256 |
7218 } // namespace content | 7257 } // namespace content |
OLD | NEW |