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

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

Issue 796193005: Fix RenderWidgetHostViewAuraTest.Resize with Surfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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 | « no previous file | 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 "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 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1480 // Expect the frame ack; 1480 // Expect the frame ack;
1481 EXPECT_EQ(1u, sink_->message_count()); 1481 EXPECT_EQ(1u, sink_->message_count());
1482 EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID, sink_->GetMessageAt(0)->type()); 1482 EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID, sink_->GetMessageAt(0)->type());
1483 sink_->ClearMessages(); 1483 sink_->ClearMessages();
1484 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); 1484 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString());
1485 1485
1486 // Receive a frame of the correct size, should not be skipped and, and should 1486 // Receive a frame of the correct size, should not be skipped and, and should
1487 // produce a Resize message after the commit. 1487 // produce a Resize message after the commit.
1488 view_->OnSwapCompositorFrame( 1488 view_->OnSwapCompositorFrame(
1489 0, MakeDelegatedFrame(1.f, size2, gfx::Rect(size2))); 1489 0, MakeDelegatedFrame(1.f, size2, gfx::Rect(size2)));
1490 // No frame ack yet. 1490 cc::SurfaceId surface_id = view_->surface_id();
1491 EXPECT_EQ(0u, sink_->message_count()); 1491 if (surface_id.is_null()) {
1492 // No frame ack yet.
1493 EXPECT_EQ(0u, sink_->message_count());
1494 } else {
1495 // Frame isn't desired size, so early ack.
1496 EXPECT_EQ(1u, sink_->message_count());
1497 }
1492 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString()); 1498 EXPECT_EQ(size2.ToString(), view_->GetRequestedRendererSize().ToString());
1493 1499
1494 // Wait for commit, then we should unlock the compositor and send a Resize 1500 // Wait for commit, then we should unlock the compositor and send a Resize
1495 // message (and a frame ack) 1501 // message (and a frame ack)
1496 ui::DrawWaiterForTest::WaitForCommit( 1502 ui::DrawWaiterForTest::WaitForCommit(
1497 root_window->GetHost()->compositor()); 1503 root_window->GetHost()->compositor());
1498 EXPECT_EQ(size3.ToString(), view_->GetRequestedRendererSize().ToString()); 1504 EXPECT_EQ(size3.ToString(), view_->GetRequestedRendererSize().ToString());
1499 cc::SurfaceId surface_id = view_->surface_id();
1500 int swap_index = 0;
1501 int resize_index = 1;
1502 if (!surface_id.is_null()) {
1503 // Frame ack is sent only due to a draw callback with surfaces.
1504 ImageTransportFactory::GetInstance()
1505 ->GetSurfaceManager()
1506 ->GetSurfaceForId(surface_id)
1507 ->RunDrawCallbacks();
1508 swap_index = 1;
1509 resize_index = 0;
1510 }
1511 EXPECT_EQ(2u, sink_->message_count()); 1505 EXPECT_EQ(2u, sink_->message_count());
1512 EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID, 1506 EXPECT_EQ(ViewMsg_SwapCompositorFrameAck::ID,
1513 sink_->GetMessageAt(swap_index)->type()); 1507 sink_->GetMessageAt(0)->type());
1514 { 1508 {
1515 const IPC::Message* msg = sink_->GetMessageAt(resize_index); 1509 const IPC::Message* msg = sink_->GetMessageAt(1);
1516 EXPECT_EQ(ViewMsg_Resize::ID, msg->type()); 1510 EXPECT_EQ(ViewMsg_Resize::ID, msg->type());
1517 ViewMsg_Resize::Param params; 1511 ViewMsg_Resize::Param params;
1518 ViewMsg_Resize::Read(msg, &params); 1512 ViewMsg_Resize::Read(msg, &params);
1519 EXPECT_EQ(size3.ToString(), params.a.new_size.ToString()); 1513 EXPECT_EQ(size3.ToString(), params.a.new_size.ToString());
1520 } 1514 }
1521 update_params.view_size = size3; 1515 update_params.view_size = size3;
1522 widget_host_->OnMessageReceived( 1516 widget_host_->OnMessageReceived(
1523 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params)); 1517 ViewHostMsg_UpdateRect(widget_host_->GetRoutingID(), update_params));
1524 sink_->ClearMessages(); 1518 sink_->ClearMessages();
1525 } 1519 }
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2994 const NativeWebKeyboardEvent* event = delegate_.last_event(); 2988 const NativeWebKeyboardEvent* event = delegate_.last_event();
2995 EXPECT_NE(nullptr, event); 2989 EXPECT_NE(nullptr, event);
2996 if (event) { 2990 if (event) {
2997 EXPECT_EQ(key_event.key_code(), event->windowsKeyCode); 2991 EXPECT_EQ(key_event.key_code(), event->windowsKeyCode);
2998 EXPECT_EQ(ui::KeycodeConverter::DomCodeToNativeKeycode(key_event.code()), 2992 EXPECT_EQ(ui::KeycodeConverter::DomCodeToNativeKeycode(key_event.code()),
2999 event->nativeKeyCode); 2993 event->nativeKeyCode);
3000 } 2994 }
3001 } 2995 }
3002 2996
3003 } // namespace content 2997 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698