| 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> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/path_service.h" |
| 16 #include "base/single_thread_task_runner.h" | 17 #include "base/single_thread_task_runner.h" |
| 17 #include "base/strings/pattern.h" | 18 #include "base/strings/pattern.h" |
| 18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 20 #include "base/test/test_timeouts.h" | 21 #include "base/test/test_timeouts.h" |
| 21 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
| 22 #include "build/build_config.h" | 23 #include "build/build_config.h" |
| 23 #include "components/network_session_configurator/switches.h" | 24 #include "components/network_session_configurator/switches.h" |
| 24 #include "content/browser/frame_host/cross_process_frame_connector.h" | 25 #include "content/browser/frame_host/cross_process_frame_connector.h" |
| 25 #include "content/browser/frame_host/frame_tree.h" | 26 #include "content/browser/frame_host/frame_tree.h" |
| (...skipping 7266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7292 EXPECT_TRUE(is_fullscreen_allowed(root)); | 7293 EXPECT_TRUE(is_fullscreen_allowed(root)); |
| 7293 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); | 7294 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0))); |
| 7294 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7295 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| 7295 | 7296 |
| 7296 // Cross-site navigation should preserve the fullscreen flags. | 7297 // Cross-site navigation should preserve the fullscreen flags. |
| 7297 NavigateFrameToURL(root->child_at(0)->child_at(0), | 7298 NavigateFrameToURL(root->child_at(0)->child_at(0), |
| 7298 embedded_test_server()->GetURL("d.com", "/title1.html")); | 7299 embedded_test_server()->GetURL("d.com", "/title1.html")); |
| 7299 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); | 7300 EXPECT_TRUE(is_fullscreen_allowed(root->child_at(0)->child_at(0))); |
| 7300 } | 7301 } |
| 7301 | 7302 |
| 7303 // Test for https://crbug.com/615575. It ensures that file chooser triggered |
| 7304 // by a document in an out-of-process subframe works properly. |
| 7305 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, FileChooserInSubframe) { |
| 7306 EXPECT_TRUE(NavigateToURL(shell(), embedded_test_server()->GetURL( |
| 7307 "a.com", "/cross_site_iframe_factory.html?a(b)"))); |
| 7308 FrameTreeNode* root = web_contents()->GetFrameTree()->root(); |
| 7309 |
| 7310 GURL url(embedded_test_server()->GetURL("b.com", "/file_input.html")); |
| 7311 NavigateFrameToURL(root->child_at(0), url); |
| 7312 |
| 7313 // Use FileChooserDelegate to avoid showing the actual dialog and to respond |
| 7314 // back to the renderer process with predefined file. |
| 7315 base::FilePath file; |
| 7316 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file)); |
| 7317 file = file.AppendASCII("bar"); |
| 7318 std::unique_ptr<FileChooserDelegate> delegate(new FileChooserDelegate(file)); |
| 7319 shell()->web_contents()->SetDelegate(delegate.get()); |
| 7320 EXPECT_TRUE(ExecuteScript(root->child_at(0), |
| 7321 "document.getElementById('fileinput').click();")); |
| 7322 EXPECT_TRUE(delegate->file_chosen()); |
| 7323 |
| 7324 // Also, extract the file from the renderer process to ensure that the |
| 7325 // response made it over successfully and the proper filename is set. |
| 7326 std::string file_name; |
| 7327 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 7328 root->child_at(0), |
| 7329 "window.domAutomationController.send(" |
| 7330 "document.getElementById('fileinput').files[0].name);", |
| 7331 &file_name)); |
| 7332 EXPECT_EQ("bar", file_name); |
| 7333 } |
| 7334 |
| 7302 } // namespace content | 7335 } // namespace content |
| OLD | NEW |