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

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

Issue 666163006: Allow layers to signal that additional sequences are needed before surface destruction (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/shared_memory.h" 9 #include "base/memory/shared_memory.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "ui/aura/layout_manager.h" 43 #include "ui/aura/layout_manager.h"
44 #include "ui/aura/test/aura_test_helper.h" 44 #include "ui/aura/test/aura_test_helper.h"
45 #include "ui/aura/test/test_cursor_client.h" 45 #include "ui/aura/test/test_cursor_client.h"
46 #include "ui/aura/test/test_screen.h" 46 #include "ui/aura/test/test_screen.h"
47 #include "ui/aura/test/test_window_delegate.h" 47 #include "ui/aura/test/test_window_delegate.h"
48 #include "ui/aura/window.h" 48 #include "ui/aura/window.h"
49 #include "ui/aura/window_event_dispatcher.h" 49 #include "ui/aura/window_event_dispatcher.h"
50 #include "ui/aura/window_observer.h" 50 #include "ui/aura/window_observer.h"
51 #include "ui/base/ui_base_types.h" 51 #include "ui/base/ui_base_types.h"
52 #include "ui/compositor/compositor.h" 52 #include "ui/compositor/compositor.h"
53 #include "ui/compositor/layer_tree_owner.h"
53 #include "ui/compositor/test/draw_waiter_for_test.h" 54 #include "ui/compositor/test/draw_waiter_for_test.h"
54 #include "ui/events/event.h" 55 #include "ui/events/event.h"
55 #include "ui/events/event_utils.h" 56 #include "ui/events/event_utils.h"
56 #include "ui/events/gesture_detection/gesture_configuration.h" 57 #include "ui/events/gesture_detection/gesture_configuration.h"
57 #include "ui/events/test/event_generator.h" 58 #include "ui/events/test/event_generator.h"
58 #include "ui/wm/core/default_activation_client.h" 59 #include "ui/wm/core/default_activation_client.h"
59 #include "ui/wm/core/default_screen_position_client.h" 60 #include "ui/wm/core/default_screen_position_client.h"
60 #include "ui/wm/core/window_util.h" 61 #include "ui/wm/core/window_util.h"
61 62
62 using testing::_; 63 using testing::_;
(...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1376 1377
1377 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_, 1378 EXPECT_CALL(observer, OnDelegatedFrameDamage(view_->window_,
1378 gfx::Rect(5, 5, 5, 5))); 1379 gfx::Rect(5, 5, 5, 5)));
1379 view_->OnSwapCompositorFrame( 1380 view_->OnSwapCompositorFrame(
1380 0, MakeDelegatedFrame(1.f, view_size, gfx::Rect(5, 5, 5, 5))); 1381 0, MakeDelegatedFrame(1.f, view_size, gfx::Rect(5, 5, 5, 5)));
1381 testing::Mock::VerifyAndClearExpectations(&observer); 1382 testing::Mock::VerifyAndClearExpectations(&observer);
1382 1383
1383 view_->window_->RemoveObserver(&observer); 1384 view_->window_->RemoveObserver(&observer);
1384 } 1385 }
1385 1386
1387 // Recreating the layers for a window should cause Surface destruction to
1388 // depend on both layers.
1389 TEST_F(RenderWidgetHostViewAuraTest, RecreateLayers) {
1390 gfx::Size view_size(100, 100);
1391 gfx::Rect view_rect(view_size);
1392
1393 view_->InitAsChild(NULL);
1394 aura::client::ParentWindowWithContext(
1395 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1396 gfx::Rect());
1397 view_->SetSize(view_size);
1398 view_->WasShown();
1399
1400 view_->OnSwapCompositorFrame(0,
1401 MakeDelegatedFrame(1.f, view_size, view_rect));
1402 scoped_ptr<ui::LayerTreeOwner> cloned_owner(
1403 wm::RecreateLayers(view_->GetNativeView()));
1404
1405 cc::SurfaceId id = view_->GetDelegatedFrameHost()->SurfaceIdForTesting();
1406 if (!id.is_null()) {
1407 ImageTransportFactory* factory = ImageTransportFactory::GetInstance();
1408 cc::SurfaceManager* manager = factory->GetSurfaceManager();
1409 cc::Surface* surface = manager->GetSurfaceForId(id);
1410 EXPECT_TRUE(surface);
1411 // Should be a SurfaceSequence for both the original and new layers.
1412 EXPECT_EQ(2u, surface->destruction_dependencies().size());
1413 }
1414 }
1415
1386 TEST_F(RenderWidgetHostViewAuraTest, Resize) { 1416 TEST_F(RenderWidgetHostViewAuraTest, Resize) {
1387 gfx::Size size1(100, 100); 1417 gfx::Size size1(100, 100);
1388 gfx::Size size2(200, 200); 1418 gfx::Size size2(200, 200);
1389 gfx::Size size3(300, 300); 1419 gfx::Size size3(300, 300);
1390 1420
1391 aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow(); 1421 aura::Window* root_window = parent_view_->GetNativeView()->GetRootWindow();
1392 view_->InitAsChild(NULL); 1422 view_->InitAsChild(NULL);
1393 aura::client::ParentWindowWithContext( 1423 aura::client::ParentWindowWithContext(
1394 view_->GetNativeView(), root_window, gfx::Rect(size1)); 1424 view_->GetNativeView(), root_window, gfx::Rect(size1));
1395 view_->WasShown(); 1425 view_->WasShown();
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
2907 } 2937 }
2908 2938
2909 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted 2939 // Tests that when view initiated shutdown happens (i.e. RWHView is deleted
2910 // before RWH), we clean up properly and don't leak the RWHVGuest. 2940 // before RWH), we clean up properly and don't leak the RWHVGuest.
2911 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) { 2941 TEST_F(RenderWidgetHostViewGuestAuraTest, GuestViewDoesNotLeak) {
2912 TearDownEnvironment(); 2942 TearDownEnvironment();
2913 ASSERT_FALSE(guest_view_weak_.get()); 2943 ASSERT_FALSE(guest_view_weak_.get());
2914 } 2944 }
2915 2945
2916 } // namespace content 2946 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698