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

Side by Side Diff: components/exo/surface_unittest.cc

Issue 2786643002: [exo]CompositorFrameSinkHolder calls WillDraw in DidReceiveCompositorFrameAck (Closed)
Patch Set: Address A Comment Created 3 years, 8 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 | « components/exo/surface.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "cc/surfaces/surface.h" 5 #include "cc/surfaces/surface.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/quads/texture_draw_quad.h" 8 #include "cc/quads/texture_draw_quad.h"
9 #include "cc/surfaces/surface_manager.h" 9 #include "cc/surfaces/surface_manager.h"
10 #include "cc/test/begin_frame_args_test.h" 10 #include "cc/test/begin_frame_args_test.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 surface->SetBeginFrameSource(&source); 322 surface->SetBeginFrameSource(&source);
323 surface->Attach(buffer.get()); 323 surface->Attach(buffer.get());
324 324
325 // Request a frame callback so that Surface now needs BeginFrames. 325 // Request a frame callback so that Surface now needs BeginFrames.
326 base::TimeTicks frame_time; 326 base::TimeTicks frame_time;
327 surface->RequestFrameCallback( 327 surface->RequestFrameCallback(
328 base::Bind(&SetFrameTime, base::Unretained(&frame_time))); 328 base::Bind(&SetFrameTime, base::Unretained(&frame_time)));
329 surface->Commit(); // Move callback from pending callbacks to current ones. 329 surface->Commit(); // Move callback from pending callbacks to current ones.
330 RunAllPendingInMessageLoop(); 330 RunAllPendingInMessageLoop();
331 331
332 // Surface should add itself as observer during WillDraw(). 332 // Surface should add itself as observer during
333 surface->WillDraw(); 333 // DidReceiveCompositorFrameAck().
334 surface->DidReceiveCompositorFrameAck();
334 EXPECT_EQ(1u, source.num_observers()); 335 EXPECT_EQ(1u, source.num_observers());
335 336
336 cc::BeginFrameArgs args(source.CreateBeginFrameArgs(BEGINFRAME_FROM_HERE)); 337 cc::BeginFrameArgs args(source.CreateBeginFrameArgs(BEGINFRAME_FROM_HERE));
337 args.frame_time = base::TimeTicks::FromInternalValue(100); 338 args.frame_time = base::TimeTicks::FromInternalValue(100);
338 source.TestOnBeginFrame(args); // Runs the frame callback. 339 source.TestOnBeginFrame(args); // Runs the frame callback.
339 EXPECT_EQ(args.frame_time, frame_time); 340 EXPECT_EQ(args.frame_time, frame_time);
340 341
341 surface->Commit(); // Acknowledges the BeginFrame. 342 surface->Commit(); // Acknowledges the BeginFrame.
342 RunAllPendingInMessageLoop(); 343 RunAllPendingInMessageLoop();
343 344
344 cc::BeginFrameAck expected_ack(args.source_id, args.sequence_number, 345 cc::BeginFrameAck expected_ack(args.source_id, args.sequence_number,
345 args.sequence_number, true); 346 args.sequence_number, true);
346 EXPECT_EQ(expected_ack, source.LastAckForObserver(surface.get())); 347 EXPECT_EQ(expected_ack, source.LastAckForObserver(surface.get()));
347 348
348 const cc::CompositorFrame& frame = GetFrameFromSurface(surface.get()); 349 const cc::CompositorFrame& frame = GetFrameFromSurface(surface.get());
349 EXPECT_EQ(expected_ack, frame.metadata.begin_frame_ack); 350 EXPECT_EQ(expected_ack, frame.metadata.begin_frame_ack);
350 } 351 }
351 352
352 } // namespace 353 } // namespace
353 } // namespace exo 354 } // namespace exo
OLDNEW
« no previous file with comments | « components/exo/surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698