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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura_unittest.cc

Issue 2457163003: [M55] Generalize layer mirroring for phantom windows (Closed)
Patch Set: Created 4 years, 1 month 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <tuple> 10 #include <tuple>
(...skipping 1837 matching lines...) Expand 10 before | Expand all | Expand 10 after
1848 1848
1849 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, 1849 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_,
1850 gfx::Rect(5, 5, 5, 5))); 1850 gfx::Rect(5, 5, 5, 5)));
1851 view_->OnSwapCompositorFrame( 1851 view_->OnSwapCompositorFrame(
1852 0, MakeDelegatedFrame(1.f, view_size, gfx::Rect(5, 5, 5, 5))); 1852 0, MakeDelegatedFrame(1.f, view_size, gfx::Rect(5, 5, 5, 5)));
1853 testing::Mock::VerifyAndClearExpectations(&observer); 1853 testing::Mock::VerifyAndClearExpectations(&observer);
1854 1854
1855 view_->window_->RemoveObserver(&observer); 1855 view_->window_->RemoveObserver(&observer);
1856 } 1856 }
1857 1857
1858 // Recreating the layers for a window should cause Surface destruction to 1858 // Mirroring the layers for a window should cause Surface destruction to
1859 // depend on both layers. 1859 // depend on both layers.
1860 TEST_F(RenderWidgetHostViewAuraTest, RecreateLayers) { 1860 TEST_F(RenderWidgetHostViewAuraTest, MirrorLayers) {
1861 gfx::Size view_size(100, 100); 1861 gfx::Size view_size(100, 100);
1862 gfx::Rect view_rect(view_size); 1862 gfx::Rect view_rect(view_size);
1863 aura::Window* const root = parent_view_->GetNativeView()->GetRootWindow();
1863 1864
1864 view_->InitAsChild(nullptr); 1865 view_->InitAsChild(nullptr);
1865 aura::client::ParentWindowWithContext( 1866 aura::client::ParentWindowWithContext(
1866 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1867 view_->GetNativeView(), root, gfx::Rect());
1867 gfx::Rect());
1868 view_->SetSize(view_size); 1868 view_->SetSize(view_size);
1869 view_->Show(); 1869 view_->Show();
1870 1870
1871 view_->OnSwapCompositorFrame(0, 1871 view_->OnSwapCompositorFrame(0,
1872 MakeDelegatedFrame(1.f, view_size, view_rect)); 1872 MakeDelegatedFrame(1.f, view_size, view_rect));
1873 std::unique_ptr<ui::LayerTreeOwner> cloned_owner( 1873 std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers(
1874 wm::RecreateLayers(view_->GetNativeView(), nullptr)); 1874 view_->GetNativeView(), false /* sync_bounds */));
1875 1875
1876 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); 1876 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
1877 if (!id.is_null()) { 1877 if (!id.is_null()) {
1878 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1878 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1879 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1879 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1880 cc::Surface* surface = manager->GetSurfaceForId(id); 1880 cc::Surface* surface = manager->GetSurfaceForId(id);
1881 EXPECT_TRUE(surface); 1881 EXPECT_TRUE(surface);
1882 // Should be a SurfaceSequence for both the original and new layers. 1882
1883 // An orphaned mirror should not be a destruction dependency.
1884 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
1885
1886 // Both layers should be destruction dependencies.
1887 root->layer()->Add(mirror->root());
1883 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); 1888 EXPECT_EQ(2u, surface->GetDestructionDependencyCount());
1889 root->layer()->Remove(mirror->root());
1884 } 1890 }
1885 } 1891 }
1886 1892
1887 // If the view size is larger than the compositor frame then extra layers 1893 // If the view size is larger than the compositor frame then extra layers
1888 // should be created to fill the gap. 1894 // should be created to fill the gap.
1889 TEST_F(RenderWidgetHostViewAuraTest, DelegatedFrameGutter) { 1895 TEST_F(RenderWidgetHostViewAuraTest, DelegatedFrameGutter) {
1890 gfx::Size large_size(100, 100); 1896 gfx::Size large_size(100, 100);
1891 gfx::Size small_size(40, 45); 1897 gfx::Size small_size(40, 45);
1892 gfx::Size medium_size(40, 95); 1898 gfx::Size medium_size(40, 95);
1893 1899
(...skipping 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after
4623 4629
4624 // Retrieve the selected text from clipboard and verify it is as expected. 4630 // Retrieve the selected text from clipboard and verify it is as expected.
4625 base::string16 result_text; 4631 base::string16 result_text;
4626 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4632 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4627 EXPECT_EQ(expected_text, result_text); 4633 EXPECT_EQ(expected_text, result_text);
4628 } 4634 }
4629 } 4635 }
4630 #endif 4636 #endif
4631 4637
4632 } // namespace content 4638 } // namespace content
OLDNEW
« 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