OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/frame_host/render_frame_host_impl.h" | 5 #include "content/browser/frame_host/render_frame_host_impl.h" |
6 #include "content/public/browser/render_frame_host.h" | 6 #include "content/public/browser/render_frame_host.h" |
7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
8 #include "content/public/common/content_client.h" | 8 #include "content/public/common/content_client.h" |
9 #include "content/public/test/content_browser_test.h" | 9 #include "content/public/test/content_browser_test.h" |
10 #include "content/public/test/content_browser_test_utils.h" | 10 #include "content/public/test/content_browser_test_utils.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, IsFocused_AtLoad) { | 58 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, IsFocused_AtLoad) { |
59 EXPECT_TRUE( | 59 EXPECT_TRUE( |
60 NavigateToURL(shell(), GetTestUrl("render_frame_host", "focus.html"))); | 60 NavigateToURL(shell(), GetTestUrl("render_frame_host", "focus.html"))); |
61 | 61 |
62 // The main frame should be focused. | 62 // The main frame should be focused. |
63 WebContents* web_contents = shell()->web_contents(); | 63 WebContents* web_contents = shell()->web_contents(); |
64 EXPECT_TRUE(ToRFHI(web_contents->GetMainFrame())->IsFocused()); | 64 EXPECT_TRUE(ToRFHI(web_contents->GetMainFrame())->IsFocused()); |
65 } | 65 } |
66 | 66 |
67 // Test that if the content changes the focused frame, it is correctly exposed. | 67 // Test that if the content changes the focused frame, it is correctly exposed. |
68 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, IsFocused_Change) { | 68 // Disabled to to flaky failures: crbug.com/452631 |
| 69 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, |
| 70 DISABLED_IsFocused_Change) { |
69 EXPECT_TRUE( | 71 EXPECT_TRUE( |
70 NavigateToURL(shell(), GetTestUrl("render_frame_host", "focus.html"))); | 72 NavigateToURL(shell(), GetTestUrl("render_frame_host", "focus.html"))); |
71 | 73 |
72 WebContents* web_contents = shell()->web_contents(); | 74 WebContents* web_contents = shell()->web_contents(); |
73 | 75 |
74 std::string frames[2] = { "frame1", "frame2" }; | 76 std::string frames[2] = { "frame1", "frame2" }; |
75 for (const std::string& frame : frames) { | 77 for (const std::string& frame : frames) { |
76 ExecuteScriptAndGetValue( | 78 ExecuteScriptAndGetValue( |
77 web_contents->GetMainFrame(), "focus" + frame + "()"); | 79 web_contents->GetMainFrame(), "focus" + frame + "()"); |
78 | 80 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 web_contents->GetMainFrame()->GetVisibilityState()); | 140 web_contents->GetMainFrame()->GetVisibilityState()); |
139 | 141 |
140 new_client.EnableVisibilityOverride(blink::WebPageVisibilityStatePrerender); | 142 new_client.EnableVisibilityOverride(blink::WebPageVisibilityStatePrerender); |
141 EXPECT_EQ(blink::WebPageVisibilityStatePrerender, | 143 EXPECT_EQ(blink::WebPageVisibilityStatePrerender, |
142 web_contents->GetMainFrame()->GetVisibilityState()); | 144 web_contents->GetMainFrame()->GetVisibilityState()); |
143 | 145 |
144 SetBrowserClientForTesting(old_client); | 146 SetBrowserClientForTesting(old_client); |
145 } | 147 } |
146 | 148 |
147 } // namespace content | 149 } // namespace content |
OLD | NEW |