| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 // Tests that BeginFrameAcks are forwarded correctly from the |
| 248 // SwapCompositorFrame and OnBeginFrameDidNotSwap IPCs through the | 248 // SwapCompositorFrame and OnBeginFrameDidNotProduceFrame IPCs through the |
| 249 // CompositorFrameSinkSupport. | 249 // CompositorFrameSinkSupport. |
| 250 TEST_F(RenderWidgetHostViewChildFrameTest, ForwardsBeginFrameAcks) { | 250 TEST_F(RenderWidgetHostViewChildFrameTest, ForwardsBeginFrameAcks) { |
| 251 gfx::Size view_size(100, 100); | 251 gfx::Size view_size(100, 100); |
| 252 gfx::Rect view_rect(view_size); | 252 gfx::Rect view_rect(view_size); |
| 253 float scale_factor = 1.f; | 253 float scale_factor = 1.f; |
| 254 | 254 |
| 255 view_->SetSize(view_size); | 255 view_->SetSize(view_size); |
| 256 view_->Show(); | 256 view_->Show(); |
| 257 | 257 |
| 258 // Replace BeginFrameSource so that we can observe acknowledgments. | 258 // Replace BeginFrameSource so that we can observe acknowledgments. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 273 frame.metadata.begin_frame_ack = ack; | 273 frame.metadata.begin_frame_ack = ack; |
| 274 view_->SubmitCompositorFrame(kArbitraryLocalSurfaceId, std::move(frame)); | 274 view_->SubmitCompositorFrame(kArbitraryLocalSurfaceId, std::move(frame)); |
| 275 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); | 275 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); |
| 276 } | 276 } |
| 277 | 277 |
| 278 { | 278 { |
| 279 cc::BeginFrameArgs args = | 279 cc::BeginFrameArgs args = |
| 280 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 6u); | 280 cc::CreateBeginFrameArgsForTesting(BEGINFRAME_FROM_HERE, source_id, 6u); |
| 281 source.TestOnBeginFrame(args); | 281 source.TestOnBeginFrame(args); |
| 282 | 282 |
| 283 // Explicit ack through OnBeginFrameDidNotSwap is forwarded. | 283 // Explicit ack through OnBeginFrameDidNotProduceFrame is forwarded. |
| 284 cc::BeginFrameAck ack(source_id, 6, 4, false); | 284 cc::BeginFrameAck ack(source_id, 6, 4, false); |
| 285 view_->OnBeginFrameDidNotSwap(ack); | 285 view_->OnBeginFrameDidNotProduceFrame(ack); |
| 286 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); | 286 EXPECT_EQ(ack, source.LastAckForObserver(view_->support_.get())); |
| 287 } | 287 } |
| 288 | 288 |
| 289 view_->SetNeedsBeginFrames(false); | 289 view_->SetNeedsBeginFrames(false); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace content | 292 } // namespace content |
| OLD | NEW |