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

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

Issue 2096493002: Make cc::CompositorFrames movable [Part 1 of 2] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dana's nits Created 4 years, 5 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 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 view_->UpdateCursorIfOverSelf(); 1545 view_->UpdateCursorIfOverSelf();
1546 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); 1546 EXPECT_EQ(0, cursor_client.calls_to_set_cursor());
1547 1547
1548 // Cursor is below the window. 1548 // Cursor is below the window.
1549 cursor_client.reset_calls_to_set_cursor(); 1549 cursor_client.reset_calls_to_set_cursor();
1550 aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(161, 161)); 1550 aura::Env::GetInstance()->set_last_mouse_location(gfx::Point(161, 161));
1551 view_->UpdateCursorIfOverSelf(); 1551 view_->UpdateCursorIfOverSelf();
1552 EXPECT_EQ(0, cursor_client.calls_to_set_cursor()); 1552 EXPECT_EQ(0, cursor_client.calls_to_set_cursor());
1553 } 1553 }
1554 1554
1555 std::unique_ptr<cc::CompositorFrame> MakeDelegatedFrame(float scale_factor, 1555 cc::CompositorFrame MakeDelegatedFrame(float scale_factor,
1556 gfx::Size size, 1556 gfx::Size size,
1557 gfx::Rect damage) { 1557 gfx::Rect damage) {
1558 std::unique_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); 1558 cc::CompositorFrame frame;
1559 frame->metadata.device_scale_factor = scale_factor; 1559 frame.metadata.device_scale_factor = scale_factor;
1560 frame->delegated_frame_data.reset(new cc::DelegatedFrameData); 1560 frame.delegated_frame_data.reset(new cc::DelegatedFrameData);
1561 1561
1562 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); 1562 std::unique_ptr<cc::RenderPass> pass = cc::RenderPass::Create();
1563 pass->SetNew( 1563 pass->SetNew(
1564 cc::RenderPassId(1, 1), gfx::Rect(size), damage, gfx::Transform()); 1564 cc::RenderPassId(1, 1), gfx::Rect(size), damage, gfx::Transform());
1565 frame->delegated_frame_data->render_pass_list.push_back(std::move(pass)); 1565 frame.delegated_frame_data->render_pass_list.push_back(std::move(pass));
1566 return frame; 1566 return frame;
1567 } 1567 }
1568 1568
1569 // Resizing in fullscreen mode should send the up-to-date screen info. 1569 // Resizing in fullscreen mode should send the up-to-date screen info.
1570 // http://crbug.com/324350 1570 // http://crbug.com/324350
1571 TEST_F(RenderWidgetHostViewAuraTest, DISABLED_FullscreenResize) { 1571 TEST_F(RenderWidgetHostViewAuraTest, DISABLED_FullscreenResize) {
1572 aura::Window* root_window = aura_test_helper_->root_window(); 1572 aura::Window* root_window = aura_test_helper_->root_window();
1573 root_window->SetLayoutManager(new FullscreenLayoutManager(root_window)); 1573 root_window->SetLayoutManager(new FullscreenLayoutManager(root_window));
1574 view_->InitAsFullscreen(parent_view_); 1574 view_->InitAsFullscreen(parent_view_);
1575 view_->Show(); 1575 view_->Show();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 1690
1691 // Prevent the DelegatedFrameHost from skipping frames. 1691 // Prevent the DelegatedFrameHost from skipping frames.
1692 view_->can_create_resize_lock_ = false; 1692 view_->can_create_resize_lock_ = false;
1693 1693
1694 view_->InitAsChild(NULL); 1694 view_->InitAsChild(NULL);
1695 aura::client::ParentWindowWithContext( 1695 aura::client::ParentWindowWithContext(
1696 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(), 1696 view_->GetNativeView(), parent_view_->GetNativeView()->GetRootWindow(),
1697 gfx::Rect()); 1697 gfx::Rect());
1698 view_->SetSize(large_size); 1698 view_->SetSize(large_size);
1699 view_->Show(); 1699 view_->Show();
1700 std::unique_ptr<cc::CompositorFrame> frame = 1700 cc::CompositorFrame frame =
1701 MakeDelegatedFrame(1.f, small_size, gfx::Rect(small_size)); 1701 MakeDelegatedFrame(1.f, small_size, gfx::Rect(small_size));
1702 frame->metadata.root_background_color = SK_ColorRED; 1702 frame.metadata.root_background_color = SK_ColorRED;
1703 view_->OnSwapCompositorFrame(0, std::move(frame)); 1703 view_->OnSwapCompositorFrame(0, std::move(frame));
1704 1704
1705 ui::Layer* parent_layer = view_->GetNativeView()->layer(); 1705 ui::Layer* parent_layer = view_->GetNativeView()->layer();
1706 1706
1707 ASSERT_EQ(2u, parent_layer->children().size()); 1707 ASSERT_EQ(2u, parent_layer->children().size());
1708 EXPECT_EQ(gfx::Rect(40, 0, 60, 100), parent_layer->children()[0]->bounds()); 1708 EXPECT_EQ(gfx::Rect(40, 0, 60, 100), parent_layer->children()[0]->bounds());
1709 EXPECT_EQ(SK_ColorRED, parent_layer->children()[0]->background_color()); 1709 EXPECT_EQ(SK_ColorRED, parent_layer->children()[0]->background_color());
1710 EXPECT_EQ(gfx::Rect(0, 45, 40, 55), parent_layer->children()[1]->bounds()); 1710 EXPECT_EQ(gfx::Rect(0, 45, 40, 55), parent_layer->children()[1]->bounds());
1711 EXPECT_EQ(SK_ColorRED, parent_layer->children()[1]->background_color()); 1711 EXPECT_EQ(SK_ColorRED, parent_layer->children()[1]->background_color());
1712 1712
(...skipping 2275 matching lines...) Expand 10 before | Expand all | Expand 10 after
3988 view()->OnGestureEvent(&gesture_event); 3988 view()->OnGestureEvent(&gesture_event);
3989 3989
3990 EXPECT_TRUE(delegate->context_menu_request_received()); 3990 EXPECT_TRUE(delegate->context_menu_request_received());
3991 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH); 3991 EXPECT_EQ(delegate->context_menu_source_type(), ui::MENU_SOURCE_TOUCH);
3992 #endif 3992 #endif
3993 3993
3994 RenderViewHostFactory::set_is_real_render_view_host(false); 3994 RenderViewHostFactory::set_is_real_render_view_host(false);
3995 } 3995 }
3996 3996
3997 } // namespace content 3997 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698