| Index: content/browser/frame_host/render_widget_host_view_guest_unittest.cc
|
| diff --git a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
|
| index c0ef500a2421eb7cb256fbd5c8c764857c16e42c..a7c5e79a8ec48b031926116637a542676acb6aa3 100644
|
| --- a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
|
| +++ b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc
|
| @@ -240,21 +240,22 @@ TEST_F(RenderWidgetHostViewGuestSurfaceTest, TestGuestSurface) {
|
| 0, CreateDelegatedFrame(scale_factor, view_size, view_rect));
|
|
|
| cc::SurfaceId id = GetSurfaceId();
|
| - if (id.is_valid()) {
|
| +
|
| + EXPECT_TRUE(id.is_valid());
|
| +
|
| #if !defined(OS_ANDROID)
|
| - ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
|
| - cc::SurfaceManager* manager =
|
| - factory->GetContextFactoryPrivate()->GetSurfaceManager();
|
| - cc::Surface* surface = manager->GetSurfaceForId(id);
|
| - EXPECT_TRUE(surface);
|
| - // There should be a SurfaceSequence created by the RWHVGuest.
|
| - EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
|
| + cc::SurfaceManager* manager = ImageTransportFactory::GetInstance()
|
| + ->GetContextFactoryPrivate()
|
| + ->GetSurfaceManager();
|
| + cc::Surface* surface = manager->GetSurfaceForId(id);
|
| + EXPECT_TRUE(surface);
|
| + // There should be a SurfaceSequence created by the RWHVGuest.
|
| + EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
|
| #endif
|
| - // Surface ID should have been passed to BrowserPluginGuest to
|
| - // be sent to the embedding renderer.
|
| - EXPECT_EQ(cc::SurfaceInfo(id, scale_factor, view_size),
|
| - browser_plugin_guest_->last_surface_info_);
|
| - }
|
| + // Surface ID should have been passed to BrowserPluginGuest to
|
| + // be sent to the embedding renderer.
|
| + EXPECT_EQ(cc::SurfaceInfo(id, scale_factor, view_size),
|
| + browser_plugin_guest_->last_surface_info_);
|
|
|
| browser_plugin_guest_->ResetTestData();
|
| browser_plugin_guest_->set_has_attached_since_surface_set(true);
|
| @@ -262,29 +263,31 @@ TEST_F(RenderWidgetHostViewGuestSurfaceTest, TestGuestSurface) {
|
| view_->OnSwapCompositorFrame(
|
| 0, CreateDelegatedFrame(scale_factor, view_size, view_rect));
|
|
|
| - id = GetSurfaceId();
|
| - if (id.is_valid()) {
|
| + // Since we have not changed the frame size and scale factor, the same surface
|
| + // id must be used.
|
| + DCHECK_EQ(id, GetSurfaceId());
|
| +
|
| #if !defined(OS_ANDROID)
|
| - ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
|
| - cc::SurfaceManager* manager =
|
| - factory->GetContextFactoryPrivate()->GetSurfaceManager();
|
| - cc::Surface* surface = manager->GetSurfaceForId(id);
|
| - EXPECT_TRUE(surface);
|
| - // There should be a SurfaceSequence created by the RWHVGuest.
|
| - EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
|
| + surface = manager->GetSurfaceForId(id);
|
| + EXPECT_TRUE(surface);
|
| + // Another SurfaceSequence should be created by the RWHVGuest when sending
|
| + // SurfaceInfo to the embedder.
|
| + EXPECT_EQ(2u, surface->GetDestructionDependencyCount());
|
| #endif
|
| - // Surface ID should have been passed to BrowserPluginGuest to
|
| - // be sent to the embedding renderer.
|
| - EXPECT_EQ(cc::SurfaceInfo(id, scale_factor, view_size),
|
| - browser_plugin_guest_->last_surface_info_);
|
| - }
|
| + // Surface ID should have been passed to BrowserPluginGuest to
|
| + // be sent to the embedding renderer.
|
| + EXPECT_EQ(cc::SurfaceInfo(id, scale_factor, view_size),
|
| + browser_plugin_guest_->last_surface_info_);
|
|
|
| browser_plugin_guest_->set_attached(false);
|
| browser_plugin_guest_->ResetTestData();
|
|
|
| view_->OnSwapCompositorFrame(
|
| 0, CreateDelegatedFrame(scale_factor, view_size, view_rect));
|
| - EXPECT_FALSE(GetSurfaceId().is_valid());
|
| +
|
| + // Since guest is not attached, the CompositorFrame must be processed but the
|
| + // frame must be evicted to return the resources immediately.
|
| + EXPECT_FALSE(view_->has_frame());
|
| }
|
|
|
| } // namespace content
|
|
|