DevTools: Add Smart Card Emulation Handler Skeleton. [chromium/src : main]

0 views
Skip to first unread message

Paulina Gacek (Gerrit)

unread,
Dec 22, 2025, 5:09:09 AM12/22/25
to Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko and Zgroza (Luke) Klimek

Paulina Gacek added 1 comment

File content/browser/devtools/render_frame_devtools_agent_host.cc
Line 374, Patchset 4: session->CreateAndAddHandler<protocol::SmartCardEmulationHandler>();
Alex Rudenko . unresolved

My understanding was that the emulation is meant to be global and not related to a specific render frame? has that changed? if it is still global, I think this should be in content/browser/devtools/browser_devtools_agent_host.cc

Paulina Gacek

Thank you for the comment! While Smart Card devices are physically global, the API implementation (`navigator.smartCard`) and the Mojo interface are bound to the specific RenderFrame.

Alex Rudenko

Is the emulation also global or would it be per render frame?

Paulina Gacek

Per frame.

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 11
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 22 Dec 2025 10:08:56 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Paulina Gacek <paulin...@google.com>
Comment-In-Reply-To: Alex Rudenko <alexr...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrey Kosyakov (Gerrit)

unread,
Dec 22, 2025, 6:41:39 PM12/22/25
to Paulina Gacek, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Andrey Kosyakov added 6 comments

File content/browser/devtools/protocol/smart_card_emulation_handler.h
Line 84, Patchset 12 (Latest): base::WeakPtrFactory<SmartCardEmulationHandler> weak_factory_{this};
Andrey Kosyakov . unresolved

unused?

Line 79, Patchset 12 (Latest): base::WeakPtr<RenderFrameHostImpl> host_;
Andrey Kosyakov . unresolved

raw_ptr<>, please! We're managing this explicitly in all handlers (as in, there would be SetRenderer calls before the host goes away).

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 39, Patchset 12 (Latest): .SwapImplForTesting(original_broker_impl_);
Andrey Kosyakov . unresolved

No ForTesting calls in prod code, please!

