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

Unified Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2383263002: Generalize layer mirroring for phantom windows (Closed)
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
index 2b1f615b7397c6f5040f1afae24218422d26867f..9c38a750e729b96a3018e770741c06434c08bc60 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc
@@ -1894,23 +1894,23 @@ TEST_F(RenderWidgetHostViewAuraTest, SwapNotifiesWindow) {
view_->window_->RemoveObserver(&observer);
}
-// Recreating the layers for a window should cause Surface destruction to
+// Mirroring the layers for a window should cause Surface destruction to
// depend on both layers.
-TEST_F(RenderWidgetHostViewAuraTest, RecreateLayers) {
+TEST_F(RenderWidgetHostViewAuraTest, MirrorLayers) {
gfx::Size view_size(100, 100);
gfx::Rect view_rect(view_size);
+ aura::Window* const root = parent_view_->GetNativeView()->GetRootWindow();
view_->InitAsChild(nullptr);
aura::client::ParentWindowWithContext(
- view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
- gfx::Rect());
+ view_->GetNativeView(), root, gfx::Rect());
view_->SetSize(view_size);
view_->Show();
view_->OnSwapCompositorFrame(0,
MakeDelegatedFrame(1.f, view_size, view_rect));
- std::unique_ptr<ui::LayerTreeOwner> cloned_owner(
- wm::RecreateLayers(view_->GetNativeView(), nullptr));
+ std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers(
+ view_->GetNativeView(), false /* sync_bounds */));
cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
if (!id.is_null()) {
@@ -1918,8 +1918,14 @@ TEST_F(RenderWidgetHostViewAuraTest, RecreateLayers) {
cc::SurfaceManager* manager = factory->GetSurfaceManager();
cc::Surface* surface = manager->GetSurfaceForId(id);
EXPECT_TRUE(surface);
- // Should be a SurfaceSequence for both the original and new layers.
+
+ // An orphaned mirror should not be a destruction dependency.
+ EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
+
+ // Both layers should be destruction dependencies.
+ root->layer()->Add(mirror->root());
EXPECT_EQ(2u, surface->GetDestructionDependencyCount());
+ root->layer()->Remove(mirror->root());
}
}
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.cc ('k') | ui/arc/notification/arc_custom_notification_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698