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