| OLD | NEW |
| 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 Loading... |
| 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 // Mirroring the layers for a window should cause Surface destruction to | 1858 // Recreating the layers for a window should cause Surface destruction to |
| 1859 // depend on both layers. | 1859 // depend on both layers. |
| 1860 TEST_F(RenderWidgetHostViewAuraTest, MirrorLayers) { | 1860 TEST_F(RenderWidgetHostViewAuraTest, RecreateLayers) { |
| 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(); | |
| 1864 | 1863 |
| 1865 view_->InitAsChild(nullptr); | 1864 view_->InitAsChild(nullptr); |
| 1866 aura::client::ParentWindowWithContext( | 1865 aura::client::ParentWindowWithContext( |
| 1867 view_->GetNativeView(), root, gfx::Rect()); | 1866 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), |
| 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> mirror(wm::MirrorLayers( | 1873 std::unique_ptr<ui::LayerTreeOwner> cloned_owner( |
| 1874 view_->GetNativeView(), false /* sync_bounds */)); | 1874 wm::RecreateLayers(view_->GetNativeView(), nullptr)); |
| 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 | 1882 // Should be a SurfaceSequence for both the original and new layers. |
| 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()); | |
| 1888 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); | 1883 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); |
| 1889 root->layer()->Remove(mirror->root()); | |
| 1890 } | 1884 } |
| 1891 } | 1885 } |
| 1892 | 1886 |
| 1893 // If the view size is larger than the compositor frame then extra layers | 1887 // If the view size is larger than the compositor frame then extra layers |
| 1894 // should be created to fill the gap. | 1888 // should be created to fill the gap. |
| 1895 TEST_F(RenderWidgetHostViewAuraTest, DelegatedFrameGutter) { | 1889 TEST_F(RenderWidgetHostViewAuraTest, DelegatedFrameGutter) { |
| 1896 gfx::Size large_size(100, 100); | 1890 gfx::Size large_size(100, 100); |
| 1897 gfx::Size small_size(40, 45); | 1891 gfx::Size small_size(40, 45); |
| 1898 gfx::Size medium_size(40, 95); | 1892 gfx::Size medium_size(40, 95); |
| 1899 | 1893 |
| (...skipping 2729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4629 | 4623 |
| 4630 // Retrieve the selected text from clipboard and verify it is as expected. | 4624 // Retrieve the selected text from clipboard and verify it is as expected. |
| 4631 base::string16 result_text; | 4625 base::string16 result_text; |
| 4632 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); | 4626 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); |
| 4633 EXPECT_EQ(expected_text, result_text); | 4627 EXPECT_EQ(expected_text, result_text); |
| 4634 } | 4628 } |
| 4635 } | 4629 } |
| 4636 #endif | 4630 #endif |
| 4637 | 4631 |
| 4638 } // namespace content | 4632 } // namespace content |
| OLD | NEW |