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