Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/barrier_closure.h" | 8 #include "base/barrier_closure.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 | 243 |
| 244 private: | 244 private: |
| 245 const CompositingMode compositing_mode_; | 245 const CompositingMode compositing_mode_; |
| 246 | 246 |
| 247 DISALLOW_COPY_AND_ASSIGN(CompositingRenderWidgetHostViewBrowserTest); | 247 DISALLOW_COPY_AND_ASSIGN(CompositingRenderWidgetHostViewBrowserTest); |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { | 250 class FakeFrameSubscriber : public RenderWidgetHostViewFrameSubscriber { |
| 251 public: | 251 public: |
| 252 FakeFrameSubscriber( | 252 FakeFrameSubscriber( |
| 253 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback) | 253 RenderWidgetHostViewFrameSubscriber::DeliverFrameCallback callback) |
| 254 : callback_(callback) { | 254 : callback_(callback), |
| 255 } | 255 source_id_for_copy_request_(base::UnguessableToken::Create()) {} |
| 256 | 256 |
| 257 bool ShouldCaptureFrame(const gfx::Rect& damage_rect, | 257 bool ShouldCaptureFrame(const gfx::Rect& damage_rect, |
| 258 base::TimeTicks present_time, | 258 base::TimeTicks present_time, |
| 259 scoped_refptr<media::VideoFrame>* storage, | 259 scoped_refptr<media::VideoFrame>* storage, |
| 260 DeliverFrameCallback* callback) override { | 260 DeliverFrameCallback* callback) override { |
| 261 // Only allow one frame capture to be made. Otherwise, the compositor could | 261 // Only allow one frame capture to be made. Otherwise, the compositor could |
| 262 // start multiple captures, unbounded, and eventually its own limiter logic | 262 // start multiple captures, unbounded, and eventually its own limiter logic |
| 263 // will begin invoking |callback| with a |false| result. This flakes out | 263 // will begin invoking |callback| with a |false| result. This flakes out |
| 264 // the unit tests, since they receive a "failed" callback before the later | 264 // the unit tests, since they receive a "failed" callback before the later |
| 265 // "success" callbacks. | 265 // "success" callbacks. |
| 266 if (callback_.is_null()) | 266 if (callback_.is_null()) |
| 267 return false; | 267 return false; |
| 268 *storage = media::VideoFrame::CreateBlackFrame(gfx::Size(100, 100)); | 268 *storage = media::VideoFrame::CreateBlackFrame(gfx::Size(100, 100)); |
| 269 *callback = callback_; | 269 *callback = callback_; |
| 270 callback_.Reset(); | 270 callback_.Reset(); |
| 271 return true; | 271 return true; |
| 272 } | 272 } |
| 273 | 273 |
| 274 base::UnguessableToken GetSourceIdForCopyRequest() override { | |
|
Fady Samuel
2017/01/26 21:22:42
const base::UnguessableToken&
Saman Sami
2017/01/26 21:47:27
Done.
| |
| 275 return source_id_for_copy_request_; | |
| 276 } | |
| 277 | |
| 274 private: | 278 private: |
| 275 DeliverFrameCallback callback_; | 279 DeliverFrameCallback callback_; |
| 280 base::UnguessableToken source_id_for_copy_request_; | |
| 276 }; | 281 }; |
| 277 | 282 |
| 278 // Disable tests for Android as it has an incomplete implementation. | 283 // Disable tests for Android as it has an incomplete implementation. |
| 279 #if !defined(OS_ANDROID) | 284 #if !defined(OS_ANDROID) |
| 280 | 285 |
| 281 // The CopyFromBackingStore() API should work on all platforms when compositing | 286 // The CopyFromBackingStore() API should work on all platforms when compositing |
| 282 // is enabled. | 287 // is enabled. |
| 283 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, | 288 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, |
| 284 CopyFromBackingStore) { | 289 CopyFromBackingStore) { |
| 285 RunBasicCopyFromBackingStoreTest(); | 290 RunBasicCopyFromBackingStoreTest(); |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 945 kTestCompositingModes); | 950 kTestCompositingModes); |
| 946 INSTANTIATE_TEST_CASE_P( | 951 INSTANTIATE_TEST_CASE_P( |
| 947 GLAndSoftwareCompositing, | 952 GLAndSoftwareCompositing, |
| 948 CompositingRenderWidgetHostViewBrowserTestTabCaptureHighDPI, | 953 CompositingRenderWidgetHostViewBrowserTestTabCaptureHighDPI, |
| 949 kTestCompositingModes); | 954 kTestCompositingModes); |
| 950 | 955 |
| 951 #endif // !defined(OS_ANDROID) | 956 #endif // !defined(OS_ANDROID) |
| 952 | 957 |
| 953 } // namespace | 958 } // namespace |
| 954 } // namespace content | 959 } // namespace content |
| OLD | NEW |