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

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

Issue 2144733005: [WIP] cc: Plumb SurfaceId from clients Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ensure only SurfaceFactoy and tests can update hierarchy Created 4 years, 5 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 gfx::Rect view_rect(view_size); 232 gfx::Rect view_rect(view_size);
233 float scale_factor = 1.f; 233 float scale_factor = 1.f;
234 234
235 ASSERT_TRUE(browser_plugin_guest_); 235 ASSERT_TRUE(browser_plugin_guest_);
236 236
237 view_->SetSize(view_size); 237 view_->SetSize(view_size);
238 view_->Show(); 238 view_->Show();
239 239
240 browser_plugin_guest_->set_attached(true); 240 browser_plugin_guest_->set_attached(true);
241 view_->OnSwapCompositorFrame( 241 view_->OnSwapCompositorFrame(
242 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); 242 0, cc::SurfaceId(),
243 CreateDelegatedFrame(scale_factor, view_size, view_rect));
243 244
244 cc::SurfaceId id = surface_id(); 245 cc::SurfaceId id = surface_id();
245 if (!id.is_null()) { 246 if (!id.is_null()) {
246 #if !defined(OS_ANDROID) 247 #if !defined(OS_ANDROID)
247 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 248 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
248 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 249 cc::SurfaceManager* manager = factory->GetSurfaceManager();
249 cc::Surface* surface = manager->GetSurfaceForId(id); 250 cc::Surface* surface = manager->GetSurfaceForId(id);
250 EXPECT_TRUE(surface); 251 EXPECT_TRUE(surface);
251 // There should be a SurfaceSequence created by the RWHVGuest. 252 // There should be a SurfaceSequence created by the RWHVGuest.
252 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); 253 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
253 #endif 254 #endif
254 // Surface ID should have been passed to BrowserPluginGuest to 255 // Surface ID should have been passed to BrowserPluginGuest to
255 // be sent to the embedding renderer. 256 // be sent to the embedding renderer.
256 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); 257 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_);
257 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); 258 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_);
258 EXPECT_EQ(scale_factor, browser_plugin_guest_->last_scale_factor_received_); 259 EXPECT_EQ(scale_factor, browser_plugin_guest_->last_scale_factor_received_);
259 } 260 }
260 261
261 browser_plugin_guest_->ResetTestData(); 262 browser_plugin_guest_->ResetTestData();
262 browser_plugin_guest_->set_has_attached_since_surface_set(true); 263 browser_plugin_guest_->set_has_attached_since_surface_set(true);
263 264
264 view_->OnSwapCompositorFrame( 265 view_->OnSwapCompositorFrame(
265 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); 266 0, cc::SurfaceId(),
267 CreateDelegatedFrame(scale_factor, view_size, view_rect));
266 268
267 id = surface_id(); 269 id = surface_id();
268 if (!id.is_null()) { 270 if (!id.is_null()) {
269 #if !defined(OS_ANDROID) 271 #if !defined(OS_ANDROID)
270 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 272 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
271 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 273 cc::SurfaceManager* manager = factory->GetSurfaceManager();
272 cc::Surface* surface = manager->GetSurfaceForId(id); 274 cc::Surface* surface = manager->GetSurfaceForId(id);
273 EXPECT_TRUE(surface); 275 EXPECT_TRUE(surface);
274 // There should be a SurfaceSequence created by the RWHVGuest. 276 // There should be a SurfaceSequence created by the RWHVGuest.
275 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); 277 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
276 #endif 278 #endif
277 // Surface ID should have been passed to BrowserPluginGuest to 279 // Surface ID should have been passed to BrowserPluginGuest to
278 // be sent to the embedding renderer. 280 // be sent to the embedding renderer.
279 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_); 281 EXPECT_EQ(id, browser_plugin_guest_->last_surface_id_received_);
280 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_); 282 EXPECT_EQ(view_size, browser_plugin_guest_->last_frame_size_received_);
281 EXPECT_EQ(scale_factor, 283 EXPECT_EQ(scale_factor,
282 browser_plugin_guest_->last_scale_factor_received_); 284 browser_plugin_guest_->last_scale_factor_received_);
283 } 285 }
284 286
285 browser_plugin_guest_->set_attached(false); 287 browser_plugin_guest_->set_attached(false);
286 browser_plugin_guest_->ResetTestData(); 288 browser_plugin_guest_->ResetTestData();
287 289
288 view_->OnSwapCompositorFrame( 290 view_->OnSwapCompositorFrame(
289 0, CreateDelegatedFrame(scale_factor, view_size, view_rect)); 291 0, cc::SurfaceId(),
292 CreateDelegatedFrame(scale_factor, view_size, view_rect));
290 EXPECT_TRUE(surface_id().is_null()); 293 EXPECT_TRUE(surface_id().is_null());
291 } 294 }
292 295
293 } // namespace content 296 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_widget_host_view_guest.cc ('k') | content/browser/renderer_host/delegated_frame_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698