Files
brave-core/chromium_src/content
mkarolin 48336ccc3f PermissionDescriptorToPermissionType was moved.
Chromium change:

https://chromium.googlesource.com/chromium/src/+/25f8a22ada1c17c3724ddfd0a850daaf4410b8e2

commit 25f8a22ada1c17c3724ddfd0a850daaf4410b8e2
Author: Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
Date:   Tue Jan 14 16:20:07 2020 +0000

    Reland "Add internals.setPermission() and permission_automation.mojom."

    This is a reland of e7a6d173632660b6aeb9806e9132c34a315331c2, which got
    reverted due to crashes in ChromeOS and Android caused by
    ENABLE_PROTECTED_MEDIA_IDENTIFIER_PERMISSION not being defined in
    PermissionDescriptorToPermissionType()'s new location in
    //content/public/browser. This reland now moves the setting of this macro
    from //content/browser/BUILD.gn to //content/public/browser/BUILD.gn (that
    function is the only user of this macro).

    Original change's description:
    > Add internals.setPermission() and permission_automation.mojom.
    >
    > web-platform-tests has recently gained the ability to set the permission
    > associated to a permission type via test_driver.set_permission(), in a
    > similar fashion to Blink's testRunner.setPermission().
    >
    > This is CL #1 of a few, and the ultimate goal is to add an implementation of
    > set_permission() to testdriver-vendor.js, so that we can replace uses of
    > testRunner.setPermission(), and consequently move more Blink-specific tests
    > to WPT.
    >
    > This CL adds a new .mojom file to third_party/blink/public/mojom/permissions
    > that allows setting the permission associated with a given permission type,
    > in a similar fashion to testRunner.setPermission(). This API is only
    > intended for use in tests, so the new PermissionAutomation interface is
    > added to a separate file that is part of the blink.test.mojom module, and it
    > is only implemented by content_shell. It then plugs it into the internals
    > object. While in the short term it adds another way to achieve the same
    > thing in layout tests, this was done for a couple of reasons:
    >
    > * test_driver.set_permission() takes a PermissionDescriptor (from the
    >   Permissions API) rather than a string that does not necessarily match the
    >   permission name as specified in the Permissions API.
    >   It makes sense to use standardized APIs, so rather than adding code to
    >   convert a PermissionDescriptor into a string accepted by testRunner's
    >   setPermission(), internals.setPermission() also takes a
    >   PermissionDescriptor.
    > * Since testRunner is implemented entirely in //content/shell, we cannot
    >   have its code call Blink to convert a JS value representing the descriptor
    >   into a blink::mojom::PermissionDescriptorPtr. By Onion Soup'ing the code
    >   to set permissions, we can do all the PermissionDescriptor parsing in
    >   Blink and just call the PermissionAutomation implementation in content
    >   shell's browser side. For this, we change the internals object in Blink
    >   and bypass testRunner altogether.
    > * The new API also gives us more flexibility: it returns a promise so that
    >   we can be sure the permission changes really have an effect before
    >   executing the rest of the code in a test.
    >
    > A few layout tests have been converted to the new API to show it works.
    >
    > Once existing uses of testRunner.setPermission() are converted, we can
    > remove it altogether, and have internals.setPermission() be part of the
    > implementation of testdriver.js' set_permission() call.
    >
    > Bug: 1030663
2020-03-19 16:51:27 -04:00
..