Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: content/browser/media/capture/web_contents_video_capture_device_unittest.cc

Issue 2861433002: Implement ProcessReusePolicy for SiteInstances (Closed)
Patch Set: Fixed ChromeOS issue Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 render_process_host_factory_.reset(new MockRenderProcessHostFactory()); 472 render_process_host_factory_.reset(new MockRenderProcessHostFactory());
473 // Create our (self-registering) RVH factory, so that when we create a 473 // Create our (self-registering) RVH factory, so that when we create a
474 // WebContents, it in turn creates CaptureTestRenderViewHosts. 474 // WebContents, it in turn creates CaptureTestRenderViewHosts.
475 render_view_host_factory_.reset(new CaptureTestRenderViewHostFactory()); 475 render_view_host_factory_.reset(new CaptureTestRenderViewHostFactory());
476 render_frame_host_factory_.reset(new TestRenderFrameHostFactory()); 476 render_frame_host_factory_.reset(new TestRenderFrameHostFactory());
477 477
478 browser_context_.reset(new TestBrowserContext()); 478 browser_context_.reset(new TestBrowserContext());
479 479
480 scoped_refptr<SiteInstance> site_instance = 480 scoped_refptr<SiteInstance> site_instance =
481 SiteInstance::Create(browser_context_.get()); 481 SiteInstance::Create(browser_context_.get());
482 SiteInstanceImpl::set_render_process_host_factory( 482 RenderProcessHostImpl::set_render_process_host_factory(
483 render_process_host_factory_.get()); 483 render_process_host_factory_.get());
484 web_contents_.reset( 484 web_contents_.reset(
485 TestWebContents::Create(browser_context_.get(), site_instance.get())); 485 TestWebContents::Create(browser_context_.get(), site_instance.get()));
486 RenderFrameHost* const main_frame = web_contents_->GetMainFrame(); 486 RenderFrameHost* const main_frame = web_contents_->GetMainFrame();
487 device_ = WebContentsVideoCaptureDevice::Create(base::StringPrintf( 487 device_ = WebContentsVideoCaptureDevice::Create(base::StringPrintf(
488 "web-contents-media-stream://%d:%d", main_frame->GetProcess()->GetID(), 488 "web-contents-media-stream://%d:%d", main_frame->GetProcess()->GetID(),
489 main_frame->GetRoutingID())); 489 main_frame->GetRoutingID()));
490 490
491 base::RunLoop().RunUntilIdle(); 491 base::RunLoop().RunUntilIdle();
492 } 492 }
493 493
494 void TearDown() override { 494 void TearDown() override {
495 // Tear down in opposite order of set-up. 495 // Tear down in opposite order of set-up.
496 496
497 if (device_) { 497 if (device_) {
498 device_->StopAndDeAllocate(); 498 device_->StopAndDeAllocate();
499 device_.reset(); 499 device_.reset();
500 } 500 }
501 501
502 base::RunLoop().RunUntilIdle(); 502 base::RunLoop().RunUntilIdle();
503 503
504 // Destroy the browser objects. 504 // Destroy the browser objects.
505 web_contents_.reset(); 505 web_contents_.reset();
506 browser_context_.reset(); 506 browser_context_.reset();
507 507
508 base::RunLoop().RunUntilIdle(); 508 base::RunLoop().RunUntilIdle();
509 509
510 SiteInstanceImpl::set_render_process_host_factory(NULL); 510 RenderProcessHostImpl::set_render_process_host_factory(NULL);
511 render_frame_host_factory_.reset(); 511 render_frame_host_factory_.reset();
512 render_view_host_factory_.reset(); 512 render_view_host_factory_.reset();
513 render_process_host_factory_.reset(); 513 render_process_host_factory_.reset();
514 514
515 display::Screen::SetScreenInstance(nullptr); 515 display::Screen::SetScreenInstance(nullptr);
516 } 516 }
517 517
518 // Accessors. 518 // Accessors.
519 WebContents* web_contents() const { return web_contents_.get(); } 519 WebContents* web_contents() const { return web_contents_.get(); }
520 CaptureTestView* test_view() const { 520 CaptureTestView* test_view() const {
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 for (int i = 0; i < 3; ++i) { 1034 for (int i = 0; i < 3; ++i) {
1035 SimulateRefreshFrameRequest(); 1035 SimulateRefreshFrameRequest();
1036 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN)); 1036 ASSERT_NO_FATAL_FAILURE(client_observer()->WaitForNextColor(SK_ColorGREEN));
1037 } 1037 }
1038 1038
1039 device()->StopAndDeAllocate(); 1039 device()->StopAndDeAllocate();
1040 } 1040 }
1041 1041
1042 } // namespace 1042 } // namespace
1043 } // namespace content 1043 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browsing_instance.cc ('k') | content/browser/media/session/audio_focus_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698