| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/barrier_closure.h" | 5 #include "base/barrier_closure.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 gfx::Rect(view->GetViewBounds().size()), dest, base::Bind( | 322 gfx::Rect(view->GetViewBounds().size()), dest, base::Bind( |
| 323 &RenderWidgetHostViewBrowserTest::FinishCopyFromCompositingSurface, | 323 &RenderWidgetHostViewBrowserTest::FinishCopyFromCompositingSurface, |
| 324 base::Unretained(this), run_loop.QuitClosure())); | 324 base::Unretained(this), run_loop.QuitClosure())); |
| 325 run_loop.Run(); | 325 run_loop.Run(); |
| 326 | 326 |
| 327 EXPECT_EQ(1, callback_invoke_count()); | 327 EXPECT_EQ(1, callback_invoke_count()); |
| 328 } | 328 } |
| 329 | 329 |
| 330 // Test basic frame subscription functionality. We subscribe, and then run | 330 // Test basic frame subscription functionality. We subscribe, and then run |
| 331 // until at least one DeliverFrameCallback has been invoked. | 331 // until at least one DeliverFrameCallback has been invoked. |
| 332 // https://crbug.com/542896 | |
| 333 #if defined(MEMORY_SANITIZER) | |
| 334 #define MAYBE_FrameSubscriberTest DISABLED_FrameSubscriberTest | |
| 335 #else | |
| 336 #define MAYBE_FrameSubscriberTest FrameSubscriberTest | |
| 337 #endif | |
| 338 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, | 332 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, |
| 339 MAYBE_FrameSubscriberTest) { | 333 FrameSubscriberTest) { |
| 340 SET_UP_SURFACE_OR_PASS_TEST(NULL); | 334 SET_UP_SURFACE_OR_PASS_TEST(NULL); |
| 341 RenderWidgetHostViewBase* const view = GetRenderWidgetHostView(); | 335 RenderWidgetHostViewBase* const view = GetRenderWidgetHostView(); |
| 342 | 336 |
| 343 base::RunLoop run_loop; | 337 base::RunLoop run_loop; |
| 344 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber( | 338 scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber( |
| 345 new FakeFrameSubscriber(base::Bind( | 339 new FakeFrameSubscriber(base::Bind( |
| 346 &RenderWidgetHostViewBrowserTest::FrameDelivered, | 340 &RenderWidgetHostViewBrowserTest::FrameDelivered, |
| 347 base::Unretained(this), base::ThreadTaskRunnerHandle::Get(), | 341 base::Unretained(this), base::ThreadTaskRunnerHandle::Get(), |
| 348 run_loop.QuitClosure()))); | 342 run_loop.QuitClosure()))); |
| 349 view->BeginFrameSubscription(subscriber.Pass()); | 343 view->BeginFrameSubscription(subscriber.Pass()); |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 private: | 691 private: |
| 698 // |readback_response_| is always a content::ReadbackResponse or | 692 // |readback_response_| is always a content::ReadbackResponse or |
| 699 // ExtraReadbackResponsesForTest enum value. | 693 // ExtraReadbackResponsesForTest enum value. |
| 700 int readback_response_; | 694 int readback_response_; |
| 701 SkBitmap expected_copy_from_compositing_surface_bitmap_; | 695 SkBitmap expected_copy_from_compositing_surface_bitmap_; |
| 702 int allowable_error_; | 696 int allowable_error_; |
| 703 gfx::Rect exclude_rect_; | 697 gfx::Rect exclude_rect_; |
| 704 std::string test_url_; | 698 std::string test_url_; |
| 705 }; | 699 }; |
| 706 | 700 |
| 707 // https://crbug.com/542896 | |
| 708 #if defined(MEMORY_SANITIZER) | |
| 709 #define MAYBE_CopyFromCompositingSurface_Origin_Unscaled \ | |
| 710 DISABLED_CopyFromCompositingSurface_Origin_Unscaled | |
| 711 #else | |
| 712 #define MAYBE_CopyFromCompositingSurface_Origin_Unscaled \ | |
| 713 CopyFromCompositingSurface_Origin_Unscaled | |
| 714 #endif | |
| 715 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, | 701 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, |
| 716 MAYBE_CopyFromCompositingSurface_Origin_Unscaled) { | 702 CopyFromCompositingSurface_Origin_Unscaled) { |
| 717 gfx::Rect copy_rect(400, 300); | 703 gfx::Rect copy_rect(400, 300); |
| 718 gfx::Size output_size = copy_rect.size(); | 704 gfx::Size output_size = copy_rect.size(); |
| 719 gfx::Size html_rect_size(400, 300); | 705 gfx::Size html_rect_size(400, 300); |
| 720 bool video_frame = false; | 706 bool video_frame = false; |
| 721 PerformTestWithLeftRightRects(html_rect_size, | 707 PerformTestWithLeftRightRects(html_rect_size, |
| 722 copy_rect, | 708 copy_rect, |
| 723 output_size, | 709 output_size, |
| 724 video_frame); | 710 video_frame); |
| 725 } | 711 } |
| 726 | 712 |
| 727 // https://crbug.com/542896 | |
| 728 #if defined(MEMORY_SANITIZER) | |
| 729 #define MAYBE_CopyFromCompositingSurface_Origin_Scaled \ | |
| 730 DISABLED_FrameSubscriberTestCopyFromCompositingSurface_Origin_Scaled | |
| 731 #else | |
| 732 #define MAYBE_CopyFromCompositingSurface_Origin_Scaled \ | |
| 733 CopyFromCompositingSurface_Origin_Scaled | |
| 734 #endif | |
| 735 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, | 713 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, |
| 736 MAYBE_CopyFromCompositingSurface_Origin_Scaled) { | 714 CopyFromCompositingSurface_Origin_Scaled) { |
| 737 gfx::Rect copy_rect(400, 300); | 715 gfx::Rect copy_rect(400, 300); |
| 738 gfx::Size output_size(200, 100); | 716 gfx::Size output_size(200, 100); |
| 739 gfx::Size html_rect_size(400, 300); | 717 gfx::Size html_rect_size(400, 300); |
| 740 bool video_frame = false; | 718 bool video_frame = false; |
| 741 PerformTestWithLeftRightRects(html_rect_size, | 719 PerformTestWithLeftRightRects(html_rect_size, |
| 742 copy_rect, | 720 copy_rect, |
| 743 output_size, | 721 output_size, |
| 744 video_frame); | 722 video_frame); |
| 745 } | 723 } |
| 746 | 724 |
| 747 // https://crbug.com/542896 | |
| 748 #if defined(MEMORY_SANITIZER) | |
| 749 #define MAYBE_CopyFromCompositingSurface_Cropped_Unscaled \ | |
| 750 DISABLED_CopyFromCompositingSurface_Cropped_Unscaled | |
| 751 #else | |
| 752 #define MAYBE_CopyFromCompositingSurface_Cropped_Unscaled \ | |
| 753 CopyFromCompositingSurface_Cropped_Unscaled | |
| 754 #endif | |
| 755 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, | 725 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, |
| 756 MAYBE_CopyFromCompositingSurface_Cropped_Unscaled) { | 726 CopyFromCompositingSurface_Cropped_Unscaled) { |
| 757 // Grab 60x60 pixels from the center of the tab contents. | 727 // Grab 60x60 pixels from the center of the tab contents. |
| 758 gfx::Rect copy_rect(400, 300); | 728 gfx::Rect copy_rect(400, 300); |
| 759 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(30, 30), | 729 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(30, 30), |
| 760 gfx::Size(60, 60)); | 730 gfx::Size(60, 60)); |
| 761 gfx::Size output_size = copy_rect.size(); | 731 gfx::Size output_size = copy_rect.size(); |
| 762 gfx::Size html_rect_size(400, 300); | 732 gfx::Size html_rect_size(400, 300); |
| 763 bool video_frame = false; | 733 bool video_frame = false; |
| 764 PerformTestWithLeftRightRects(html_rect_size, | 734 PerformTestWithLeftRightRects(html_rect_size, |
| 765 copy_rect, | 735 copy_rect, |
| 766 output_size, | 736 output_size, |
| 767 video_frame); | 737 video_frame); |
| 768 } | 738 } |
| 769 | 739 |
| 770 // https://crbug.com/542896 | |
| 771 #if defined(MEMORY_SANITIZER) | |
| 772 #define MAYBE_CopyFromCompositingSurface_Cropped_Scaled \ | |
| 773 DISABLED_CopyFromCompositingSurface_Cropped_Scaled | |
| 774 #else | |
| 775 #define MAYBE_CopyFromCompositingSurface_Cropped_Scaled \ | |
| 776 CopyFromCompositingSurface_Cropped_Scaled | |
| 777 #endif | |
| 778 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, | 740 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, |
| 779 MAYBE_CopyFromCompositingSurface_Cropped_Scaled) { | 741 CopyFromCompositingSurface_Cropped_Scaled) { |
| 780 // Grab 60x60 pixels from the center of the tab contents. | 742 // Grab 60x60 pixels from the center of the tab contents. |
| 781 gfx::Rect copy_rect(400, 300); | 743 gfx::Rect copy_rect(400, 300); |
| 782 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(30, 30), | 744 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(30, 30), |
| 783 gfx::Size(60, 60)); | 745 gfx::Size(60, 60)); |
| 784 gfx::Size output_size(20, 10); | 746 gfx::Size output_size(20, 10); |
| 785 gfx::Size html_rect_size(400, 300); | 747 gfx::Size html_rect_size(400, 300); |
| 786 bool video_frame = false; | 748 bool video_frame = false; |
| 787 PerformTestWithLeftRightRects(html_rect_size, | 749 PerformTestWithLeftRightRects(html_rect_size, |
| 788 copy_rect, | 750 copy_rect, |
| 789 output_size, | 751 output_size, |
| 790 video_frame); | 752 video_frame); |
| 791 } | 753 } |
| 792 | 754 |
| 793 // https://crbug.com/542896 | |
| 794 #if defined(MEMORY_SANITIZER) | |
| 795 #define MAYBE_CopyFromCompositingSurface_ForVideoFrame \ | |
| 796 DISABLED_CopyFromCompositingSurface_ForVideoFrame | |
| 797 #else | |
| 798 #define MAYBE_CopyFromCompositingSurface_ForVideoFrame \ | |
| 799 CopyFromCompositingSurface_ForVideoFrame | |
| 800 #endif | |
| 801 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, | 755 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, |
| 802 MAYBE_CopyFromCompositingSurface_ForVideoFrame) { | 756 CopyFromCompositingSurface_ForVideoFrame) { |
| 803 // Grab 90x60 pixels from the center of the tab contents. | 757 // Grab 90x60 pixels from the center of the tab contents. |
| 804 gfx::Rect copy_rect(400, 300); | 758 gfx::Rect copy_rect(400, 300); |
| 805 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(45, 30), | 759 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(45, 30), |
| 806 gfx::Size(90, 60)); | 760 gfx::Size(90, 60)); |
| 807 gfx::Size output_size = copy_rect.size(); | 761 gfx::Size output_size = copy_rect.size(); |
| 808 gfx::Size html_rect_size(400, 300); | 762 gfx::Size html_rect_size(400, 300); |
| 809 bool video_frame = true; | 763 bool video_frame = true; |
| 810 PerformTestWithLeftRightRects(html_rect_size, | 764 PerformTestWithLeftRightRects(html_rect_size, |
| 811 copy_rect, | 765 copy_rect, |
| 812 output_size, | 766 output_size, |
| 813 video_frame); | 767 video_frame); |
| 814 } | 768 } |
| 815 | 769 |
| 816 // https://crbug.com/542896 | |
| 817 #if defined(MEMORY_SANITIZER) | |
| 818 #define MAYBE_CopyFromCompositingSurface_ForVideoFrame_Scaled \ | |
| 819 DISABLED_CopyFromCompositingSurface_ForVideoFrame_Scaled | |
| 820 #else | |
| 821 #define MAYBE_CopyFromCompositingSurface_ForVideoFrame_Scaled \ | |
| 822 CopyFromCompositingSurface_ForVideoFrame_Scaled | |
| 823 #endif | |
| 824 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, | 770 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTestTabCapture, |
| 825 MAYBE_CopyFromCompositingSurface_ForVideoFrame_Scaled) { | 771 CopyFromCompositingSurface_ForVideoFrame_Scaled) { |
| 826 // Grab 90x60 pixels from the center of the tab contents. | 772 // Grab 90x60 pixels from the center of the tab contents. |
| 827 gfx::Rect copy_rect(400, 300); | 773 gfx::Rect copy_rect(400, 300); |
| 828 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(45, 30), | 774 copy_rect = gfx::Rect(copy_rect.CenterPoint() - gfx::Vector2d(45, 30), |
| 829 gfx::Size(90, 60)); | 775 gfx::Size(90, 60)); |
| 830 // Scale to 30 x 20 (preserve aspect ratio). | 776 // Scale to 30 x 20 (preserve aspect ratio). |
| 831 gfx::Size output_size(30, 20); | 777 gfx::Size output_size(30, 20); |
| 832 gfx::Size html_rect_size(400, 300); | 778 gfx::Size html_rect_size(400, 300); |
| 833 bool video_frame = true; | 779 bool video_frame = true; |
| 834 PerformTestWithLeftRightRects(html_rect_size, | 780 PerformTestWithLeftRightRects(html_rect_size, |
| 835 copy_rect, | 781 copy_rect, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 866 | 812 |
| 867 static float scale() { return 2.0f; } | 813 static float scale() { return 2.0f; } |
| 868 | 814 |
| 869 private: | 815 private: |
| 870 DISALLOW_COPY_AND_ASSIGN( | 816 DISALLOW_COPY_AND_ASSIGN( |
| 871 CompositingRenderWidgetHostViewBrowserTestTabCaptureHighDPI); | 817 CompositingRenderWidgetHostViewBrowserTestTabCaptureHighDPI); |
| 872 }; | 818 }; |
| 873 | 819 |
| 874 // NineImagePainter implementation crashes the process on Windows when this | 820 // NineImagePainter implementation crashes the process on Windows when this |
| 875 // content_browsertest forces a device scale factor. http://crbug.com/399349 | 821 // content_browsertest forces a device scale factor. http://crbug.com/399349 |
| 876 // Disabled under MSAN. http://crbug.com/542896 | 822 #if defined(OS_WIN) |
| 877 #if defined(OS_WIN) || defined(MEMORY_SANITIZER) | |
| 878 #define MAYBE_CopyToBitmap_EntireRegion DISABLED_CopyToBitmap_EntireRegion | 823 #define MAYBE_CopyToBitmap_EntireRegion DISABLED_CopyToBitmap_EntireRegion |
| 879 #define MAYBE_CopyToBitmap_CenterRegion DISABLED_CopyToBitmap_CenterRegion | 824 #define MAYBE_CopyToBitmap_CenterRegion DISABLED_CopyToBitmap_CenterRegion |
| 880 #define MAYBE_CopyToBitmap_ScaledResult DISABLED_CopyToBitmap_ScaledResult | 825 #define MAYBE_CopyToBitmap_ScaledResult DISABLED_CopyToBitmap_ScaledResult |
| 881 #define MAYBE_CopyToVideoFrame_EntireRegion \ | 826 #define MAYBE_CopyToVideoFrame_EntireRegion \ |
| 882 DISABLED_CopyToVideoFrame_EntireRegion | 827 DISABLED_CopyToVideoFrame_EntireRegion |
| 883 #define MAYBE_CopyToVideoFrame_CenterRegion \ | 828 #define MAYBE_CopyToVideoFrame_CenterRegion \ |
| 884 DISABLED_CopyToVideoFrame_CenterRegion | 829 DISABLED_CopyToVideoFrame_CenterRegion |
| 885 #define MAYBE_CopyToVideoFrame_ScaledResult \ | 830 #define MAYBE_CopyToVideoFrame_ScaledResult \ |
| 886 DISABLED_CopyToVideoFrame_ScaledResult | 831 DISABLED_CopyToVideoFrame_ScaledResult |
| 887 #else | 832 #else |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 kTestCompositingModes); | 944 kTestCompositingModes); |
| 1000 INSTANTIATE_TEST_CASE_P( | 945 INSTANTIATE_TEST_CASE_P( |
| 1001 GLAndSoftwareCompositing, | 946 GLAndSoftwareCompositing, |
| 1002 CompositingRenderWidgetHostViewBrowserTestTabCaptureHighDPI, | 947 CompositingRenderWidgetHostViewBrowserTestTabCaptureHighDPI, |
| 1003 kTestCompositingModes); | 948 kTestCompositingModes); |
| 1004 | 949 |
| 1005 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 950 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 1006 | 951 |
| 1007 } // namespace | 952 } // namespace |
| 1008 } // namespace content | 953 } // namespace content |
| OLD | NEW |