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

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

Issue 2388753003: Introduce cc::LocalFrameId and use in SurfaceFactory (Closed)
Patch Set: Fix exo_unittests Created 4 years, 2 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 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 "content/browser/frame_host/render_widget_host_view_guest.h" 5 #include "content/browser/frame_host/render_widget_host_view_guest.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // loop here. 205 // loop here.
206 base::RunLoop().RunUntilIdle(); 206 base::RunLoop().RunUntilIdle();
207 #if !defined(OS_ANDROID) 207 #if !defined(OS_ANDROID)
208 ImageTransportFactory::Terminate(); 208 ImageTransportFactory::Terminate();
209 #else 209 #else
210 ui::ContextProviderFactory::SetInstance(nullptr); 210 ui::ContextProviderFactory::SetInstance(nullptr);
211 ContextProviderFactoryImpl::Terminate(); 211 ContextProviderFactoryImpl::Terminate();
212 #endif 212 #endif
213 } 213 }
214 214
215 cc::SurfaceId surface_id() { 215 cc::SurfaceId GetSurfaceId() const {
216 DCHECK(view_); 216 DCHECK(view_);
217 return static_cast<RenderWidgetHostViewChildFrame*>(view_)->surface_id_; 217 RenderWidgetHostViewChildFrame* rwhvcf =
218 static_cast<RenderWidgetHostViewChildFrame*>(view_);
219 if (rwhvcf->local_frame_id_.is_null())
220 return cc::SurfaceId();
221 return cc::SurfaceId(rwhvcf->frame_sink_id_, rwhvcf->local_frame_id_);
218 } 222 }
219 223
220 protected: 224 protected:
221 TestBrowserThreadBundle thread_bundle_; 225 TestBrowserThreadBundle thread_bundle_;
222 std::unique_ptr<BrowserContext> browser_context_; 226 std::unique_ptr<BrowserContext> browser_context_;
223 MockRenderWidgetHostDelegate delegate_; 227 MockRenderWidgetHostDelegate delegate_;
224 BrowserPluginGuestDelegate browser_plugin_guest_delegate_; 228 BrowserPluginGuestDelegate browser_plugin_guest_delegate_;
225 std::unique_ptr<TestWebContents> web_contents_; 229 std::unique_ptr<TestWebContents> web_contents_;
226 TestBrowserPluginGuest* browser_plugin_guest_; 230 TestBrowserPluginGuest* browser_plugin_guest_;
227 231
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 265
262 ASSERT_TRUE(browser_plugin_guest_); 266 ASSERT_TRUE(browser_plugin_guest_);
263 267
264 view_->SetSize(view_size); 268 view_->SetSize(view_size);
265 view_->Show(); 269 view_->Show();
266 270
267 browser_plugin_guest_->set_attached(true); 271 browser_plugin_guest_->set_attached(true);
268 view_->OnSwapCompositorFrame( 272 view_->OnSwapCompositorFrame(
269 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); 273 0, CreateDelegatedFrame(scale_factor, view_size, view_rect));
270 274
271 cc::SurfaceId id = surface_id(); 275 cc::SurfaceId id = GetSurfaceId();
272 if (!id.is_null()) { 276 if (!id.is_null()) {
273 #if !defined(OS_ANDROID) 277 #if !defined(OS_ANDROID)
274 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 278 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
275 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 279 cc::SurfaceManager* manager = factory->GetSurfaceManager();
276 cc::Surface* surface = manager->GetSurfaceForId(id); 280 cc::Surface* surface = manager->GetSurfaceForId(id);
277 EXPECT_TRUE(surface); 281 EXPECT_TRUE(surface);
278 // There should be a SurfaceSequence created by the RWHVGuest. 282 // There should be a SurfaceSequence created by the RWHVGuest.
279 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); 283 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
280 #endif 284 #endif
281 // Surface ID should have been passed to BrowserPluginGuest to 285 // Surface ID should have been passed to BrowserPluginGuest to
282 // be sent to the embedding renderer. 286 // be sent to the embedding renderer.
283 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); 287 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_);
284 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); 288 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_);
285 EXPECT_EQ(scale_factor, browser_plugin_guest_->last_scale_factor_received_); 289 EXPECT_EQ(scale_factor, browser_plugin_guest_->last_scale_factor_received_);
286 } 290 }
287 291
288 browser_plugin_guest_->ResetTestData(); 292 browser_plugin_guest_->ResetTestData();
289 browser_plugin_guest_->set_has_attached_since_surface_set(true); 293 browser_plugin_guest_->set_has_attached_since_surface_set(true);
290 294
291 view_->OnSwapCompositorFrame( 295 view_->OnSwapCompositorFrame(
292 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); 296 0, CreateDelegatedFrame(scale_factor, view_size, view_rect));
293 297
294 id = surface_id(); 298 id = GetSurfaceId();
295 if (!id.is_null()) { 299 if (!id.is_null()) {
296 #if !defined(OS_ANDROID) 300 #if !defined(OS_ANDROID)
297 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 301 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
298 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 302 cc::SurfaceManager* manager = factory->GetSurfaceManager();
299 cc::Surface* surface = manager->GetSurfaceForId(id); 303 cc::Surface* surface = manager->GetSurfaceForId(id);
300 EXPECT_TRUE(surface); 304 EXPECT_TRUE(surface);
301 // There should be a SurfaceSequence created by the RWHVGuest. 305 // There should be a SurfaceSequence created by the RWHVGuest.
302 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); 306 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
303 #endif 307 #endif
304 // Surface ID should have been passed to BrowserPluginGuest to 308 // Surface ID should have been passed to BrowserPluginGuest to
305 // be sent to the embedding renderer. 309 // be sent to the embedding renderer.
306 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); 310 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_);
307 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); 311 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_);
308 EXPECT_EQ(scale_factor, 312 EXPECT_EQ(scale_factor,
309 browser_plugin_guest_->last_scale_factor_received_); 313 browser_plugin_guest_->last_scale_factor_received_);
310 } 314 }
311 315
312 browser_plugin_guest_->set_attached(false); 316 browser_plugin_guest_->set_attached(false);
313 browser_plugin_guest_->ResetTestData(); 317 browser_plugin_guest_->ResetTestData();
314 318
315 view_->OnSwapCompositorFrame( 319 view_->OnSwapCompositorFrame(
316 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); 320 0, CreateDelegatedFrame(scale_factor, view_size, view_rect));
317 EXPECT_TRUE(surface_id().is_null()); 321 EXPECT_TRUE(GetSurfaceId().is_null());
318 } 322 }
319 323
320 } // namespace content 324 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698