tree: a5f2a6c15e4c67ad7e0c77f457c4966aae56f337 [path history] [tgz]
  1. BUILD.gn
  2. DIR_METADATA
  3. navigator_badge.cc
  4. navigator_badge.h
  5. navigator_badge.idl
  6. OWNERS
  7. README.md
  8. worker_navigator_badge.idl
third_party/blink/renderer/modules/badging/README.md

Badging

This module contains the implementation of the Badging API.

API

See the explainer for details. The NavigatorBadge mixin interface is included by Navigator and WorkerNavigator, which exposes two methods: setAppBadge() and clearAppBadge().

  • setAppBadge(optional [EnforceRange] unsigned long long contents): Sets the associated app's badge to |contents|.
    • When |contents| is omitted, sets the associated app's badge to “flag”.
    • When |contents| is 0, sets the associated app's badge to nothing.
  • clearAppBadge(): Sets the associated app's badge to nothing.

Testing

web_tests/badging/*.html tests that the API accepts/rejects the appropriate inputs (with a mock Mojo service that verifies that the interface sends the correct Mojo messages". These tests duplicate some of the tests from WPT (below) but with internal verification.

web_tests/external/wpt/badging/*.html tests that the API accepts/rejects the appropriate inputs. These tests do not test the internal state of the badge (because they have no visibility into it), only success/failure.