tree: 86c277982e29b616b961b8a7f77a1dce50eee7a2 [path history] [tgz]
  1. BUILD.gn
  2. DIR_METADATA
  3. idls.gni
  4. navigator_badge.cc
  5. navigator_badge.h
  6. navigator_badge.idl
  7. OWNERS
  8. README.md
  9. worker_navigator_badge.idl
chromium/src/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.