[DC] Add DigitalCredentials.setVirtualWalletBehavior CDP command [chromium/src : main]

1 view
Skip to first unread message

Tejas Dhagawkar (Gerrit)

unread,
Apr 27, 2026, 3:17:33 PM (7 days ago) Apr 27
to Anushka Kulkarni, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, devtools...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, devtools-re...@chromium.org
Attention needed from Anushka Kulkarni

Tejas Dhagawkar added 2 comments

File content/browser/devtools/protocol/digital_credentials_handler_unittest.cc
Line 4, Patchset 2 (Latest):
Tejas Dhagawkar . unresolved

Rarely seen unit test for handler file. Is this really required?

File third_party/blink/public/devtools_protocol/domains/DigitalCredentials.pdl
Line 26, Patchset 2 (Latest): # JSON-encoded response data object returned by the wallet. Parsed by
# the browser when |behavior| is "respond". Required when |behavior| is
# "respond", forbidden otherwise.
Tejas Dhagawkar . unresolved

Make it short
JSON-encoded response data object returned by the wallet.
Required when |behavior| is "respond", forbidden otherwise.

Open in Gerrit

Related details

Attention is currently required from:
  • Anushka Kulkarni
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Iaabca8bc5fe85e15af4c281b27bff301c381aed8
Gerrit-Change-Number: 7790437
Gerrit-PatchSet: 2
Gerrit-Owner: Anushka Kulkarni <anusku...@microsoft.com>
Gerrit-CC: Tejas Dhagawkar <tdhag...@microsoft.com>
Gerrit-Attention: Anushka Kulkarni <anusku...@microsoft.com>
Gerrit-Comment-Date: Mon, 27 Apr 2026 19:16:57 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Anushka Kulkarni (Gerrit)

unread,
Apr 28, 2026, 1:48:03 AM (7 days ago) Apr 28
to Tejas Dhagawkar, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, devtools...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, devtools-re...@chromium.org
Attention needed from Tejas Dhagawkar

Anushka Kulkarni added 2 comments

File content/browser/devtools/protocol/digital_credentials_handler_unittest.cc
Line 4, Patchset 2:
Tejas Dhagawkar . resolved

Rarely seen unit test for handler file. Is this really required?

Anushka Kulkarni

Fair question — handler-level unit tests are uncommon, but I added these because:

The handler does non-trivial parameter validation (the respond-only protocol/response contract from the PDL, JSON parsing of response, and behavior dispatch) that isn't covered anywhere else.
WPT/inspector-protocol tests exercise the full BiDi → CDP → handler → wallet flow, but they're slow and a failure there doesn't pinpoint which layer broke. These unit tests give fast, targeted coverage of the handler's branches and would catch regressions in just this file.
There is precedent — webauthn_handler_unittest.cc and tracing_handler_unittest.cc follow the same pattern for handlers with non-trivial validation logic.
Happy to drop them if you feel the WPT coverage is sufficient — but I'd lean toward keeping them. WDYT?

File third_party/blink/public/devtools_protocol/domains/DigitalCredentials.pdl
Line 26, Patchset 2: # JSON-encoded response data object returned by the wallet. Parsed by

# the browser when |behavior| is "respond". Required when |behavior| is
# "respond", forbidden otherwise.
Tejas Dhagawkar . resolved

Make it short
JSON-encoded response data object returned by the wallet.
Required when |behavior| is "respond", forbidden otherwise.

