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

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

Issue 2708423002: DelegatedFrameHost should not send immediate ack when compositor is null (Closed)
Patch Set: Remove unit test Created 3 years, 9 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
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1747 pass->SetNew(1, gfx::Rect(size), damage, gfx::Transform()); 1747 pass->SetNew(1, gfx::Rect(size), damage, gfx::Transform());
1748 frame.render_pass_list.push_back(std::move(pass)); 1748 frame.render_pass_list.push_back(std::move(pass));
1749 if (!size.IsEmpty()) { 1749 if (!size.IsEmpty()) {
1750 cc::TransferableResource resource; 1750 cc::TransferableResource resource;
1751 resource.id = 1; 1751 resource.id = 1;
1752 frame.resource_list.push_back(std::move(resource)); 1752 frame.resource_list.push_back(std::move(resource));
1753 } 1753 }
1754 return frame; 1754 return frame;
1755 } 1755 }
1756 1756
1757 // If the ui::Compositor has been reset then resources are returned back to the
1758 // client in response to the swap. This test verifies that the returned
1759 // resources are indeed reported as being in response to a swap.
1760 TEST_F(RenderWidgetHostViewAuraTest, ResettingCompositorReturnsResources) {
1761 FakeSurfaceObserver manager_observer;
1762 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1763 cc::SurfaceManager* manager =
1764 factory->GetContextFactoryPrivate()->GetSurfaceManager();
1765 manager->AddObserver(&manager_observer);
1766
1767 gfx::Size view_size(100, 100);
1768 gfx::Rect view_rect(view_size);
1769
1770 view_->InitAsChild(nullptr);
1771 aura::client::ParentWindowWithContext(
1772 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1773 gfx::Rect());
1774 view_->SetSize(view_size);
1775 view_->Show();
1776 sink_->ClearMessages();
1777
1778 view_->ResetCompositor();
1779
1780 // Swapping a frame should trigger a swap ACK IPC because we have reset the
1781 // compositor.
1782 view_->OnSwapCompositorFrame(0,
1783 MakeDelegatedFrame(1.f, view_size, view_rect));
1784 EXPECT_EQ(1u, sink_->message_count());
1785 {
1786 const IPC::Message* msg = sink_->GetMessageAt(0);
1787 EXPECT_EQ(ViewMsg_ReclaimCompositorResources::ID, msg->type());
1788 ViewMsg_ReclaimCompositorResources::Param params;
1789 ViewMsg_ReclaimCompositorResources::Read(msg, &params);
1790 EXPECT_EQ(0u, std::get<0>(params)); // compositor_frame_sink_id
1791 EXPECT_TRUE(std::get<1>(params)); // is_swap_ack
1792 }
1793 manager->RemoveObserver(&manager_observer);
1794 }
1795
1796 // This test verifies that returned resources do not require a pending ack. 1757 // This test verifies that returned resources do not require a pending ack.
1797 TEST_F(RenderWidgetHostViewAuraTest, ReturnedResources) { 1758 TEST_F(RenderWidgetHostViewAuraTest, ReturnedResources) {
1798 gfx::Size view_size(100, 100); 1759 gfx::Size view_size(100, 100);
1799 gfx::Rect view_rect(view_size); 1760 gfx::Rect view_rect(view_size);
1800 1761
1801 view_->InitAsChild(nullptr); 1762 view_->InitAsChild(nullptr);
1802 aura::client::ParentWindowWithContext( 1763 aura::client::ParentWindowWithContext(
1803 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1764 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1804 gfx::Rect()); 1765 gfx::Rect());
1805 view_->SetSize(view_size); 1766 view_->SetSize(view_size);
(...skipping 2961 matching lines...) Expand 10 before | Expand all | Expand 10 after
4767 // There is no composition in the beginning. 4728 // There is no composition in the beginning.
4768 EXPECT_FALSE(has_composition_text()); 4729 EXPECT_FALSE(has_composition_text());
4769 SetHasCompositionTextToTrue(); 4730 SetHasCompositionTextToTrue();
4770 view->ImeCancelComposition(); 4731 view->ImeCancelComposition();
4771 // The composition must have been canceled. 4732 // The composition must have been canceled.
4772 EXPECT_FALSE(has_composition_text()); 4733 EXPECT_FALSE(has_composition_text());
4773 } 4734 }
4774 } 4735 }
4775 4736
4776 } // namespace content 4737 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/delegated_frame_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698