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

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

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: android-vulkan Created 4 years, 3 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 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 // Swapping a frame should trigger a swap ACK IPC because we have reset the 1661 // Swapping a frame should trigger a swap ACK IPC because we have reset the
1662 // compositor. 1662 // compositor.
1663 view_->OnSwapCompositorFrame(0, 1663 view_->OnSwapCompositorFrame(0,
1664 MakeDelegatedFrame(1.f, view_size, view_rect)); 1664 MakeDelegatedFrame(1.f, view_size, view_rect));
1665 EXPECT_EQ(1u, sink_->message_count()); 1665 EXPECT_EQ(1u, sink_->message_count());
1666 { 1666 {
1667 const IPC::Message* msg = sink_->GetMessageAt(0); 1667 const IPC::Message* msg = sink_->GetMessageAt(0);
1668 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); 1668 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type());
1669 ViewMsg_ReclaimCompositorResources::Param params; 1669 ViewMsg_ReclaimCompositorResources::Param params;
1670 ViewMsg_ReclaimCompositorResources::Read(msg, &params); 1670 ViewMsg_ReclaimCompositorResources::Read(msg, &params);
1671 EXPECT_EQ(0u, std::get<0>(params)); // output_surface_id 1671 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id
1672 EXPECT_TRUE(std::get<1>(params)); // is_swap_ack 1672 EXPECT_TRUE(std::get<1>(params)); // is_swap_ack
1673 } 1673 }
1674 manager->RemoveObserver(&damage_observer); 1674 manager->RemoveObserver(&damage_observer);
1675 } 1675 }
1676 1676
1677 // This test verifies that returned resources do not require a pending ack. 1677 // This test verifies that returned resources do not require a pending ack.
1678 TEST_F(RenderWidgetHostViewAuraTest, ReturnedResources) { 1678 TEST_F(RenderWidgetHostViewAuraTest, ReturnedResources) {
1679 gfx::Size view_size(100, 100); 1679 gfx::Size view_size(100, 100);
1680 gfx::Rect view_rect(view_size); 1680 gfx::Rect view_rect(view_size);
1681 1681
(...skipping 10 matching lines...) Expand all
1692 cc::ReturnedResource resource; 1692 cc::ReturnedResource resource;
1693 resource.id = 1; 1693 resource.id = 1;
1694 resources.push_back(resource); 1694 resources.push_back(resource);
1695 view_->ReturnResources(resources); 1695 view_->ReturnResources(resources);
1696 EXPECT_EQ(1u, sink_->message_count()); 1696 EXPECT_EQ(1u, sink_->message_count());
1697 { 1697 {
1698 const IPC::Message* msg = sink_->GetMessageAt(0); 1698 const IPC::Message* msg = sink_->GetMessageAt(0);
1699 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); 1699 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type());
1700 ViewMsg_ReclaimCompositorResources::Param params; 1700 ViewMsg_ReclaimCompositorResources::Param params;
1701 ViewMsg_ReclaimCompositorResources::Read(msg, &params); 1701 ViewMsg_ReclaimCompositorResources::Read(msg, &params);
1702 EXPECT_EQ(0u, std::get<0>(params)); // output_surface_id 1702 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id
1703 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack 1703 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack
1704 } 1704 }
1705 } 1705 }
1706 1706
1707 // This test verifies that when the output_surface_id changes, then 1707 // This test verifies that when the compositor_frame_sink_id changes, then
1708 // DelegateFrameHost returns compositor resources without a swap ack. 1708 // DelegateFrameHost returns compositor resources without a swap ack.
1709 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) { 1709 TEST_F(RenderWidgetHostViewAuraTest, TwoOutputSurfaces) {
1710 FakeSurfaceDamageObserver damage_observer; 1710 FakeSurfaceDamageObserver damage_observer;
1711 ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); 1711 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1712 cc::SurfaceManager* manager = factory->GetSurfaceManager(); 1712 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1713 manager->AddObserver(&damage_observer); 1713 manager->AddObserver(&damage_observer);
1714 1714
1715 gfx::Size view_size(100, 100); 1715 gfx::Size view_size(100, 100);
1716 gfx::Rect view_rect(view_size); 1716 gfx::Rect view_rect(view_size);
1717 1717
1718 view_->InitAsChild(nullptr); 1718 view_->InitAsChild(nullptr);
1719 aura::client::ParentWindowWithContext( 1719 aura::client::ParentWindowWithContext(
1720 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1720 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1721 gfx::Rect()); 1721 gfx::Rect());
1722 view_->SetSize(view_size); 1722 view_->SetSize(view_size);
1723 view_->Show(); 1723 view_->Show();
1724 sink_->ClearMessages(); 1724 sink_->ClearMessages();
1725 1725
1726 view_->OnSwapCompositorFrame(0, 1726 view_->OnSwapCompositorFrame(0,
1727 MakeDelegatedFrame(1.f, view_size, view_rect)); 1727 MakeDelegatedFrame(1.f, view_size, view_rect));
1728 1728
1729 // Accumulate some returned resources. This should not trigger an IPC. 1729 // Accumulate some returned resources. This should not trigger an IPC.
1730 cc::ReturnedResourceArray resources; 1730 cc::ReturnedResourceArray resources;
1731 cc::ReturnedResource resource; 1731 cc::ReturnedResource resource;
1732 resource.id = 1; 1732 resource.id = 1;
1733 resources.push_back(resource); 1733 resources.push_back(resource);
1734 view_->ReturnResources(resources); 1734 view_->ReturnResources(resources);
1735 EXPECT_EQ(0u, sink_->message_count()); 1735 EXPECT_EQ(0u, sink_->message_count());
1736 1736
1737 // Swap another CompositorFrame but this time from another output_surface_id. 1737 // Swap another CompositorFrame but this time from another
1738 // compositor_frame_sink_id.
1738 // This should trigger a non-ACK ReclaimCompositorResources IPC. 1739 // This should trigger a non-ACK ReclaimCompositorResources IPC.
1739 view_->OnSwapCompositorFrame(1, 1740 view_->OnSwapCompositorFrame(1,
1740 MakeDelegatedFrame(1.f, view_size, view_rect)); 1741 MakeDelegatedFrame(1.f, view_size, view_rect));
1741 EXPECT_EQ(1u, sink_->message_count()); 1742 EXPECT_EQ(1u, sink_->message_count());
1742 { 1743 {
1743 const IPC::Message* msg = sink_->GetMessageAt(0); 1744 const IPC::Message* msg = sink_->GetMessageAt(0);
1744 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); 1745 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type());
1745 ViewMsg_ReclaimCompositorResources::Param params; 1746 ViewMsg_ReclaimCompositorResources::Param params;
1746 ViewMsg_ReclaimCompositorResources::Read(msg, &params); 1747 ViewMsg_ReclaimCompositorResources::Read(msg, &params);
1747 EXPECT_EQ(0u, std::get<0>(params)); // output_surface_id 1748 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id
1748 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack 1749 EXPECT_FALSE(std::get<1>(params)); // is_swap_ack
1749 } 1750 }
1750 sink_->ClearMessages(); 1751 sink_->ClearMessages();
1751 1752
1752 // Report that the surface is drawn to trigger an ACK. 1753 // Report that the surface is drawn to trigger an ACK.
1753 cc::Surface* surface = manager->GetSurfaceForId(view_->surface_id()); 1754 cc::Surface* surface = manager->GetSurfaceForId(view_->surface_id());
1754 EXPECT_TRUE(surface); 1755 EXPECT_TRUE(surface);
1755 surface->RunDrawCallbacks(); 1756 surface->RunDrawCallbacks();
1756 EXPECT_EQ(1u, sink_->message_count()); 1757 EXPECT_EQ(1u, sink_->message_count());
1757 { 1758 {
1758 const IPC::Message* msg = sink_->GetMessageAt(0); 1759 const IPC::Message* msg = sink_->GetMessageAt(0);
1759 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type()); 1760 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type());
1760 ViewMsg_ReclaimCompositorResources::Param params; 1761 ViewMsg_ReclaimCompositorResources::Param params;
1761 ViewMsg_ReclaimCompositorResources::Read(msg, &params); 1762 ViewMsg_ReclaimCompositorResources::Read(msg, &params);
1762 EXPECT_EQ(1u, std::get<0>(params)); // output_surface_id 1763 EXPECT_EQ(1u, std::get<0>(params)); // compositor_frame_sink_id
1763 EXPECT_EQ(true, std::get<1>(params)); // is_swap_ack 1764 EXPECT_EQ(true, std::get<1>(params)); // is_swap_ack
1764 } 1765 }
1765 1766
1766 manager->RemoveObserver(&damage_observer); 1767 manager->RemoveObserver(&damage_observer);
1767 } 1768 }
1768 1769
1769 // Resizing in fullscreen mode should send the up-to-date screen info. 1770 // Resizing in fullscreen mode should send the up-to-date screen info.
1770 // http://crbug.com/324350 1771 // http://crbug.com/324350
1771 TEST_F(RenderWidgetHostViewAuraTest, DISABLED_FullscreenResize) { 1772 TEST_F(RenderWidgetHostViewAuraTest, DISABLED_FullscreenResize) {
1772 aura::Window* root_window = aura_test_helper_->root_window(); 1773 aura::Window* root_window = aura_test_helper_->root_window();
(...skipping 2814 matching lines...) Expand 10 before | Expand all | Expand 10 after
4587 4588
4588 // Retrieve the selected text from clipboard and verify it is as expected. 4589 // Retrieve the selected text from clipboard and verify it is as expected.
4589 base::string16 result_text; 4590 base::string16 result_text;
4590 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text); 4591 clipboard->ReadText(ui::CLIPBOARD_TYPE_SELECTION, &result_text);
4591 EXPECT_EQ(expected_text, result_text); 4592 EXPECT_EQ(expected_text, result_text);
4592 } 4593 }
4593 } 4594 }
4594 #endif 4595 #endif
4595 4596
4596 } // namespace content 4597 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698