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