Chromium Code Reviews| 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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1817 const IPC::Message* msg = sink_->GetMessageAt(0); | 1817 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1818 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); | 1818 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); |
| 1819 ViewMsg_ReclaimCompositorResources::Param params; | 1819 ViewMsg_ReclaimCompositorResources::Param params; |
| 1820 ViewMsg_ReclaimCompositorResources::Read(msg, ¶ms); | 1820 ViewMsg_ReclaimCompositorResources::Read(msg, ¶ms); |
| 1821 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id | 1821 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id |
| 1822 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack | 1822 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack |
| 1823 } | 1823 } |
| 1824 } | 1824 } |
| 1825 | 1825 |
| 1826 // This test verifies that when the compositor_frame_sink_id changes, then | 1826 // This test verifies that when the compositor_frame_sink_id changes, then |
| 1827 // DelegateFrameHost returns compositor resources without a swap ack. | 1827 // DelegateFrameHost returns compositor resources without a swap ack. |
|
Fady Samuel
2017/02/22 23:16:08
This comment should be updated as well.
Saman Sami
2017/02/22 23:20:15
Done.
| |
| 1828 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) { | 1828 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) { |
| 1829 FakeSurfaceObserver manager_observer; | 1829 FakeSurfaceObserver manager_observer; |
| 1830 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); | 1830 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); |
| 1831 cc::SurfaceManager* manager = | 1831 cc::SurfaceManager* manager = |
| 1832 factory->GetContextFactoryPrivate()->GetSurfaceManager(); | 1832 factory->GetContextFactoryPrivate()->GetSurfaceManager(); |
| 1833 manager->AddObserver(&manager_observer); | 1833 manager->AddObserver(&manager_observer); |
| 1834 | 1834 |
| 1835 gfx::Size view_size(100, 100); | 1835 gfx::Size view_size(100, 100); |
| 1836 gfx::Rect view_rect(view_size); | 1836 gfx::Rect view_rect(view_size); |
| 1837 | 1837 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1848 | 1848 |
| 1849 // Accumulate some returned resources. This should not trigger an IPC. | 1849 // Accumulate some returned resources. This should not trigger an IPC. |
| 1850 cc::ReturnedResourceArray resources; | 1850 cc::ReturnedResourceArray resources; |
| 1851 cc::ReturnedResource resource; | 1851 cc::ReturnedResource resource; |
| 1852 resource.id = 1; | 1852 resource.id = 1; |
| 1853 resources.push_back(resource); | 1853 resources.push_back(resource); |
| 1854 view_->ReturnResources(resources); | 1854 view_->ReturnResources(resources); |
| 1855 EXPECT_EQ(0u, sink_->message_count()); | 1855 EXPECT_EQ(0u, sink_->message_count()); |
| 1856 | 1856 |
| 1857 // Swap another CompositorFrame but this time from another | 1857 // Swap another CompositorFrame but this time from another |
| 1858 // compositor_frame_sink_id. | 1858 // compositor_frame_sink_id. The resources held by DelegatedFrameHost are old |
| 1859 // This should trigger a non-ACK ReclaimCompositorResources IPC. | 1859 // and should not be returned. |
| 1860 view_->OnSwapCompositorFrame(1, | 1860 view_->OnSwapCompositorFrame(1, |
| 1861 MakeDelegatedFrame(1.f, view_size, view_rect)); | 1861 MakeDelegatedFrame(1.f, view_size, view_rect)); |
| 1862 EXPECT_EQ(1u, sink_->message_count()); | 1862 EXPECT_EQ(0u, sink_->message_count()); |
| 1863 { | |
| 1864 const IPC::Message* msg = sink_->GetMessageAt(0); | |
| 1865 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); | |
| 1866 ViewMsg_ReclaimCompositorResources::Param params; | |
| 1867 ViewMsg_ReclaimCompositorResources::Read(msg, ¶ms); | |
| 1868 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id | |
| 1869 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack | |
| 1870 } | |
| 1871 sink_->ClearMessages(); | |
| 1872 | 1863 |
| 1873 // Report that the surface is drawn to trigger an ACK. | 1864 // Report that the surface is drawn to trigger an ACK. |
| 1874 cc::Surface* surface = manager->GetSurfaceForId(view_->surface_id()); | 1865 cc::Surface* surface = manager->GetSurfaceForId(view_->surface_id()); |
| 1875 EXPECT_TRUE(surface); | 1866 EXPECT_TRUE(surface); |
| 1876 surface->RunDrawCallbacks(); | 1867 surface->RunDrawCallbacks(); |
| 1877 EXPECT_EQ(1u, sink_->message_count()); | 1868 EXPECT_EQ(1u, sink_->message_count()); |
| 1878 { | 1869 { |
| 1879 const IPC::Message* msg = sink_->GetMessageAt(0); | 1870 const IPC::Message* msg = sink_->GetMessageAt(0); |
| 1880 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); | 1871 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); |
| 1881 ViewMsg_ReclaimCompositorResources::Param params; | 1872 ViewMsg_ReclaimCompositorResources::Param params; |
| (...skipping 2885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4767 // There is no composition in the beginning. | 4758 // There is no composition in the beginning. |
| 4768 EXPECT_FALSE(has_composition_text()); | 4759 EXPECT_FALSE(has_composition_text()); |
| 4769 SetHasCompositionTextToTrue(); | 4760 SetHasCompositionTextToTrue(); |
| 4770 view->ImeCancelComposition(); | 4761 view->ImeCancelComposition(); |
| 4771 // The composition must have been canceled. | 4762 // The composition must have been canceled. |
| 4772 EXPECT_FALSE(has_composition_text()); | 4763 EXPECT_FALSE(has_composition_text()); |
| 4773 } | 4764 } |
| 4774 } | 4765 } |
| 4775 | 4766 |
| 4776 } // namespace content | 4767 } // namespace content |
| OLD | NEW |