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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 // our special subclass which has mocked-out tab capture support. | 244 // our special subclass which has mocked-out tab capture support. |
245 RenderWidgetHostView* old_view = GetView(); | 245 RenderWidgetHostView* old_view = GetView(); |
246 SetView(new CaptureTestView(this, controller)); | 246 SetView(new CaptureTestView(this, controller)); |
247 delete old_view; | 247 delete old_view; |
248 } | 248 } |
249 | 249 |
250 // TestRenderViewHost overrides. | 250 // TestRenderViewHost overrides. |
251 virtual void CopyFromBackingStore( | 251 virtual void CopyFromBackingStore( |
252 const gfx::Rect& src_rect, | 252 const gfx::Rect& src_rect, |
253 const gfx::Size& accelerated_dst_size, | 253 const gfx::Size& accelerated_dst_size, |
254 const base::Callback<void(bool, const SkBitmap&)>& callback, | 254 CopyFromCompositingSurfaceCallback& callback, |
255 const SkColorType color_type) OVERRIDE { | 255 const SkColorType color_type) OVERRIDE { |
256 gfx::Size size = controller_->GetCopyResultSize(); | 256 gfx::Size size = controller_->GetCopyResultSize(); |
257 SkColor color = controller_->GetSolidColor(); | 257 SkColor color = controller_->GetSolidColor(); |
258 | 258 |
259 // Although it's not necessary, use a PlatformBitmap here (instead of a | 259 // Although it's not necessary, use a PlatformBitmap here (instead of a |
260 // regular SkBitmap) to exercise possible threading issues. | 260 // regular SkBitmap) to exercise possible threading issues. |
261 skia::PlatformBitmap output; | 261 skia::PlatformBitmap output; |
262 EXPECT_TRUE(output.Allocate(size.width(), size.height(), false)); | 262 EXPECT_TRUE(output.Allocate(size.width(), size.height(), false)); |
263 { | 263 { |
264 SkAutoLockPixels locker(output.GetBitmap()); | 264 SkAutoLockPixels locker(output.GetBitmap()); |
265 output.GetBitmap().eraseColor(color); | 265 output.GetBitmap().eraseColor(color); |
266 } | 266 } |
267 callback.Run(true, output.GetBitmap()); | 267 callback.Run(true, output.GetBitmap(), content::READBACK_SUCCESS); |
268 controller_->SignalCopy(); | 268 controller_->SignalCopy(); |
269 } | 269 } |
270 | 270 |
271 private: | 271 private: |
272 CaptureTestSourceController* controller_; | 272 CaptureTestSourceController* controller_; |
273 | 273 |
274 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHost); | 274 DISALLOW_IMPLICIT_CONSTRUCTORS(CaptureTestRenderViewHost); |
275 }; | 275 }; |
276 | 276 |
277 #if defined(COMPILER_MSVC) | 277 #if defined(COMPILER_MSVC) |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
855 source()->SetSolidColor(SK_ColorGREEN); | 855 source()->SetSolidColor(SK_ColorGREEN); |
856 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 856 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
857 source()->SetSolidColor(SK_ColorRED); | 857 source()->SetSolidColor(SK_ColorRED); |
858 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); | 858 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); |
859 | 859 |
860 device()->StopAndDeAllocate(); | 860 device()->StopAndDeAllocate(); |
861 } | 861 } |
862 | 862 |
863 } // namespace | 863 } // namespace |
864 } // namespace content | 864 } // namespace content |
OLD | NEW |