| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" |
| 7 #include "base/path_service.h" |
| 6 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 7 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 11 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 12 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_service.h" | 14 #include "content/public/browser/notification_service.h" |
| 13 #include "content/public/browser/notification_types.h" | 15 #include "content/public/browser/notification_types.h" |
| 14 #include "content/public/browser/render_frame_host.h" | 16 #include "content/public/browser/render_frame_host.h" |
| 15 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 EXPECT_TRUE(is_object_created); | 97 EXPECT_TRUE(is_object_created); |
| 96 EXPECT_TRUE(ExecuteScript(frame_host, | 98 EXPECT_TRUE(ExecuteScript(frame_host, |
| 97 "window.webkitRequestFileSystem(" | 99 "window.webkitRequestFileSystem(" |
| 98 "window.TEMPORARY, 1024, function() {});")); | 100 "window.TEMPORARY, 1024, function() {});")); |
| 99 } | 101 } |
| 100 | 102 |
| 101 // Ensure that creating a plugin in a cross-site subframe doesn't crash. This | 103 // Ensure that creating a plugin in a cross-site subframe doesn't crash. This |
| 102 // involves querying content settings from the renderer process and using the | 104 // involves querying content settings from the renderer process and using the |
| 103 // top frame's origin as one of the parameters. See https://crbug.com/426658. | 105 // top frame's origin as one of the parameters. See https://crbug.com/426658. |
| 104 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, PluginWithRemoteTopFrame) { | 106 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessTest, PluginWithRemoteTopFrame) { |
| 105 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html")); | 107 // Serve from the root so that flash_object.html can load the swf file. |
| 108 base::FilePath test_data_dir; |
| 109 CHECK(base::PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); |
| 110 embedded_test_server()->ServeFilesFromDirectory(test_data_dir); |
| 111 |
| 112 GURL main_url( |
| 113 embedded_test_server()->GetURL("a.com", "/chrome/test/data/iframe.html")); |
| 106 ui_test_utils::NavigateToURL(browser(), main_url); | 114 ui_test_utils::NavigateToURL(browser(), main_url); |
| 107 | 115 |
| 108 // Navigate subframe to a page with a Flash object. | 116 // Navigate subframe to a page with a Flash object. |
| 109 content::WebContents* active_web_contents = | 117 content::WebContents* active_web_contents = |
| 110 browser()->tab_strip_model()->GetActiveWebContents(); | 118 browser()->tab_strip_model()->GetActiveWebContents(); |
| 111 GURL frame_url = | 119 GURL frame_url = |
| 112 embedded_test_server()->GetURL("b.com", "/flash_object.html"); | 120 embedded_test_server()->GetURL("b.com", |
| 113 content::DOMMessageQueue msg_queue; | 121 "/chrome/test/data/flash_object.html"); |
| 114 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url)); | |
| 115 | 122 |
| 116 // Ensure the page finishes loading without crashing. | 123 // Ensure the page finishes loading without crashing. |
| 117 std::string status; | 124 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url)); |
| 118 while (msg_queue.WaitForMessage(&status)) { | |
| 119 if (status == "\"DONE\"") | |
| 120 break; | |
| 121 } | |
| 122 } | 125 } |
| OLD | NEW |