| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 #if defined(OS_MACOSX) | 108 #if defined(OS_MACOSX) |
| 109 EXPECT_TRUE(ToRFHI(web_contents->GetMainFrame())->IsFocused()); | 109 EXPECT_TRUE(ToRFHI(web_contents->GetMainFrame())->IsFocused()); |
| 110 #else | 110 #else |
| 111 EXPECT_FALSE(ToRFHI(web_contents->GetMainFrame())->IsFocused()); | 111 EXPECT_FALSE(ToRFHI(web_contents->GetMainFrame())->IsFocused()); |
| 112 #endif | 112 #endif |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Test that a frame is visible/hidden depending on its WebContents visibility | 115 // Test that a frame is visible/hidden depending on its WebContents visibility |
| 116 // state. | 116 // state. |
| 117 // Flaky on Mac. http://crbug.com/467670 |
| 118 #if defined(OS_MACOSX) |
| 119 #define MAYBE_GetVisibilityState_Basic DISABLED_GetVisibilityState_Basic |
| 120 #else |
| 121 #define MAYBE_GetVisibilityState_Basic GetVisibilityState_Basic |
| 122 #endif |
| 117 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, | 123 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, |
| 118 GetVisibilityState_Basic) { | 124 MAYBE_GetVisibilityState_Basic) { |
| 119 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,foo"))); | 125 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,foo"))); |
| 120 WebContents* web_contents = shell()->web_contents(); | 126 WebContents* web_contents = shell()->web_contents(); |
| 121 | 127 |
| 122 EXPECT_EQ(blink::WebPageVisibilityStateVisible, | 128 EXPECT_EQ(blink::WebPageVisibilityStateVisible, |
| 123 web_contents->GetMainFrame()->GetVisibilityState()); | 129 web_contents->GetMainFrame()->GetVisibilityState()); |
| 124 | 130 |
| 125 web_contents->WasHidden(); | 131 web_contents->WasHidden(); |
| 126 EXPECT_EQ(blink::WebPageVisibilityStateHidden, | 132 EXPECT_EQ(blink::WebPageVisibilityStateHidden, |
| 127 web_contents->GetMainFrame()->GetVisibilityState()); | 133 web_contents->GetMainFrame()->GetVisibilityState()); |
| 128 } | 134 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 140 web_contents->GetMainFrame()->GetVisibilityState()); | 146 web_contents->GetMainFrame()->GetVisibilityState()); |
| 141 | 147 |
| 142 new_client.EnableVisibilityOverride(blink::WebPageVisibilityStatePrerender); | 148 new_client.EnableVisibilityOverride(blink::WebPageVisibilityStatePrerender); |
| 143 EXPECT_EQ(blink::WebPageVisibilityStatePrerender, | 149 EXPECT_EQ(blink::WebPageVisibilityStatePrerender, |
| 144 web_contents->GetMainFrame()->GetVisibilityState()); | 150 web_contents->GetMainFrame()->GetVisibilityState()); |
| 145 | 151 |
| 146 SetBrowserClientForTesting(old_client); | 152 SetBrowserClientForTesting(old_client); |
| 147 } | 153 } |
| 148 | 154 |
| 149 } // namespace content | 155 } // namespace content |
| OLD | NEW |