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 7314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7325 // response made it over successfully and the proper filename is set. | 7325 // response made it over successfully and the proper filename is set. |
7326 std::string file_name; | 7326 std::string file_name; |
7327 EXPECT_TRUE(ExecuteScriptAndExtractString( | 7327 EXPECT_TRUE(ExecuteScriptAndExtractString( |
7328 root->child_at(0), | 7328 root->child_at(0), |
7329 "window.domAutomationController.send(" | 7329 "window.domAutomationController.send(" |
7330 "document.getElementById('fileinput').files[0].name);", | 7330 "document.getElementById('fileinput').files[0].name);", |
7331 &file_name)); | 7331 &file_name)); |
7332 EXPECT_EQ("bar", file_name); | 7332 EXPECT_EQ("bar", file_name); |
7333 } | 7333 } |
7334 | 7334 |
| 7335 // Tests that an out-of-process iframe receives the visibilitychange event. |
| 7336 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, VisibilityChange) { |
| 7337 GURL main_url(embedded_test_server()->GetURL( |
| 7338 "a.com", "/cross_site_iframe_factory.html?a(b)")); |
| 7339 NavigateToURL(shell(), main_url); |
| 7340 |
| 7341 FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents()) |
| 7342 ->GetFrameTree() |
| 7343 ->root(); |
| 7344 |
| 7345 EXPECT_EQ( |
| 7346 " Site A ------------ proxies for B\n" |
| 7347 " +--Site B ------- proxies for A\n" |
| 7348 "Where A = http://a.com/\n" |
| 7349 " B = http://b.com/", |
| 7350 DepictFrameTree(root)); |
| 7351 |
| 7352 EXPECT_TRUE(ExecuteScript( |
| 7353 root->child_at(0)->current_frame_host(), |
| 7354 "var event_fired = 0;\n" |
| 7355 "document.addEventListener('visibilitychange',\n" |
| 7356 " function() { event_fired++; });\n")); |
| 7357 |
| 7358 shell()->web_contents()->WasHidden(); |
| 7359 |
| 7360 int event_fired = 0; |
| 7361 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 7362 root->child_at(0)->current_frame_host(), |
| 7363 "window.domAutomationController.send(event_fired);", &event_fired)); |
| 7364 EXPECT_EQ(1, event_fired); |
| 7365 |
| 7366 shell()->web_contents()->WasShown(); |
| 7367 |
| 7368 EXPECT_TRUE(ExecuteScriptAndExtractInt( |
| 7369 root->child_at(0)->current_frame_host(), |
| 7370 "window.domAutomationController.send(event_fired);", &event_fired)); |
| 7371 EXPECT_EQ(2, event_fired); |
| 7372 } |
| 7373 |
7335 } // namespace content | 7374 } // namespace content |
OLD | NEW |