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

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

Issue 2840063002: ui: Prevent DelegatedFrameHost from taking CompositorResizeLock forever (Closed)
Patch Set: ui: Prevent DelegatedFrameHost from taking CompositorResizeLock forever Created 3 years, 7 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/render_widget_host_view_aura.h ('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 2594 matching lines...) Expand 10 before | Expand all | Expand 10 after
2605 2605
2606 // When the frame of the correct size is committed, the CompositorResizeLock 2606 // When the frame of the correct size is committed, the CompositorResizeLock
2607 // is released. 2607 // is released.
2608 view_->RunOnCompositingDidCommit(); 2608 view_->RunOnCompositingDidCommit();
2609 EXPECT_FALSE(view_->resize_locked()); 2609 EXPECT_FALSE(view_->resize_locked());
2610 EXPECT_FALSE(view_->compositor_locked()); 2610 EXPECT_FALSE(view_->compositor_locked());
2611 2611
2612 view_->window_->RemoveObserver(&observer); 2612 view_->window_->RemoveObserver(&observer);
2613 } 2613 }
2614 2614
2615 // When the DelegatedFrameHost does not have a frame from the renderer, it has
2616 // no reason to lock the compositor as there can't be guttering around a
2617 // renderer frame that doesn't exist.
2618 TEST_F(RenderWidgetHostViewAuraTest, MissingFramesDontLock) {
2619 gfx::Rect view_rect(100, 100);
2620 gfx::Size frame_size = view_rect.size();
2621
2622 view_->InitAsChild(nullptr);
2623 aura::client::ParentWindowWithContext(
2624 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
2625 gfx::Rect());
2626
2627 // The view is resized before the first frame, which should not lock the
2628 // compositor as it's never received a frame to show yet.
2629 view_->SetSize(view_rect.size());
2630
2631 EXPECT_FALSE(view_->resize_locked());
2632 EXPECT_FALSE(view_->compositor_locked());
2633
2634 // Submit a frame of initial size to make a frame present in
2635 // DelegatedFrameHost, at which point locking becomes feasible if resized.
2636 view_->SubmitCompositorFrame(
2637 kArbitraryLocalSurfaceId,
2638 MakeDelegatedFrame(1.f, frame_size, gfx::Rect(frame_size)));
2639 view_->RunOnCompositingDidCommit();
2640
2641 EXPECT_FALSE(view_->resize_locked());
2642 EXPECT_FALSE(view_->compositor_locked());
2643
2644 // The view is resized and has its frame evicted, before a new frame arrives.
2645 // The resize will lock the compositor, but when evicted, it should no longer
2646 // be locked.
2647 view_rect.SetRect(0, 0, 150, 150);
2648 view_->SetSize(view_rect.size());
2649 EXPECT_TRUE(view_->resize_locked());
2650 EXPECT_TRUE(view_->compositor_locked());
2651
2652 view_->ClearCompositorFrame();
2653 EXPECT_FALSE(view_->resize_locked());
2654 EXPECT_FALSE(view_->compositor_locked());
2655
2656 // And future resizes after eviction should not lock the compositor since
2657 // there is no frame present.
2658 view_rect.SetRect(0, 0, 120, 120);
2659 view_->SetSize(view_rect.size());
2660 EXPECT_FALSE(view_->resize_locked());
2661 EXPECT_FALSE(view_->compositor_locked());
2662 }
2663
2615 TEST_F(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange) { 2664 TEST_F(RenderWidgetHostViewAuraTest, OutputSurfaceIdChange) {
2616 gfx::Rect view_rect(100, 100); 2665 gfx::Rect view_rect(100, 100);
2617 gfx::Size frame_size = view_rect.size(); 2666 gfx::Size frame_size = view_rect.size();
2618 2667
2619 view_->InitAsChild(nullptr); 2668 view_->InitAsChild(nullptr);
2620 aura::client::ParentWindowWithContext( 2669 aura::client::ParentWindowWithContext(
2621 view_->GetNativeView(), 2670 view_->GetNativeView(),
2622 parent_view_->GetNativeView()->GetRootWindow(), 2671 parent_view_->GetNativeView()->GetRootWindow(),
2623 gfx::Rect()); 2672 gfx::Rect());
2624 view_->SetSize(view_rect.size()); 2673 view_->SetSize(view_rect.size());
(...skipping 2818 matching lines...) Expand 10 before | Expand all | Expand 10 after
5443 // There is no composition in the beginning. 5492 // There is no composition in the beginning.
5444 EXPECT_FALSE(has_composition_text()); 5493 EXPECT_FALSE(has_composition_text());
5445 SetHasCompositionTextToTrue(); 5494 SetHasCompositionTextToTrue();
5446 view->ImeCancelComposition(); 5495 view->ImeCancelComposition();
5447 // The composition must have been canceled. 5496 // The composition must have been canceled.
5448 EXPECT_FALSE(has_composition_text()); 5497 EXPECT_FALSE(has_composition_text());
5449 } 5498 }
5450 } 5499 }
5451 5500
5452 } // namespace content 5501 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698