Line 64, Patchset 12 (Latest): if (!enabled_) {
Andrey Kosyakov . unresolved

So... it's the same whether enabled_ or not?

Line 105, Patchset 12 (Latest): auto& receiver = rfh_impl->browser_interface_broker_receiver_for_testing();
Andrey Kosyakov . unresolved

ditto.

Line 179, Patchset 12 (Latest): return DispatchResponse::ServerError(
Andrey Kosyakov . unresolved

Just skip these in protocol_config.json instead, the backend will report an error just as well.

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Patryk Chodur
  • Paulina Gacek
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 12
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Paulina Gacek <paulin...@google.com>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 22 Dec 2025 23:41:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrey Kosyakov (Gerrit)

unread,
Dec 22, 2025, 6:48:51 PM12/22/25
to Paulina Gacek, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Andrey Kosyakov added 1 comment

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
File-level comment, Patchset 12 (Latest):
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Gerrit-Comment-Date: Mon, 22 Dec 2025 23:48:42 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Paulina Gacek (Gerrit)

unread,
Dec 29, 2025, 4:24:22 AM12/29/25
to Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Andrey Kosyakov, Patryk Chodur and Zgroza (Luke) Klimek

Paulina Gacek added 3 comments

File content/browser/devtools/protocol/smart_card_emulation_handler.h
Line 84, Patchset 12: base::WeakPtrFactory<SmartCardEmulationHandler> weak_factory_{this};
Andrey Kosyakov . resolved

unused?

Paulina Gacek

Done

Line 79, Patchset 12: base::WeakPtr<RenderFrameHostImpl> host_;
Andrey Kosyakov . resolved

raw_ptr<>, please! We're managing this explicitly in all handlers (as in, there would be SetRenderer calls before the host goes away).

Paulina Gacek

Done

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 64, Patchset 12: if (!enabled_) {
Andrey Kosyakov . resolved

So... it's the same whether enabled_ or not?

Paulina Gacek

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Andrey Kosyakov
  • Patryk Chodur
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 13
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 29 Dec 2025 09:24:09 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Paulina Gacek (Gerrit)

unread,
Dec 29, 2025, 7:53:47 AM12/29/25
to Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Andrey Kosyakov, Patryk Chodur and Zgroza (Luke) Klimek

Paulina Gacek added 7 comments

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Paulina Gacek

Thanks for the suggestion! The Smart Card API must be run within an Isolated Web App (IWA) context. I used IsolatedWebAppBrowserTestHarness (from chrome/) because it handles the complex IWA setup and permissions automatically. Porting this to the content/ layer or web_tests would require significant mocking of the IWA infrastructure.

File content/browser/devtools/protocol/smart_card_emulation_handler.h
Line 84, Patchset 12: base::WeakPtrFactory<SmartCardEmulationHandler> weak_factory_{this};
Andrey Kosyakov . resolved

unused?

Paulina Gacek

Done

Paulina Gacek

I started being used in this CL: https://chromium-review.googlesource.com/c/chromium/src/+/7264773. I moved the declaration there, thanks!

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 39, Patchset 12: .SwapImplForTesting(original_broker_impl_);
Andrey Kosyakov . resolved

No ForTesting calls in prod code, please!

Paulina Gacek

Done

Line 39, Patchset 12: .SwapImplForTesting(original_broker_impl_);
Andrey Kosyakov . resolved

No ForTesting calls in prod code, please!

Paulina Gacek

Done

Line 105, Patchset 12: auto& receiver = rfh_impl->browser_interface_broker_receiver_for_testing();
Andrey Kosyakov . resolved

ditto.

Paulina Gacek

Done

Line 105, Patchset 12: auto& receiver = rfh_impl->browser_interface_broker_receiver_for_testing();
Andrey Kosyakov . resolved

ditto.

Paulina Gacek

Done

Line 179, Patchset 12: return DispatchResponse::ServerError(
Andrey Kosyakov . resolved

Just skip these in protocol_config.json instead, the backend will report an error just as well.

Paulina Gacek

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Andrey Kosyakov
  • Patryk Chodur
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 16
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 29 Dec 2025 12:53:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
Comment-In-Reply-To: Paulina Gacek <paulin...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Paulina Gacek (Gerrit)

unread,
Dec 29, 2025, 8:10:52 AM12/29/25
to Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Andrey Kosyakov, Patryk Chodur and Zgroza (Luke) Klimek

Paulina Gacek added 1 comment

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Gerrit-Comment-Date: Mon, 29 Dec 2025 13:10:34 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Andrey Kosyakov (Gerrit)

unread,
Dec 29, 2025, 2:36:59 PM12/29/25
to Paulina Gacek, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Andrey Kosyakov added 1 comment

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Paulina Gacek

Thanks for the suggestion! The Smart Card API must be run within an Isolated Web App (IWA) context. I used IsolatedWebAppBrowserTestHarness (from chrome/) because it handles the complex IWA setup and permissions automatically. Porting this to the content/ layer or web_tests would require significant mocking of the IWA infrastructure.

Attention is currently required from:
  • Alex Rudenko
  • Patryk Chodur
  • Paulina Gacek
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 17
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Paulina Gacek <paulin...@google.com>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Mon, 29 Dec 2025 19:36:49 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
Comment-In-Reply-To: Paulina Gacek <paulin...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Alex Rudenko (Gerrit)

unread,
Jan 7, 2026, 9:17:58 AM (13 days ago) Jan 7
to Paulina Gacek, Code Review Nudger, Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Alex Rudenko added 3 comments

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Paulina Gacek

Thanks for the suggestion! The Smart Card API must be run within an Isolated Web App (IWA) context. I used IsolatedWebAppBrowserTestHarness (from chrome/) because it handles the complex IWA setup and permissions automatically. Porting this to the content/ layer or web_tests would require significant mocking of the IWA infrastructure.

Andrey Kosyakov

Wouldn't this take care of it?
https://source.chromium.org/chromium/chromium/src/+/main:content/shell/common/shell_switches.h;l=45?

(note we've got a virtual test suite setup to use this https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/virtual/isolated-context/README.md, https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/VirtualTestSuites;l=1748?)

Alex Rudenko

In addition to converting the tests I think the following scenarios would be useful to cover: 1) .enable() applies after a navigation 2) after a reload 3) applies to iframes (local and OOPIFS? unless the feature is not applicable to iframes but in that case we can verify that response is properly handling it).

Line 88, Patchset 18 (Latest): ASSERT_THAT(SendCommand("SmartCardEmulation.disable"), IsSuccess());
Alex Rudenko . unresolved

I think most of assertions here should be converted to exceptions (EXPECT_*)?

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 35, Patchset 18 (Latest): return "";
Alex Rudenko . unresolved

nit: Should there be IIFTT rules to make sure that new mapping are reflected here if the mojo interface changes?

Open in Gerrit

Related details

Attention is currently required from:
  • Patryk Chodur
  • Paulina Gacek
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 18
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Paulina Gacek <paulin...@google.com>
Gerrit-Attention: Patryk Chodur <pch...@google.com>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Wed, 07 Jan 2026 14:17:43 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Alex Rudenko (Gerrit)

unread,
Jan 7, 2026, 9:18:08 AM (13 days ago) Jan 7
to Paulina Gacek, Code Review Nudger, Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Patryk Chodur, Paulina Gacek and Zgroza (Luke) Klimek

Alex Rudenko added 1 comment

File content/browser/devtools/render_frame_devtools_agent_host.cc
Line 374, Patchset 4: session->CreateAndAddHandler<protocol::SmartCardEmulationHandler>();
Alex Rudenko . resolved

My understanding was that the emulation is meant to be global and not related to a specific render frame? has that changed? if it is still global, I think this should be in content/browser/devtools/browser_devtools_agent_host.cc

Paulina Gacek

Thank you for the comment! While Smart Card devices are physically global, the API implementation (`navigator.smartCard`) and the Mojo interface are bound to the specific RenderFrame.

Alex Rudenko

Is the emulation also global or would it be per render frame?

Paulina Gacek

Per frame.

Alex Rudenko

Done

Gerrit-Comment-Date: Wed, 07 Jan 2026 14:17:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Paulina Gacek (Gerrit)

unread,
Jan 16, 2026, 7:25:38 AM (4 days ago) Jan 16
to Code Review Nudger, Andrey Kosyakov, Patryk Chodur, Zgroza (Luke) Klimek, Alex Rudenko, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Alex Rudenko, Andrey Kosyakov and Zgroza (Luke) Klimek

Paulina Gacek added 3 comments

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Paulina Gacek

Thanks for the suggestion! The Smart Card API must be run within an Isolated Web App (IWA) context. I used IsolatedWebAppBrowserTestHarness (from chrome/) because it handles the complex IWA setup and permissions automatically. Porting this to the content/ layer or web_tests would require significant mocking of the IWA infrastructure.

Andrey Kosyakov

Wouldn't this take care of it?
https://source.chromium.org/chromium/chromium/src/+/main:content/shell/common/shell_switches.h;l=45?

(note we've got a virtual test suite setup to use this https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/virtual/isolated-context/README.md, https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/VirtualTestSuites;l=1748?)

Paulina Gacek

@alexr...@chromium.org thanks for these test scenarios!

However, since this CL only implements the base enable/disable commands, adding these tests now triggers Mojo crashes because we can't yet gracefully resolve the establishContext calls they rely on. I implemented test scenarios (1) and (2) in the subsequent CL: 7361937.

Line 88, Patchset 18: ASSERT_THAT(SendCommand("SmartCardEmulation.disable"), IsSuccess());
Alex Rudenko . resolved

I think most of assertions here should be converted to exceptions (EXPECT_*)?

Paulina Gacek

Done

File content/browser/devtools/protocol/smart_card_emulation_handler.cc
Line 35, Patchset 18: return "";
Alex Rudenko . resolved

nit: Should there be IIFTT rules to make sure that new mapping are reflected here if the mojo interface changes?

Paulina Gacek

Thank you for the suggestion. I generally prefer not to add LINT tags to shared Mojo definitions if possible to keep them clean. Instead, default case was omitted to ensure a compile-time error if a new value is added to the enum.

Open in Gerrit

Related details

Attention is currently required from:
  • Alex Rudenko
  • Andrey Kosyakov
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 23
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Andrey Kosyakov <ca...@chromium.org>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Alex Rudenko <alexr...@chromium.org>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Fri, 16 Jan 2026 12:25:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Andrey Kosyakov <ca...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Alex Rudenko (Gerrit)

unread,
2:14 AM (4 hours ago) 2:14 AM
to Paulina Gacek, Andrey Kosyakov, Code Review Nudger, Patryk Chodur, Zgroza (Luke) Klimek, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Andrey Kosyakov, Paulina Gacek and Zgroza (Luke) Klimek

Alex Rudenko added 1 comment

File chrome/browser/devtools/protocol/smart_card_emulation_handler_browsertest.cc
Andrey Kosyakov . unresolved

It's usually way more practical so write CDP tests in JavaScript. Also, all your implementation is in content/ layer, so I assume it may be possible to test it in the content layer as well? Please see //third_party/blink/web_tests/http/tests/inspector-protocol for examples of content-side CDP tests. It may be possible to run these in chrome as well, the JS-side framework would be the same, but there's a tiny bit of boilerplate required on the C++ side, see chrome/browser/headless/headless_mode_protocol_browsertest.cc.

Paulina Gacek

Thanks for the suggestion! The Smart Card API must be run within an Isolated Web App (IWA) context. I used IsolatedWebAppBrowserTestHarness (from chrome/) because it handles the complex IWA setup and permissions automatically. Porting this to the content/ layer or web_tests would require significant mocking of the IWA infrastructure.

Andrey Kosyakov

Wouldn't this take care of it?
https://source.chromium.org/chromium/chromium/src/+/main:content/shell/common/shell_switches.h;l=45?

(note we've got a virtual test suite setup to use this https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/virtual/isolated-context/README.md, https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/VirtualTestSuites;l=1748?)

Paulina Gacek

@alexr...@chromium.org thanks for these test scenarios!

However, since this CL only implements the base enable/disable commands, adding these tests now triggers Mojo crashes because we can't yet gracefully resolve the establishContext calls they rely on. I implemented test scenarios (1) and (2) in the subsequent CL: 7361937.

Alex Rudenko

Could you please clarify what is the consensus in the discussion with @ca...@chromium.org about the type of tests best suitable for this?

Open in Gerrit

Related details

Attention is currently required from:
  • Andrey Kosyakov
  • Paulina Gacek
  • Zgroza (Luke) Klimek
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: I2340eccbd0fe49cced25d29b38a5ae81f7efd689
Gerrit-Change-Number: 7265445
Gerrit-PatchSet: 26
Gerrit-Owner: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Alex Rudenko <alexr...@chromium.org>
Gerrit-Reviewer: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Reviewer: Patryk Chodur <pch...@google.com>
Gerrit-Reviewer: Paulina Gacek <paulin...@google.com>
Gerrit-Reviewer: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
Gerrit-Attention: Andrey Kosyakov <ca...@chromium.org>
Gerrit-Attention: Paulina Gacek <paulin...@google.com>
Gerrit-Attention: Zgroza (Luke) Klimek <zgr...@chromium.org>
Gerrit-Comment-Date: Tue, 20 Jan 2026 07:14:17 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages