| 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" | 6 #include "base/files/file_path.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html")); | 63 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html")); |
| 64 ui_test_utils::NavigateToURL(browser(), main_url); | 64 ui_test_utils::NavigateToURL(browser(), main_url); |
| 65 | 65 |
| 66 // Navigate subframe cross-site. | 66 // Navigate subframe cross-site. |
| 67 content::WebContents* active_web_contents = | 67 content::WebContents* active_web_contents = |
| 68 browser()->tab_strip_model()->GetActiveWebContents(); | 68 browser()->tab_strip_model()->GetActiveWebContents(); |
| 69 GURL cross_site_url(embedded_test_server()->GetURL("b.com", "/title2.html")); | 69 GURL cross_site_url(embedded_test_server()->GetURL("b.com", "/title2.html")); |
| 70 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", cross_site_url)); | 70 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", cross_site_url)); |
| 71 | 71 |
| 72 // Find the subframe's RenderFrameHost. | 72 // Find the subframe's RenderFrameHost. |
| 73 content::RenderFrameHost* frame_host = FrameMatchingPredicate( | 73 content::RenderFrameHost* frame_host = |
| 74 active_web_contents, | 74 ChildFrameAt(active_web_contents->GetMainFrame(), 0); |
| 75 base::Bind(&content::FrameHasSourceUrl, cross_site_url)); | |
| 76 ASSERT_TRUE(frame_host); | 75 ASSERT_TRUE(frame_host); |
| 76 EXPECT_EQ(cross_site_url, frame_host->GetLastCommittedURL()); |
| 77 EXPECT_TRUE(frame_host->IsCrossProcessSubframe()); | 77 EXPECT_TRUE(frame_host->IsCrossProcessSubframe()); |
| 78 | 78 |
| 79 // Check that JS storage APIs can be accessed successfully. | 79 // Check that JS storage APIs can be accessed successfully. |
| 80 EXPECT_TRUE( | 80 EXPECT_TRUE( |
| 81 content::ExecuteScript(frame_host, "localStorage['foo'] = 'bar'")); | 81 content::ExecuteScript(frame_host, "localStorage['foo'] = 'bar'")); |
| 82 std::string result; | 82 std::string result; |
| 83 EXPECT_TRUE(ExecuteScriptAndExtractString( | 83 EXPECT_TRUE(ExecuteScriptAndExtractString( |
| 84 frame_host, "window.domAutomationController.send(localStorage['foo']);", | 84 frame_host, "window.domAutomationController.send(localStorage['foo']);", |
| 85 &result)); | 85 &result)); |
| 86 EXPECT_EQ(result, "bar"); | 86 EXPECT_EQ(result, "bar"); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 main_lost_focus = true; | 171 main_lost_focus = true; |
| 172 if (status == "\"popup-got-focus\"") | 172 if (status == "\"popup-got-focus\"") |
| 173 popup_got_focus = true; | 173 popup_got_focus = true; |
| 174 if (main_lost_focus && popup_got_focus) | 174 if (main_lost_focus && popup_got_focus) |
| 175 break; | 175 break; |
| 176 } | 176 } |
| 177 | 177 |
| 178 // The popup should be focused now. | 178 // The popup should be focused now. |
| 179 EXPECT_EQ(popup, browser()->tab_strip_model()->GetActiveWebContents()); | 179 EXPECT_EQ(popup, browser()->tab_strip_model()->GetActiveWebContents()); |
| 180 } | 180 } |
| OLD | NEW |