Eliminate dependency completely from //extensions/browser/api/serial on //device/serial |
|||
Issue descriptionRemove the dependency at https://cs.chromium.org/chromium/src/extensions/browser/api/serial/serial_apitest.cc?rcl=8c593c51be7804e3135e37e06dfb0106ee0cbdb3&l=130 In browser tests SerialApiTest, FakeSerialIoHandler is a fake impl for interface device::mojom::SerialIoHandler, it holds a device::TestSerialIoHandler to do actual(fake) work, while the device::TestSerialIoHandler definition resides in //device/serial. Options: 1. Move device::TestSerialIoHandler definition .h/cc files into //services/device/public/cpp/serial as a client library of device service. 2. In SerialApiTest do not intercept SerialIoHandler interface request, but just let it connect to the real device service. Here https://cs.chromium.org/chromium/src/services/device/serial/serial_io_handler_impl.cc?rcl=8c593c51be7804e3135e37e06dfb0106ee0cbdb3&l=25, make the real impl SerialIoHandlerImpl to create/use a TestSerialIoHandler if it found now it's in a browser tests environment. The problem is how can Device Service know it's in a test environment or not.. Is there any APIs for such use case?
,
Aug 21 2017
I'd prefer option 3, merge device::TestSerialIoHandler into FakeSerialIoHandler. If more than one client of //services/device wants a fake SerialIoHandler implementation we can move it into //services/device/public/cpp/serial but otherwise it's okay to leave it in serial_apitest.cc.
,
Aug 22 2017
1, device::TestSerialIoHandler is a subclass of device::SerialIoHandler, means it has hard dependency on //device/serial, so we can't easily merge it into the FakeSerialIoHandler under //extensions/browser/api/serial/. 2, device::TestSerialIoHandler is also used by //tools/battor_agent codes for testing. And I noticed that test_serial_io_handler.* are within the //device/serial:test_support gn target, so I'd like to keep all things as is and just make this target visible to both //extensions:chrome_extensions_browsertests (for usage in serial_apitest.cc) and //tools/battor_agent:battor_agent_unittests (for usage in tools/battor_agent/) Does this make sense?
,
Aug 22 2017
An eventual goal is to merge device::SerialIoHandler with device::SerialIoHandlerImpl so it makes sense to me to make FakeSerialIoHandler a direct subclass of mojom::SerialIoHandler and remove the dependency on //device/serial in the extensions API test code. Since //tools/battor_agent still needs a non-Mojo mock serial connection we can move device::TestSerialIoHandler into battor_connection_impl_unittest.cc. Note that I don't believe the battor tests make full use of the functionality of device::TestSerialIoHandler so it may be possible to simplify it.
,
Aug 31 2017
Sorry for late response. I'm not very sure about my understanding, so I want to confirm: Currently FakeSerialIoHandler in serial_apitest.cc is already a direct subclass of mojom::SerialIoHandler, your suggestion is to merge TestSerialIoHandler impl into FakeSerialIoHandler? Understood that we'd better merge necessary parts of TestSerialIoHandler into battor_connection_impl_unittest.cc.
,
Aug 31 2017
Yes, merge TestSerialIoHandler impl into FakeSerialIoHandler so that FakeSerialIoHandler doesn't depend on //device/serial.
,
Sep 2 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/659e65f84b56393a147ba98c6e54fa30cafe9c7e commit 659e65f84b56393a147ba98c6e54fa30cafe9c7e Author: Han Leon <leon.han@intel.com> Date: Sat Sep 02 04:59:54 2017 [DeviceService] Eliminate dependency on //device/serial from //extensions This CL merges necessary parts of device::TestSerialIoHandler implementation into serial_apitest.cc so that we can eliminate completely the dependency on //device/serial from //extensions. BUG= 757169 TEST=browser_tests SerialApiTest.* TBR=charliea@chromium.org for trivial changes in tools/battor_agent/ Change-Id: Ie981dd14c9eba40c4a162d0f51e486e8461e1997 Reviewed-on: https://chromium-review.googlesource.com/646978 Commit-Queue: Han Leon <leon.han@intel.com> Reviewed-by: Reilly Grant <reillyg@chromium.org> Cr-Commit-Position: refs/heads/master@{#499386} [modify] https://crrev.com/659e65f84b56393a147ba98c6e54fa30cafe9c7e/chrome/test/BUILD.gn [modify] https://crrev.com/659e65f84b56393a147ba98c6e54fa30cafe9c7e/device/BUILD.gn [modify] https://crrev.com/659e65f84b56393a147ba98c6e54fa30cafe9c7e/device/serial/BUILD.gn [modify] https://crrev.com/659e65f84b56393a147ba98c6e54fa30cafe9c7e/extensions/BUILD.gn [modify] https://crrev.com/659e65f84b56393a147ba98c6e54fa30cafe9c7e/extensions/browser/api/BUILD.gn [delete] https://crrev.com/910ab17ccc84f26b89417cd5cf4690a9af327d2b/extensions/browser/api/serial/DEPS [modify] https://crrev.com/659e65f84b56393a147ba98c6e54fa30cafe9c7e/extensions/browser/api/serial/serial_apitest.cc [modify] https://crrev.com/659e65f84b56393a147ba98c6e54fa30cafe9c7e/tools/battor_agent/BUILD.gn
,
Sep 2 2017
,
Nov 7 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by leon....@intel.com
, Aug 19 2017