| 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 6914 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6925   EXPECT_EQ(0, child_count); | 6925   EXPECT_EQ(0, child_count); | 
| 6926 | 6926 | 
| 6927   EXPECT_EQ( | 6927   EXPECT_EQ( | 
| 6928       " Site A ------------ proxies for B\n" | 6928       " Site A ------------ proxies for B\n" | 
| 6929       "   +--Site B ------- proxies for A\n" | 6929       "   +--Site B ------- proxies for A\n" | 
| 6930       "Where A = http://a.com/\n" | 6930       "Where A = http://a.com/\n" | 
| 6931       "      B = http://b.com/", | 6931       "      B = http://b.com/", | 
| 6932       DepictFrameTree(root)); | 6932       DepictFrameTree(root)); | 
| 6933 } | 6933 } | 
| 6934 | 6934 | 
|  | 6935 // Tests that an out-of-process iframe receives the visibilitychange event. | 
|  | 6936 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChange) { | 
|  | 6937   GURL main_url(embedded_test_server()->GetURL( | 
|  | 6938       "a.com", "/cross_site_iframe_factory.html?a(b)")); | 
|  | 6939   NavigateToURL(shell(), main_url); | 
|  | 6940 | 
|  | 6941   FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) | 
|  | 6942                             ->GetFrameTree() | 
|  | 6943                             ->root(); | 
|  | 6944 | 
|  | 6945   EXPECT_EQ( | 
|  | 6946       " Site A ------------ proxies for B\n" | 
|  | 6947       "   +--Site B ------- proxies for A\n" | 
|  | 6948       "Where A = http://a.com/\n" | 
|  | 6949       "      B = http://b.com/", | 
|  | 6950       DepictFrameTree(root)); | 
|  | 6951 | 
|  | 6952   EXPECT_TRUE(ExecuteScript( | 
|  | 6953       root->child_at(0)->current_frame_host(), | 
|  | 6954       "var event_fired = 0;\n" | 
|  | 6955       "document.addEventListener('visibilitychange',\n" | 
|  | 6956       "                          function() { event_fired++; });\n")); | 
|  | 6957 | 
|  | 6958   shell()->web_contents()->WasHidden(); | 
|  | 6959 | 
|  | 6960   int event_fired = 0; | 
|  | 6961   EXPECT_TRUE(ExecuteScriptAndExtractInt( | 
|  | 6962       root->child_at(0)->current_frame_host(), | 
|  | 6963       "window.domAutomationController.send(event_fired);", &event_fired)); | 
|  | 6964   EXPECT_EQ(1, event_fired); | 
|  | 6965 | 
|  | 6966   shell()->web_contents()->WasShown(); | 
|  | 6967 | 
|  | 6968   EXPECT_TRUE(ExecuteScriptAndExtractInt( | 
|  | 6969       root->child_at(0)->current_frame_host(), | 
|  | 6970       "window.domAutomationController.send(event_fired);", &event_fired)); | 
|  | 6971   EXPECT_EQ(2, event_fired); | 
|  | 6972 } | 
|  | 6973 | 
| 6935 }  // namespace content | 6974 }  // namespace content | 
| OLD | NEW | 
|---|