def testInvalidArgs(self):
     with self.assertRaises(AssertionError):
         algo.FuzzyMatchingAlgorithm(-1, 0)
     with self.assertRaises(AssertionError):
         algo.FuzzyMatchingAlgorithm(0, -1)
     with self.assertRaises(AssertionError):
         algo.FuzzyMatchingAlgorithm(0, 0, -1)
 def testGetCmdline(self):
   a = algo.FuzzyMatchingAlgorithm(1, 2)
   cmdline = a.GetCmdline()
   self.assertEqual(cmdline, [
       '--add-test-optional-key',
       'image_matching_algorithm:fuzzy',
       '--add-test-optional-key',
       'fuzzy_max_different_pixels:1',
       '--add-test-optional-key',
       'fuzzy_pixel_delta_threshold:2',
   ])
示例#3
0
    def MacSpecificPages(base_name):
        iosurface_2d_canvas_args = ['--enable-accelerated-2d-canvas']

        non_chromium_image_args = ['--disable-webgl-image-chromium']

        # This disables the Core Animation compositor, falling back to the
        # old GLRenderer path, but continuing to allocate IOSurfaces for
        # WebGL's back buffer.
        no_overlays_args = ['--disable-mac-overlays']

        # The filter effect tests produce images with lots of gradients and blurs
        # which don't play nicely with Sobel filters, so a fuzzy algorithm instead
        # of Sobel. The images are also relatively large (360k pixels), and large
        # portions of the image are prone to noise, hence the large max different
        # pixels value.
        filter_effect_fuzzy_algo = algo.FuzzyMatchingAlgorithm(
            max_different_pixels=57500, pixel_delta_threshold=10)

        return [
            # On macOS, test the IOSurface 2D Canvas compositing path.
            PixelTestPage('pixel_canvas2d_accelerated.html',
                          base_name + '_IOSurface2DCanvas',
                          test_rect=[0, 0, 400, 400],
                          browser_args=iosurface_2d_canvas_args),
            PixelTestPage('pixel_canvas2d_webgl.html',
                          base_name + '_IOSurface2DCanvasWebGL',
                          test_rect=[0, 0, 300, 300],
                          browser_args=iosurface_2d_canvas_args),

            # On macOS, test WebGL non-Chromium Image compositing path.
            PixelTestPage('pixel_webgl_aa_alpha.html',
                          base_name +
                          '_WebGLGreenTriangle_NonChromiumImage_AA_Alpha',
                          test_rect=[0, 0, 300, 300],
                          browser_args=non_chromium_image_args),
            PixelTestPage('pixel_webgl_noaa_alpha.html',
                          base_name +
                          '_WebGLGreenTriangle_NonChromiumImage_NoAA_Alpha',
                          test_rect=[0, 0, 300, 300],
                          browser_args=non_chromium_image_args),
            PixelTestPage('pixel_webgl_aa_noalpha.html',
                          base_name +
                          '_WebGLGreenTriangle_NonChromiumImage_AA_NoAlpha',
                          test_rect=[0, 0, 300, 300],
                          browser_args=non_chromium_image_args),
            PixelTestPage('pixel_webgl_noaa_noalpha.html',
                          base_name +
                          '_WebGLGreenTriangle_NonChromiumImage_NoAA_NoAlpha',
                          test_rect=[0, 0, 300, 300],
                          browser_args=non_chromium_image_args),

            # On macOS, test CSS filter effects with and without the CA compositor.
            PixelTestPage('filter_effects.html',
                          base_name + '_CSSFilterEffects',
                          test_rect=[0, 0, 300, 300],
                          matching_algorithm=filter_effect_fuzzy_algo),
            PixelTestPage('filter_effects.html',
                          base_name + '_CSSFilterEffects_NoOverlays',
                          test_rect=[0, 0, 300, 300],
                          browser_args=no_overlays_args,
                          matching_algorithm=filter_effect_fuzzy_algo),

            # Test WebGL's premultipliedAlpha:false without the CA compositor.
            PixelTestPage('pixel_webgl_premultiplied_alpha_false.html',
                          base_name +
                          '_WebGL_PremultipliedAlpha_False_NoOverlays',
                          test_rect=[0, 0, 150, 150],
                          browser_args=no_overlays_args),
        ]
