Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(296)

Side by Side Diff: content/browser/frame_host/render_frame_host_impl_browsertest.cc

Issue 1743143002: Remove WebContents::Was{Hidden,Shown}() from the content public interface Base URL: https://chromium.googlesource.com/chromium/src.git@20160225-WebContents-DicardCursorRects
Patch Set: Fix androido Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "content/browser/web_contents/web_contents_impl.h" 8 #include "content/browser/web_contents/web_contents_impl.h"
9 #include "content/public/browser/render_frame_host.h" 9 #include "content/public/browser/render_frame_host.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 ExecuteScriptAndGetValue(web_contents->GetMainFrame(), "detachframe(2)"); 118 ExecuteScriptAndGetValue(web_contents->GetMainFrame(), "detachframe(2)");
119 EXPECT_EQ(nullptr, web_contents->GetFocusedFrame()); 119 EXPECT_EQ(nullptr, web_contents->GetFocusedFrame());
120 EXPECT_EQ(-1, web_contents->GetFrameTree()->focused_frame_tree_node_id_); 120 EXPECT_EQ(-1, web_contents->GetFrameTree()->focused_frame_tree_node_id_);
121 } 121 }
122 122
123 // Test that a frame is visible/hidden depending on its WebContents visibility 123 // Test that a frame is visible/hidden depending on its WebContents visibility
124 // state. 124 // state.
125 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, 125 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
126 GetVisibilityState_Basic) { 126 GetVisibilityState_Basic) {
127 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,foo"))); 127 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,foo")));
128 WebContents* web_contents = shell()->web_contents(); 128 WebContentsImpl* web_contents =
129 static_cast<WebContentsImpl*>(shell()->web_contents());
129 130
130 web_contents->WasShown(); 131 web_contents->WasShown();
131 EXPECT_EQ(blink::WebPageVisibilityStateVisible, 132 EXPECT_EQ(blink::WebPageVisibilityStateVisible,
132 web_contents->GetMainFrame()->GetVisibilityState()); 133 web_contents->GetMainFrame()->GetVisibilityState());
133 134
134 web_contents->WasHidden(); 135 web_contents->WasHidden();
135 EXPECT_EQ(blink::WebPageVisibilityStateHidden, 136 EXPECT_EQ(blink::WebPageVisibilityStateHidden,
136 web_contents->GetMainFrame()->GetVisibilityState()); 137 web_contents->GetMainFrame()->GetVisibilityState());
137 } 138 }
138 139
139 // Test that a frame visibility can be overridden by the ContentBrowserClient. 140 // Test that a frame visibility can be overridden by the ContentBrowserClient.
140 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest, 141 IN_PROC_BROWSER_TEST_F(RenderFrameHostImplBrowserTest,
141 GetVisibilityState_Override) { 142 GetVisibilityState_Override) {
142 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,foo"))); 143 EXPECT_TRUE(NavigateToURL(shell(), GURL("data:text/html,foo")));
143 WebContents* web_contents = shell()->web_contents(); 144 WebContentsImpl* web_contents =
145 static_cast<WebContentsImpl*>(shell()->web_contents());
144 146
145 PrerenderTestContentBrowserClient new_client; 147 PrerenderTestContentBrowserClient new_client;
146 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client); 148 ContentBrowserClient* old_client = SetBrowserClientForTesting(&new_client);
147 149
148 web_contents->WasShown(); 150 web_contents->WasShown();
149 EXPECT_EQ(blink::WebPageVisibilityStateVisible, 151 EXPECT_EQ(blink::WebPageVisibilityStateVisible,
150 web_contents->GetMainFrame()->GetVisibilityState()); 152 web_contents->GetMainFrame()->GetVisibilityState());
151 153
152 new_client.EnableVisibilityOverride(blink::WebPageVisibilityStatePrerender); 154 new_client.EnableVisibilityOverride(blink::WebPageVisibilityStatePrerender);
153 EXPECT_EQ(blink::WebPageVisibilityStatePrerender, 155 EXPECT_EQ(blink::WebPageVisibilityStatePrerender,
154 web_contents->GetMainFrame()->GetVisibilityState()); 156 web_contents->GetMainFrame()->GetVisibilityState());
155 157
156 SetBrowserClientForTesting(old_client); 158 SetBrowserClientForTesting(old_client);
157 } 159 }
158 160
159 } // namespace content 161 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698