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

Unified Diff: cc/surfaces/direct_compositor_frame_sink_unittest.cc

Issue 2854163003: [cc] Plumb BeginFrameAcks through SurfaceManager to DisplayScheduler. (Closed)
Patch Set: Pass ack via SurfaceDamaged, add back tests. 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 side-by-side diff with in-line comments
Download patch
Index: cc/surfaces/direct_compositor_frame_sink_unittest.cc
diff --git a/cc/surfaces/direct_compositor_frame_sink_unittest.cc b/cc/surfaces/direct_compositor_frame_sink_unittest.cc
index ddea81e0b41837abf8e30b0f1bf17bf95d5823e1..c50c220f3b2328c55e598edb929638d8594b75c4 100644
--- a/cc/surfaces/direct_compositor_frame_sink_unittest.cc
+++ b/cc/surfaces/direct_compositor_frame_sink_unittest.cc
@@ -21,6 +21,7 @@
#include "cc/test/fake_compositor_frame_sink_client.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/ordered_simple_task_runner.h"
+#include "cc/test/test_begin_frame_ack_tracker.h"
#include "cc/test/test_context_provider.h"
#include "cc/test/test_gpu_memory_buffer_manager.h"
#include "cc/test/test_shared_bitmap_manager.h"
@@ -47,6 +48,7 @@ class DirectCompositorFrameSinkTest : public testing::Test {
display_rect_(display_size_),
context_provider_(TestContextProvider::Create()) {
surface_manager_.RegisterFrameSinkId(kArbitraryFrameSinkId);
+ surface_manager_.AddObserver(&ack_tracker_);
std::unique_ptr<FakeOutputSurface> display_output_surface =
FakeOutputSurface::Create3d();
@@ -79,6 +81,7 @@ class DirectCompositorFrameSinkTest : public testing::Test {
~DirectCompositorFrameSinkTest() override {
compositor_frame_sink_->DetachFromClient();
+ surface_manager_.RemoveObserver(&ack_tracker_);
}
void SwapBuffersWithDamage(const gfx::Rect& damage_rect) {
@@ -117,6 +120,7 @@ class DirectCompositorFrameSinkTest : public testing::Test {
std::unique_ptr<Display> display_;
FakeCompositorFrameSinkClient compositor_frame_sink_client_;
std::unique_ptr<TestDirectCompositorFrameSink> compositor_frame_sink_;
+ TestBeginFrameAckTracker ack_tracker_;
};
TEST_F(DirectCompositorFrameSinkTest, DamageTriggersSwapBuffers) {
@@ -148,9 +152,19 @@ TEST_F(DirectCompositorFrameSinkTest, SuspendedDoesNotTriggerSwapBuffers) {
EXPECT_EQ(2u, display_output_surface_->num_sent_frames());
}
-// TODO(eseckler): Add back tests for BeginFrameAck forwarding through
-// DirectCompositorFrameSink and CompositorFrameSinkSupport when we add plumbing
-// of BeginFrameAcks through SurfaceObservers.
+TEST_F(DirectCompositorFrameSinkTest, AcknowledgesBeginFramesWithDamage) {
sunnyps 2017/05/25 20:49:13 nit: I don't think we need this test here because
Eric Seckler 2017/05/26 10:57:52 Done. (You're right, the only additional behavior
+ // Verify that the frame sink forwards the BeginFrameAck attached to
+ // CompositorFrame submitted during SetUp().
+ EXPECT_EQ(BeginFrameAck(0, 1, 1, true), ack_tracker_.last_ack());
+}
+
+TEST_F(DirectCompositorFrameSinkTest, AcknowledgesBeginFramesWithoutDamage) {
+ // Verify that the frame sink forwards the BeginFrameAck from
+ // DidNotProduceFrame().
+ BeginFrameAck ack(0, 2, 2, false);
+ compositor_frame_sink_->DidNotProduceFrame(ack);
+ EXPECT_EQ(ack, ack_tracker_.last_ack());
+}
} // namespace
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698