Anushka Kulkarni

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Tejas Dhagawkar
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Iaabca8bc5fe85e15af4c281b27bff301c381aed8
    Gerrit-Change-Number: 7790437
    Gerrit-PatchSet: 3
    Gerrit-Attention: Tejas Dhagawkar <tdhag...@microsoft.com>
    Gerrit-Comment-Date: Tue, 28 Apr 2026 05:47:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Tejas Dhagawkar <tdhag...@microsoft.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Tejas Dhagawkar (Gerrit)

    unread,
    Apr 30, 2026, 1:47:15 AM (5 days ago) Apr 30
    to Anushka Kulkarni, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, devtools...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, devtools-re...@chromium.org
    Attention needed from Anushka Kulkarni

    Tejas Dhagawkar added 2 comments

    File chrome/test/chromedriver/digital_credentials_commands.cc
    Line 40, Patchset 3 (Latest): const base::Value* response_value = bidi_params->Find("response");
    if (response_value) {
    if (response_value->is_string()) {
    command_params.Set("response", response_value->GetString());
    } else if (response_value->is_dict() || response_value->is_list()) {
    std::string response_str;
    if (base::JSONWriter::Write(*response_value, &response_str)) {
    command_params.Set("response", response_str);
    } else {
    return Status(kInvalidArgument, "Unable to serialize response");
    }
    } else {
    return Status(kInvalidArgument, "Invalid response type");
    }
    }
    Tejas Dhagawkar . unresolved

    We need to test this part. Need unit tests

    File content/browser/devtools/protocol/digital_credentials_handler.cc
    Line 46, Patchset 3 (Latest):
    Tejas Dhagawkar . unresolved

    Add DCHECK here for wallet

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anushka Kulkarni
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iaabca8bc5fe85e15af4c281b27bff301c381aed8
      Gerrit-Change-Number: 7790437
      Gerrit-PatchSet: 3
      Gerrit-Owner: Anushka Kulkarni <anusku...@microsoft.com>
      Gerrit-CC: Tejas Dhagawkar <tdhag...@microsoft.com>
      Gerrit-Attention: Anushka Kulkarni <anusku...@microsoft.com>
      Gerrit-Comment-Date: Thu, 30 Apr 2026 05:46:47 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Tejas Dhagawkar (Gerrit)

      unread,
      Apr 30, 2026, 2:51:35 AM (5 days ago) Apr 30
      to Anushka Kulkarni, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, devtools...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, devtools-re...@chromium.org
      Attention needed from Anushka Kulkarni

      Tejas Dhagawkar added 2 comments

      File content/browser/devtools/protocol/digital_credentials_handler_unittest.cc
      Line 50, Patchset 3 (Latest): EXPECT_EQ(crdtp::DispatchCode::SERVER_ERROR, response.Code());
      Tejas Dhagawkar . unresolved

      How come this is a server error instead of INVALID_PARAMS

      Line 149, Patchset 3 (Latest): handler_->SetVirtualWalletBehavior("frobnicate", "openid4vp", "{}");
      Tejas Dhagawkar . unresolved

      Ideally it should say invalid behavior

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anushka Kulkarni
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Iaabca8bc5fe85e15af4c281b27bff301c381aed8
      Gerrit-Change-Number: 7790437
      Gerrit-PatchSet: 3
      Gerrit-Owner: Anushka Kulkarni <anusku...@microsoft.com>
      Gerrit-CC: Tejas Dhagawkar <tdhag...@microsoft.com>
      Gerrit-Attention: Anushka Kulkarni <anusku...@microsoft.com>
      Gerrit-Comment-Date: Thu, 30 Apr 2026 06:51:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anushka Kulkarni (Gerrit)

      unread,
      11:28 AM (4 hours ago) 11:28 AM
      to Tejas Dhagawkar, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, devtools...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org, devtools-re...@chromium.org
      Attention needed from Tejas Dhagawkar

      Anushka Kulkarni added 4 comments

      File chrome/test/chromedriver/digital_credentials_commands.cc
      Line 40, Patchset 3: const base::Value* response_value = bidi_params->Find("response");

      if (response_value) {
      if (response_value->is_string()) {
      command_params.Set("response", response_value->GetString());
      } else if (response_value->is_dict() || response_value->is_list()) {
      std::string response_str;
      if (base::JSONWriter::Write(*response_value, &response_str)) {
      command_params.Set("response", response_str);
      } else {
      return Status(kInvalidArgument, "Unable to serialize response");
      }
      } else {
      return Status(kInvalidArgument, "Invalid response type");
      }
      }
      Tejas Dhagawkar . resolved

      We need to test this part. Need unit tests

      Anushka Kulkarni

      Done

      File content/browser/devtools/protocol/digital_credentials_handler.cc
      Line 46, Patchset 3:
      Tejas Dhagawkar . resolved

      Add DCHECK here for wallet

      Anushka Kulkarni

      Done

      File content/browser/devtools/protocol/digital_credentials_handler_unittest.cc
      Line 50, Patchset 3: EXPECT_EQ(crdtp::DispatchCode::SERVER_ERROR, response.Code());
      Tejas Dhagawkar . resolved

      How come this is a server error instead of INVALID_PARAMS

      Anushka Kulkarni

      Good point. You're right — from the client's viewpoint, "no frame host" is a usage error fixable on their side, not an internal browser failure. The BiDi layer guarantees correct routing via BrowsingContextStorage, so this branch only fires for raw-CDP clients that issued the command before attaching to a target. Switching to INVALID_PARAMS with a clearer message. Updated the corresponding unit test as well.

      Line 149, Patchset 3: handler_->SetVirtualWalletBehavior("frobnicate", "openid4vp", "{}");
      Tejas Dhagawkar . resolved

      Ideally it should say invalid behavior

      Anushka Kulkarni

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Tejas Dhagawkar
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Iaabca8bc5fe85e15af4c281b27bff301c381aed8
        Gerrit-Change-Number: 7790437
        Gerrit-PatchSet: 4
        Gerrit-Attention: Tejas Dhagawkar <tdhag...@microsoft.com>
        Gerrit-Comment-Date: Mon, 04 May 2026 15:28:16 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Tejas Dhagawkar <tdhag...@microsoft.com>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages