Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/frame_host/render_widget_host_view_child_frame.h" | 5 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 | 237 |
| 238 // Submit another frame with the same local surface id. The same id should be | 238 // Submit another frame with the same local surface id. The same id should be |
| 239 // usable. | 239 // usable. |
| 240 view_->SubmitCompositorFrame( | 240 view_->SubmitCompositorFrame( |
| 241 kArbitraryLocalSurfaceId, | 241 kArbitraryLocalSurfaceId, |
| 242 CreateDelegatedFrame(scale_factor, view_size, view_rect)); | 242 CreateDelegatedFrame(scale_factor, view_size, view_rect)); |
| 243 EXPECT_EQ(kArbitraryLocalSurfaceId, GetLocalSurfaceId()); | 243 EXPECT_EQ(kArbitraryLocalSurfaceId, GetLocalSurfaceId()); |
| 244 EXPECT_TRUE(view_->has_frame()); | 244 EXPECT_TRUE(view_->has_frame()); |
| 245 } | 245 } |
| 246 | 246 |
| 247 // Tests that BeginFrameAcks are forwarded correctly from the | 247 // TODO(eseckler): Add back tests for BeginFrameAck forwarding through |
| 248 // SwapCompositorFrame and DidNotProduceFrame IPCs through the | 248 // RenderWidgetHostViewChildFrame and CompositorFrameSinkSupport when we add |
| 249 // CompositorFrameSinkSupport. | 249 // plumbing of BeginFrameAcks through SurfaceObservers. |
|
piman
2017/05/23 17:53:17
What is the plan for bringing back these tests? Sh
Eric Seckler
2017/05/23 18:01:11
I'll add them to https://codereview.chromium.org/2
| |
| 250 TEST_F(RenderWidgetHostViewChildFrameTest, ForwardsBeginFrameAcks) { | |
| 251 gfx::Size view_size(100, 100); | |
| 252 gfx::Rect view_rect(view_size); | |
| 253 float scale_factor = 1.f; | |
| 254 | |
| 255 view_->SetSize(view_size); | |
| 256 view_->Show(); | |
| 257 | |
| 258 // Replace BeginFrameSource so that we can observe acknowledgments. | |
| 259 cc::FakeExternalBeginFrameSource source(0.f, false); | |
| 260 uint32_t source_id = source.source_id(); | |
| 261 view_->support_->SetBeginFrameSource(&source); | |
| 262 view_->SetNeedsBeginFrames(true); | |
| 263 | |
| 264 { | |
| 265 cc::BeginFrameArgs args = | |
| 266 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 5u); | |
| 267 source.TestOnBeginFrame(args); | |
| 268 | |
| 269 // Ack from CompositorFrame is forwarded. | |
| 270 cc::BeginFrameAck ack(source_id, 5, 4, true); | |
| 271 cc::CompositorFrame frame = | |
| 272 CreateDelegatedFrame(scale_factor, view_size, view_rect); | |
| 273 frame.metadata.begin_frame_ack = ack; | |
| 274 view_->SubmitCompositorFrame(kArbitraryLocalSurfaceId, std::move(frame)); | |
| 275 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); | |
| 276 } | |
| 277 | |
| 278 { | |
| 279 cc::BeginFrameArgs args = | |
| 280 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 6u); | |
| 281 source.TestOnBeginFrame(args); | |
| 282 | |
| 283 // Explicit ack through OnDidNotProduceFrame is forwarded. | |
| 284 cc::BeginFrameAck ack(source_id, 6, 4, false); | |
| 285 view_->OnDidNotProduceFrame(ack); | |
| 286 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); | |
| 287 } | |
| 288 | |
| 289 view_->SetNeedsBeginFrames(false); | |
| 290 } | |
| 291 | 250 |
| 292 } // namespace content | 251 } // namespace content |
| OLD | NEW |