| 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 1667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 } | 1678 } |
| 1679 return frame; | 1679 return frame; |
| 1680 } | 1680 } |
| 1681 | 1681 |
| 1682 // If the ui::Compositor has been reset then resources are returned back to the | 1682 // If the ui::Compositor has been reset then resources are returned back to the |
| 1683 // client in response to the swap. This test verifies that the returned | 1683 // client in response to the swap. This test verifies that the returned |
| 1684 // resources are indeed reported as being in response to a swap. | 1684 // resources are indeed reported as being in response to a swap. |
| 1685 TEST_F(RenderWidgetHostViewAuraTest, ResettingCompositorReturnsResources) { | 1685 TEST_F(RenderWidgetHostViewAuraTest, ResettingCompositorReturnsResources) { |
| 1686 FakeSurfaceObserver manager_observer; | 1686 FakeSurfaceObserver manager_observer; |
| 1687 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1687 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1688 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1688 cc::SurfaceManager* manager = |
| 1689 factory->GetContextFactory()->GetSurfaceManager(); |
| 1689 manager->AddObserver(&manager_observer); | 1690 manager->AddObserver(&manager_observer); |
| 1690 | 1691 |
| 1691 gfx::Size view_size(100, 100); | 1692 gfx::Size view_size(100, 100); |
| 1692 gfx::Rect view_rect(view_size); | 1693 gfx::Rect view_rect(view_size); |
| 1693 | 1694 |
| 1694 view_->InitAsChild(nullptr); | 1695 view_->InitAsChild(nullptr); |
| 1695 aura::client::ParentWindowWithContext( | 1696 aura::client::ParentWindowWithContext( |
| 1696 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), | 1697 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), |
| 1697 gfx::Rect()); | 1698 gfx::Rect()); |
| 1698 view_->SetSize(view_size); | 1699 view_->SetSize(view_size); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id | 1746 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id |
| 1746 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack | 1747 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack |
| 1747 } | 1748 } |
| 1748 } | 1749 } |
| 1749 | 1750 |
| 1750 // This test verifies that when the compositor_frame_sink_id changes, then | 1751 // This test verifies that when the compositor_frame_sink_id changes, then |
| 1751 // DelegateFrameHost returns compositor resources without a swap ack. | 1752 // DelegateFrameHost returns compositor resources without a swap ack. |
| 1752 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) { | 1753 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) { |
| 1753 FakeSurfaceObserver manager_observer; | 1754 FakeSurfaceObserver manager_observer; |
| 1754 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1755 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1755 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1756 cc::SurfaceManager* manager = |
| 1757 factory->GetContextFactory()->GetSurfaceManager(); |
| 1756 manager->AddObserver(&manager_observer); | 1758 manager->AddObserver(&manager_observer); |
| 1757 | 1759 |
| 1758 gfx::Size view_size(100, 100); | 1760 gfx::Size view_size(100, 100); |
| 1759 gfx::Rect view_rect(view_size); | 1761 gfx::Rect view_rect(view_size); |
| 1760 | 1762 |
| 1761 view_->InitAsChild(nullptr); | 1763 view_->InitAsChild(nullptr); |
| 1762 aura::client::ParentWindowWithContext( | 1764 aura::client::ParentWindowWithContext( |
| 1763 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), | 1765 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), |
| 1764 gfx::Rect()); | 1766 gfx::Rect()); |
| 1765 view_->SetSize(view_size); | 1767 view_->SetSize(view_size); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1910 view_->Show(); | 1912 view_->Show(); |
| 1911 | 1913 |
| 1912 view_->OnSwapCompositorFrame(0, | 1914 view_->OnSwapCompositorFrame(0, |
| 1913 MakeDelegatedFrame(1.f, view_size, view_rect)); | 1915 MakeDelegatedFrame(1.f, view_size, view_rect)); |
| 1914 std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers( | 1916 std::unique_ptr<ui::LayerTreeOwner> mirror(wm::MirrorLayers( |
| 1915 view_->GetNativeView(), false /* sync_bounds */)); | 1917 view_->GetNativeView(), false /* sync_bounds */)); |
| 1916 | 1918 |
| 1917 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); | 1919 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting(); |
| 1918 if (id.is_valid()) { | 1920 if (id.is_valid()) { |
| 1919 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1921 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1920 cc::SurfaceManager* manager = factory->GetSurfaceManager(); | 1922 cc::SurfaceManager* manager = |
| 1923 factory->GetContextFactory()->GetSurfaceManager(); |
| 1921 cc::Surface* surface = manager->GetSurfaceForId(id); | 1924 cc::Surface* surface = manager->GetSurfaceForId(id); |
| 1922 EXPECT_TRUE(surface); | 1925 EXPECT_TRUE(surface); |
| 1923 | 1926 |
| 1924 // An orphaned mirror should not be a destruction dependency. | 1927 // An orphaned mirror should not be a destruction dependency. |
| 1925 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); | 1928 EXPECT_EQ(1u, surface->GetDestructionDependencyCount()); |
| 1926 | 1929 |
| 1927 // Both layers should be destruction dependencies. | 1930 // Both layers should be destruction dependencies. |
| 1928 root->layer()->Add(mirror->root()); | 1931 root->layer()->Add(mirror->root()); |
| 1929 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); | 1932 EXPECT_EQ(2u, surface->GetDestructionDependencyCount()); |
| 1930 root->layer()->Remove(mirror->root()); | 1933 root->layer()->Remove(mirror->root()); |
| (...skipping 2743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4674 | 4677 |
| 4675 // Retrieve the selected text from clipboard and verify it is as expected. | 4678 // Retrieve the selected text from clipboard and verify it is as expected. |
| 4676 base::string16 result_text; | 4679 base::string16 result_text; |
| 4677 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); | 4680 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); |
| 4678 EXPECT_EQ(expected_text, result_text); | 4681 EXPECT_EQ(expected_text, result_text); |
| 4679 } | 4682 } |
| 4680 } | 4683 } |
| 4681 #endif | 4684 #endif |
| 4682 | 4685 |
| 4683 } // namespace content | 4686 } // namespace content |
| OLD | NEW |