示例#4
0
    def DefaultPages(base_name):
        sw_compositing_args = [cba.DISABLE_GPU_COMPOSITING]

        # The optimizer script spat out pretty similar values for most MP4 tests, so
        # combine into a single set of parameters.
        general_mp4_algo = algo.SobelMatchingAlgorithm(
            max_different_pixels=56300,
            pixel_delta_threshold=35,
            edge_threshold=80)

        return [
            PixelTestPage('pixel_background_image.html',
                          base_name + '_BackgroundImage',
                          test_rect=[20, 20, 370, 370]),
            PixelTestPage('pixel_reflected_div.html',
                          base_name + '_ReflectedDiv',
                          test_rect=[0, 0, 100, 300]),
            PixelTestPage('pixel_canvas2d.html',
                          base_name + '_Canvas2DRedBox',
                          test_rect=[0, 0, 300, 300]),
            PixelTestPage('pixel_canvas2d_untagged.html',
                          base_name + '_Canvas2DUntagged',
                          test_rect=[0, 0, 257, 257]),
            PixelTestPage('pixel_css3d.html',
                          base_name + '_CSS3DBlueBox',
                          test_rect=[0, 0, 300, 300],
                          matching_algorithm=algo.SobelMatchingAlgorithm(
                              max_different_pixels=0,
                              pixel_delta_threshold=0,
                              edge_threshold=100)),
            PixelTestPage('pixel_webgl_aa_alpha.html',
                          base_name + '_WebGLGreenTriangle_AA_Alpha',
                          test_rect=[0, 0, 300, 300]),
            PixelTestPage('pixel_webgl_noaa_alpha.html',
                          base_name + '_WebGLGreenTriangle_NoAA_Alpha',
                          test_rect=[0, 0, 300, 300]),
            PixelTestPage('pixel_webgl_aa_noalpha.html',
                          base_name + '_WebGLGreenTriangle_AA_NoAlpha',
                          test_rect=[0, 0, 300, 300]),
            PixelTestPage('pixel_webgl_noaa_noalpha.html',
                          base_name + '_WebGLGreenTriangle_NoAA_NoAlpha',
                          test_rect=[0, 0, 300, 300]),
            PixelTestPage(
                'pixel_webgl_noalpha_implicit_clear.html',
                base_name +
                '_WebGLTransparentGreenTriangle_NoAlpha_ImplicitClear',
                test_rect=[0, 0, 300, 300]),
            PixelTestPage('pixel_webgl_sad_canvas.html',
                          base_name + '_WebGLSadCanvas',
                          test_rect=[0, 0, 300, 300],
                          optional_action='CrashGpuProcess'),
            PixelTestPage('pixel_scissor.html',
                          base_name + '_ScissorTestWithPreserveDrawingBuffer',
                          test_rect=[0, 0, 300, 300]),
            PixelTestPage('pixel_canvas2d_webgl.html',
                          base_name + '_2DCanvasWebGL',
                          test_rect=[0, 0, 300, 300]),
            PixelTestPage('pixel_background.html',
                          base_name + '_SolidColorBackground',
                          test_rect=[500, 500, 100, 100]),
            PixelTestPage(
                'pixel_video_mp4.html',
                base_name + '_Video_MP4',
                test_rect=[0, 0, 240, 135],
                # Most images are actually very similar, but Pixel 2
                # tends to produce images with all colors shifted by a
                # small amount.
                matching_algorithm=general_mp4_algo),
            # Surprisingly stable, does not appear to require inexact matching.
            PixelTestPage(
                'pixel_video_mp4.html',
                base_name + '_Video_MP4_DXVA',
                browser_args=[cba.DISABLE_FEATURES_D3D11_VIDEO_DECODER],
                test_rect=[0, 0, 240, 135]),
            PixelTestPage('pixel_video_mp4_four_colors_aspect_4x3.html',
                          base_name + '_Video_MP4_FourColors_Aspect_4x3',
                          test_rect=[0, 0, 240, 135],
                          matching_algorithm=algo.SobelMatchingAlgorithm(
                              max_different_pixels=41700,
                              pixel_delta_threshold=15,
                              edge_threshold=40)),
            PixelTestPage('pixel_video_mp4_four_colors_rot_90.html',
                          base_name + '_Video_MP4_FourColors_Rot_90',
                          test_rect=[0, 0, 270, 240],
                          matching_algorithm=general_mp4_algo),
            PixelTestPage('pixel_video_mp4_four_colors_rot_180.html',
                          base_name + '_Video_MP4_FourColors_Rot_180',
                          test_rect=[0, 0, 240, 135],
                          matching_algorithm=general_mp4_algo),
            PixelTestPage('pixel_video_mp4_four_colors_rot_270.html',
                          base_name + '_Video_MP4_FourColors_Rot_270',
                          test_rect=[0, 0, 270, 240],
                          matching_algorithm=general_mp4_algo),
            PixelTestPage('pixel_video_mp4_rounded_corner.html',
                          base_name + '_Video_MP4_Rounded_Corner',
                          test_rect=[0, 0, 240, 135],
                          matching_algorithm=algo.SobelMatchingAlgorithm(
                              max_different_pixels=30500,
                              pixel_delta_threshold=15,
                              edge_threshold=70)),
            PixelTestPage('pixel_video_vp9.html',
                          base_name + '_Video_VP9',
                          test_rect=[0, 0, 240, 135],
                          matching_algorithm=algo.SobelMatchingAlgorithm(
                              max_different_pixels=114000,
                              pixel_delta_threshold=30,
                              edge_threshold=20)),
            PixelTestPage(
                'pixel_video_vp9.html',
                base_name + '_Video_VP9_DXVA',
                browser_args=[cba.DISABLE_FEATURES_D3D11_VIDEO_DECODER],
                test_rect=[0, 0, 240, 135],
                matching_algorithm=algo.SobelMatchingAlgorithm(
                    max_different_pixels=31100,
                    pixel_delta_threshold=30,
                    edge_threshold=250)),
            PixelTestPage(
                'pixel_video_media_stream_incompatible_stride.html',
                base_name + '_Video_Media_Stream_Incompatible_Stride',
                browser_args=GetMediaStreamTestBrowserArgs(
                    'media/test/data/four-colors-incompatible-stride.y4m'),
                test_rect=[0, 0, 240, 135],
                matching_algorithm=VERY_PERMISSIVE_SOBEL_ALGO),

            # The MP4 contains H.264 which is primarily hardware decoded on bots.
            PixelTestPage(
                'pixel_video_context_loss.html?src='
                '/media/test/data/four-colors.mp4',
                base_name + '_Video_Context_Loss_MP4',
                test_rect=[0, 0, 240, 135],
                # Optimizer script spat out a value of 255 for the Sobel edge
                # threshold, so use fuzzy for now since it's slightly more
                # efficient.
                matching_algorithm=algo.FuzzyMatchingAlgorithm(
                    max_different_pixels=31700, pixel_delta_threshold=20),
                expected_per_process_crashes={
                    CRASH_TYPE_GPU: 1,
                }),

            # The VP9 test clip is primarily software decoded on bots.
            PixelTestPage(('pixel_video_context_loss.html'
                           '?src=/media/test/data/four-colors-vp9.webm'),
                          base_name + '_Video_Context_Loss_VP9',
                          test_rect=[0, 0, 240, 135],
                          matching_algorithm=algo.SobelMatchingAlgorithm(
                              max_different_pixels=54400,
                              pixel_delta_threshold=30,
                              edge_threshold=250),
                          expected_per_process_crashes={
                              CRASH_TYPE_GPU: 1,
                          }),
            PixelTestPage('pixel_video_backdrop_filter.html',
                          base_name + '_Video_BackdropFilter',
                          test_rect=[0, 0, 240, 135],
                          matching_algorithm=algo.SobelMatchingAlgorithm(
                              max_different_pixels=1000,
                              pixel_delta_threshold=20,
                              edge_threshold=40,
                              ignored_border_thickness=1)),
            PixelTestPage('pixel_webgl_premultiplied_alpha_false.html',
                          base_name + '_WebGL_PremultipliedAlpha_False',
                          test_rect=[0, 0, 150, 150]),
            PixelTestPage('pixel_webgl2_blitframebuffer_result_displayed.html',
                          base_name +
                          '_WebGL2_BlitFramebuffer_Result_Displayed',
                          test_rect=[0, 0, 200, 200]),
            PixelTestPage('pixel_webgl2_clearbufferfv_result_displayed.html',
                          base_name + '_WebGL2_ClearBufferfv_Result_Displayed',
                          test_rect=[0, 0, 200, 200]),
            PixelTestPage('pixel_repeated_webgl_to_2d.html',
                          base_name + '_RepeatedWebGLTo2D',
                          test_rect=[0, 0, 256, 256]),
            PixelTestPage('pixel_repeated_webgl_to_2d.html',
                          base_name + '_RepeatedWebGLTo2D_SoftwareCompositing',
                          test_rect=[0, 0, 256, 256],
                          browser_args=sw_compositing_args),
            PixelTestPage('pixel_canvas2d_tab_switch.html',
                          base_name + '_Canvas2DTabSwitch',
                          test_rect=[0, 0, 100, 100],
                          optional_action='SwitchTabs'),
            PixelTestPage('pixel_canvas2d_tab_switch.html',
                          base_name + '_Canvas2DTabSwitch_SoftwareCompositing',
                          test_rect=[0, 0, 100, 100],
                          browser_args=sw_compositing_args,
                          optional_action='SwitchTabs'),
            PixelTestPage('pixel_webgl_copy_image.html',
                          base_name + '_WebGLCopyImage',
                          test_rect=[0, 0, 200, 100]),
            PixelTestPage('pixel_webgl_read_pixels_tab_switch.html',
                          base_name + '_WebGLReadPixelsTabSwitch',
                          test_rect=[0, 0, 100, 100],
                          optional_action='SwitchTabs'),
            PixelTestPage('pixel_webgl_read_pixels_tab_switch.html',
                          base_name +
                          '_WebGLReadPixelsTabSwitch_SoftwareCompositing',
                          test_rect=[0, 0, 100, 100],
                          browser_args=sw_compositing_args,
                          optional_action='SwitchTabs'),
            PixelTestPage('pixel_offscreen_canvas_ibrc_webgl_main.html',
                          base_name + '_OffscreenCanvasIBRCWebGLMain',
                          test_rect=[0, 0, 300, 300],
                          optional_action='RunOffscreenCanvasIBRCWebGLTest'),
            PixelTestPage('pixel_offscreen_canvas_ibrc_webgl_worker.html',
                          base_name + '_OffscreenCanvasIBRCWebGLWorker',
                          test_rect=[0, 0, 300, 300],
                          optional_action='RunOffscreenCanvasIBRCWebGLTest'),
        ]