| 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/renderer_host/media/web_contents_video_capture_device.
h" | 5 #include "content/browser/renderer_host/media/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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 render_process_host_factory_.reset(new MockRenderProcessHostFactory()); | 440 render_process_host_factory_.reset(new MockRenderProcessHostFactory()); |
| 441 // Create our (self-registering) RVH factory, so that when we create a | 441 // Create our (self-registering) RVH factory, so that when we create a |
| 442 // WebContents, it in turn creates CaptureTestRenderViewHosts. | 442 // WebContents, it in turn creates CaptureTestRenderViewHosts. |
| 443 render_view_host_factory_.reset( | 443 render_view_host_factory_.reset( |
| 444 new CaptureTestRenderViewHostFactory(&controller_)); | 444 new CaptureTestRenderViewHostFactory(&controller_)); |
| 445 | 445 |
| 446 browser_context_.reset(new TestBrowserContext()); | 446 browser_context_.reset(new TestBrowserContext()); |
| 447 | 447 |
| 448 scoped_refptr<SiteInstance> site_instance = | 448 scoped_refptr<SiteInstance> site_instance = |
| 449 SiteInstance::Create(browser_context_.get()); | 449 SiteInstance::Create(browser_context_.get()); |
| 450 static_cast<SiteInstanceImpl*>(site_instance.get())-> | 450 SiteInstanceImpl::set_render_process_host_factory( |
| 451 set_render_process_host_factory(render_process_host_factory_.get()); | 451 render_process_host_factory_.get()); |
| 452 web_contents_.reset( | 452 web_contents_.reset( |
| 453 TestWebContents::Create(browser_context_.get(), site_instance.get())); | 453 TestWebContents::Create(browser_context_.get(), site_instance.get())); |
| 454 | 454 |
| 455 // This is actually a CaptureTestRenderViewHost. | 455 // This is actually a CaptureTestRenderViewHost. |
| 456 RenderWidgetHostImpl* rwh = | 456 RenderWidgetHostImpl* rwh = |
| 457 RenderWidgetHostImpl::From(web_contents_->GetRenderViewHost()); | 457 RenderWidgetHostImpl::From(web_contents_->GetRenderViewHost()); |
| 458 | 458 |
| 459 std::string device_id = | 459 std::string device_id = |
| 460 WebContentsCaptureUtil::AppendWebContentsDeviceScheme( | 460 WebContentsCaptureUtil::AppendWebContentsDeviceScheme( |
| 461 base::StringPrintf("%d:%d", rwh->GetProcess()->GetID(), | 461 base::StringPrintf("%d:%d", rwh->GetProcess()->GetID(), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 478 } | 478 } |
| 479 | 479 |
| 480 content::RunAllPendingInMessageLoop(); | 480 content::RunAllPendingInMessageLoop(); |
| 481 | 481 |
| 482 // Destroy the browser objects. | 482 // Destroy the browser objects. |
| 483 web_contents_.reset(); | 483 web_contents_.reset(); |
| 484 browser_context_.reset(); | 484 browser_context_.reset(); |
| 485 | 485 |
| 486 content::RunAllPendingInMessageLoop(); | 486 content::RunAllPendingInMessageLoop(); |
| 487 | 487 |
| 488 SiteInstanceImpl::set_render_process_host_factory(NULL); |
| 488 render_view_host_factory_.reset(); | 489 render_view_host_factory_.reset(); |
| 489 render_process_host_factory_.reset(); | 490 render_process_host_factory_.reset(); |
| 490 } | 491 } |
| 491 | 492 |
| 492 // Accessors. | 493 // Accessors. |
| 493 CaptureTestSourceController* source() { return &controller_; } | 494 CaptureTestSourceController* source() { return &controller_; } |
| 494 media::VideoCaptureDevice* device() { return device_.get(); } | 495 media::VideoCaptureDevice* device() { return device_.get(); } |
| 495 StubConsumer* consumer() { return &consumer_; } | 496 StubConsumer* consumer() { return &consumer_; } |
| 496 | 497 |
| 497 void SimulateDrawEvent() { | 498 void SimulateDrawEvent() { |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); | 726 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorGREEN)); |
| 726 source()->SetSolidColor(SK_ColorRED); | 727 source()->SetSolidColor(SK_ColorRED); |
| 727 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); | 728 ASSERT_NO_FATAL_FAILURE(consumer()->WaitForNextColor(SK_ColorRED)); |
| 728 | 729 |
| 729 device()->Stop(); | 730 device()->Stop(); |
| 730 device()->DeAllocate(); | 731 device()->DeAllocate(); |
| 731 } | 732 } |
| 732 | 733 |
| 733 } // namespace | 734 } // namespace |
| 734 } // namespace content | 735 } // namespace content |
| OLD | NEW |