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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 void ResetWebContents() { | 583 void ResetWebContents() { |
584 web_contents_.reset(); | 584 web_contents_.reset(); |
585 } | 585 } |
586 | 586 |
587 protected: | 587 protected: |
588 void SetUp() override { | 588 void SetUp() override { |
589 test_screen_.display()->set_id(0x1337); | 589 test_screen_.display()->set_id(0x1337); |
590 test_screen_.display()->set_bounds(gfx::Rect(0, 0, 2560, 1440)); | 590 test_screen_.display()->set_bounds(gfx::Rect(0, 0, 2560, 1440)); |
591 test_screen_.display()->set_device_scale_factor(kTestDeviceScaleFactor); | 591 test_screen_.display()->set_device_scale_factor(kTestDeviceScaleFactor); |
592 | 592 |
593 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, &test_screen_); | 593 gfx::Screen::SetScreenInstance(&test_screen_); |
594 ASSERT_EQ(&test_screen_, gfx::Screen::GetNativeScreen()); | 594 ASSERT_EQ(&test_screen_, gfx::Screen::GetScreen()); |
595 | 595 |
596 // TODO(nick): Sadness and woe! Much "mock-the-world" boilerplate could be | 596 // TODO(nick): Sadness and woe! Much "mock-the-world" boilerplate could be |
597 // eliminated here, if only we could use RenderViewHostTestHarness. The | 597 // eliminated here, if only we could use RenderViewHostTestHarness. The |
598 // catch is that we need our TestRenderViewHost to support a | 598 // catch is that we need our TestRenderViewHost to support a |
599 // CopyFromBackingStore operation that we control. To accomplish that, | 599 // CopyFromBackingStore operation that we control. To accomplish that, |
600 // either RenderViewHostTestHarness would have to support installing a | 600 // either RenderViewHostTestHarness would have to support installing a |
601 // custom RenderViewHostFactory, or else we implant some kind of delegated | 601 // custom RenderViewHostFactory, or else we implant some kind of delegated |
602 // CopyFromBackingStore functionality into TestRenderViewHost itself. | 602 // CopyFromBackingStore functionality into TestRenderViewHost itself. |
603 | 603 |
604 render_process_host_factory_.reset(new MockRenderProcessHostFactory()); | 604 render_process_host_factory_.reset(new MockRenderProcessHostFactory()); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 web_contents_.reset(); | 642 web_contents_.reset(); |
643 browser_context_.reset(); | 643 browser_context_.reset(); |
644 | 644 |
645 base::RunLoop().RunUntilIdle(); | 645 base::RunLoop().RunUntilIdle(); |
646 | 646 |
647 SiteInstanceImpl::set_render_process_host_factory(NULL); | 647 SiteInstanceImpl::set_render_process_host_factory(NULL); |
648 render_frame_host_factory_.reset(); | 648 render_frame_host_factory_.reset(); |
649 render_view_host_factory_.reset(); | 649 render_view_host_factory_.reset(); |
650 render_process_host_factory_.reset(); | 650 render_process_host_factory_.reset(); |
651 | 651 |
652 gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL); | 652 gfx::Screen::SetScreenInstance(NULL); |
653 } | 653 } |
654 | 654 |
655 // Accessors. | 655 // Accessors. |
656 CaptureTestSourceController* source() { return &controller_; } | 656 CaptureTestSourceController* source() { return &controller_; } |
657 WebContents* web_contents() const { return web_contents_.get(); } | 657 WebContents* web_contents() const { return web_contents_.get(); } |
658 media::VideoCaptureDevice* device() { return device_.get(); } | 658 media::VideoCaptureDevice* device() { return device_.get(); } |
659 | 659 |
660 // Returns the device scale factor of the capture target's native view. This | 660 // Returns the device scale factor of the capture target's native view. This |
661 // is necessary because, architecturally, the TestScreen implementation is | 661 // is necessary because, architecturally, the TestScreen implementation is |
662 // ignored on Mac platforms (when determining the device scale factor for a | 662 // ignored on Mac platforms (when determining the device scale factor for a |
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); | 1149 policies[i], gfx::Size(1000, 1000), gfx::Size(1000, 1000)); |
1150 RunTestForPreferredSize( | 1150 RunTestForPreferredSize( |
1151 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); | 1151 policies[i], gfx::Size(1600, 1000), gfx::Size(1600, 1000)); |
1152 RunTestForPreferredSize( | 1152 RunTestForPreferredSize( |
1153 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); | 1153 policies[i], gfx::Size(837, 999), gfx::Size(837, 999)); |
1154 } | 1154 } |
1155 } | 1155 } |
1156 | 1156 |
1157 } // namespace | 1157 } // namespace |
1158 } // namespace content | 1158 } // namespace content |
OLD | NEW |