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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 new CaptureTestRenderViewHostFactory(&controller_)); | 492 new CaptureTestRenderViewHostFactory(&controller_)); |
493 | 493 |
494 browser_context_.reset(new TestBrowserContext()); | 494 browser_context_.reset(new TestBrowserContext()); |
495 | 495 |
496 scoped_refptr<SiteInstance> site_instance = | 496 scoped_refptr<SiteInstance> site_instance = |
497 SiteInstance::Create(browser_context_.get()); | 497 SiteInstance::Create(browser_context_.get()); |
498 SiteInstanceImpl::set_render_process_host_factory( | 498 SiteInstanceImpl::set_render_process_host_factory( |
499 render_process_host_factory_.get()); | 499 render_process_host_factory_.get()); |
500 web_contents_.reset( | 500 web_contents_.reset( |
501 TestWebContents::Create(browser_context_.get(), site_instance.get())); | 501 TestWebContents::Create(browser_context_.get(), site_instance.get())); |
502 | 502 RenderFrameHost* const main_frame = web_contents_->GetMainFrame(); |
503 // This is actually a CaptureTestRenderViewHost. | 503 device_.reset(WebContentsVideoCaptureDevice::Create( |
504 RenderWidgetHostImpl* rwh = | 504 base::StringPrintf("web-contents-media-stream://%d:%d", |
505 RenderWidgetHostImpl::From(web_contents_->GetRenderViewHost()); | 505 main_frame->GetProcess()->GetID(), |
506 | 506 main_frame->GetRoutingID()))); |
507 std::string device_id = | |
508 WebContentsCaptureUtil::AppendWebContentsDeviceScheme( | |
509 base::StringPrintf("%d:%d", rwh->GetProcess()->GetID(), | |
510 rwh->GetRoutingID())); | |
511 | |
512 device_.reset(WebContentsVideoCaptureDevice::Create(device_id)); | |
513 | 507 |
514 base::RunLoop().RunUntilIdle(); | 508 base::RunLoop().RunUntilIdle(); |
515 } | 509 } |
516 | 510 |
517 virtual void TearDown() { | 511 virtual void TearDown() { |
518 // Tear down in opposite order of set-up. | 512 // Tear down in opposite order of set-up. |
519 | 513 |
520 // The device is destroyed asynchronously, and will notify the | 514 // The device is destroyed asynchronously, and will notify the |
521 // CaptureTestSourceController when it finishes destruction. | 515 // CaptureTestSourceController when it finishes destruction. |
522 // Trigger this, and wait. | 516 // Trigger this, and wait. |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 source()->SetSolidColor(SK_ColorGREEN); | 800 source()->SetSolidColor(SK_ColorGREEN); |
807 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); | 801 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); |
808 source()->SetSolidColor(SK_ColorRED); | 802 source()->SetSolidColor(SK_ColorRED); |
809 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); | 803 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorRED)); |
810 | 804 |
811 device()->StopAndDeAllocate(); | 805 device()->StopAndDeAllocate(); |
812 } | 806 } |
813 | 807 |
814 } // namespace | 808 } // namespace |
815 } // namespace content | 809 } // namespace content |
OLD | NEW |