| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/media/capture/web_contents_video_capture_device.h" | 5 #include "content/browser/media/capture/web_contents_video_capture_device.h" |
| 6 | 6 |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/debug/debugger.h" | 8 #include "base/debug/debugger.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 266 } |
| 267 | 267 |
| 268 // TestRenderViewHost overrides. | 268 // TestRenderViewHost overrides. |
| 269 void CopyFromBackingStore(const gfx::Rect& src_rect, | 269 void CopyFromBackingStore(const gfx::Rect& src_rect, |
| 270 const gfx::Size& accelerated_dst_size, | 270 const gfx::Size& accelerated_dst_size, |
| 271 const ReadbackRequestCallback& callback, | 271 const ReadbackRequestCallback& callback, |
| 272 const SkColorType color_type) override { | 272 const SkColorType color_type) override { |
| 273 gfx::Size size = controller_->GetCopyResultSize(); | 273 gfx::Size size = controller_->GetCopyResultSize(); |
| 274 SkColor color = controller_->GetSolidColor(); | 274 SkColor color = controller_->GetSolidColor(); |
| 275 | 275 |
| 276 // Although it's not necessary, use a PlatformBitmap here (instead of a | 276 SkBitmap output; |
| 277 // regular SkBitmap) to exercise possible threading issues. | 277 EXPECT_TRUE(output.tryAllocN32Pixels(size.width(), size.height())); |
| 278 skia::PlatformBitmap output; | |
| 279 EXPECT_TRUE(output.Allocate(size.width(), size.height(), false)); | |
| 280 { | 278 { |
| 281 SkAutoLockPixels locker(output.GetBitmap()); | 279 SkAutoLockPixels locker(output); |
| 282 output.GetBitmap().eraseColor(color); | 280 output.eraseColor(color); |
| 283 } | 281 } |
| 284 callback.Run(output.GetBitmap(), content::READBACK_SUCCESS); | 282 callback.Run(output, content::READBACK_SUCCESS); |
| 285 controller_->SignalCopy(); | 283 controller_->SignalCopy(); |
| 286 } | 284 } |
| 287 | 285 |
| 288 private: | 286 private: |
| 289 CaptureTestSourceController* controller_; | 287 CaptureTestSourceController* controller_; |
| 290 | 288 |
| 291 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHost); | 289 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHost); |
| 292 }; | 290 }; |
| 293 | 291 |
| 294 #if defined(COMPILER_MSVC) | 292 #if defined(COMPILER_MSVC) |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1133 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); | 1131 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); |
| 1134 RunTestForPreferredSize( | 1132 RunTestForPreferredSize( |
| 1135 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); | 1133 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); |
| 1136 RunTestForPreferredSize( | 1134 RunTestForPreferredSize( |
| 1137 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); | 1135 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); |
| 1138 } | 1136 } |
| 1139 } | 1137 } |
| 1140 | 1138 |
| 1141 } // namespace | 1139 } // namespace |
| 1142 } // namespace content | 1140 } // namespace content |
| OLD | NEW |