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

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

Issue 2383263002: Generalize layer mirroring for phantom windows (Closed)
Patch Set: Fix another test and update comment 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 (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 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 1881
1882 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, 1882 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_,
1883 gfx::Rect(5, 5, 5, 5))); 1883 gfx::Rect(5, 5, 5, 5)));
1884 view_->OnSwapCompositorFrame( 1884 view_->OnSwapCompositorFrame(
1885 0, MakeDelegatedFrame(1.f, view_size, gfx::Rect(5, 5, 5, 5))); 1885 0, MakeDelegatedFrame(1.f, view_size, gfx::Rect(5, 5, 5, 5)));
1886 testing::Mock::VerifyAndClearExpectations(&observer); 1886 testing::Mock::VerifyAndClearExpectations(&observer);
1887 1887
1888 view_->window_->RemoveObserver(&observer); 1888 view_->window_->RemoveObserver(&observer);
1889 } 1889 }
1890 1890
1891 // Recreating the layers for a window should cause Surface destruction to 1891 // Mirroring the layers for a window should cause Surface destruction to
1892 // depend on both layers. 1892 // depend on both layers.
1893 TEST_F(RenderWidgetHostViewAuraTest, RecreateLayers) { 1893 TEST_F(RenderWidgetHostViewAuraTest, MirrorLayers) {
1894 gfx::Size view_size(100, 100); 1894 gfx::Size view_size(100, 100);
1895 gfx::Rect view_rect(view_size); 1895 gfx::Rect view_rect(view_size);
1896 aura::Window* const root = parent_view_->GetNativeView()->GetRootWindow();
1896 1897
1897 view_->InitAsChild(nullptr); 1898 view_->InitAsChild(nullptr);
1898 aura::client::ParentWindowWithContext( 1899 aura::client::ParentWindowWithContext(
1899 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1900 view_->GetNativeView(), root, gfx::Rect());
1900 gfx::Rect());
1901 view_->SetSize(view_size); 1901 view_->SetSize(view_size);
1902 view_->Show(); 1902 view_->Show();
1903 1903
1904 view_->OnSwapCompositorFrame(0, 1904 view_->OnSwapCompositorFrame(0,
1905 MakeDelegatedFrame(1.f, view_size, view_rect)); 1905 MakeDelegatedFrame(1.f, view_size, view_rect));
1906 std::unique_ptr<ui::LayerTreeOwner> cloned_owner( 1906 std::unique_ptr<ui::LayerTreeOwner> mirror(
1907 wm::RecreateLayers(view_->GetNativeView(), nullptr)); 1907 wm::MirrorLayers(view_->GetNativeView(), nullptr));
1908 1908
1909 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); 1909 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
1910 if (!id.is_null()) { 1910 if (!id.is_null()) {
1911 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1911 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1912 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1912 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1913 cc::Surface* surface = manager->GetSurfaceForId(id); 1913 cc::Surface* surface = manager->GetSurfaceForId(id);
1914 EXPECT_TRUE(surface); 1914 EXPECT_TRUE(surface);
1915 // Should be a SurfaceSequence for both the original and new layers. 1915
1916 // An orphaned mirror should not be a destruction dependency.
1917 EXPECT_EQ(1u, surface->GetDestructionDependencyCount());
1918
1919 // Both layers should be destruction dependencies.
1920 root->layer()->Add(mirror->root());
1916 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); 1921 EXPECT_EQ(2u, surface->GetDestructionDependencyCount());
1922 root->layer()->Remove(mirror->root());
1917 } 1923 }
1918 } 1924 }
1919 1925
1920 // If the view size is larger than the compositor frame then extra layers 1926 // If the view size is larger than the compositor frame then extra layers
1921 // should be created to fill the gap. 1927 // should be created to fill the gap.
1922 TEST_F(RenderWidgetHostViewAuraTest, DelegatedFrameGutter) { 1928 TEST_F(RenderWidgetHostViewAuraTest, DelegatedFrameGutter) {
1923 gfx::Size large_size(100, 100); 1929 gfx::Size large_size(100, 100);
1924 gfx::Size small_size(40, 45); 1930 gfx::Size small_size(40, 45);
1925 gfx::Size medium_size(40, 95); 1931 gfx::Size medium_size(40, 95);
1926 1932
(...skipping 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after
4678 4684
4679 // Retrieve the selected text from clipboard and verify it is as expected. 4685 // Retrieve the selected text from clipboard and verify it is as expected.
4680 base::string16 result_text; 4686 base::string16 result_text;
4681 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4687 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4682 EXPECT_EQ(expected_text, result_text); 4688 EXPECT_EQ(expected_text, result_text);
4683 } 4689 }
4684 } 4690 }
4685 #endif 4691 #endif
4686 4692
4687 } // namespace content 4693 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698