Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Issue 2812223006: Replace device_sensor browsertest by service unittest. (Closed)

Created:
3 years, 8 months ago by ke.he
Modified:
3 years, 7 months ago
CC:
chromium-reviews, mlamouri+watch-content_chromium.org, riju_, jam, timvolodine, darin-cc_chromium.org, mlamouri+watch-sensors_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Replace device_sensor browsertest by service unittest. To decouple device_sensor browsertest from //content, we have to port it into //service/device as a service unittest. Browsertest is an end to end test but browsertest cannot be decoupled out of //content. So we use 1)Service unittest plus 2)Layouttest to replace the browsertest. Service unittest simulates how render side call the mojo interface which is provided by browser side. Layouttest verifys the logics from JS API of blink to render layer. So Service unittest plus Layouttest have the same test effect as browsertest. The layouttests for device/sensors already exist, so here we only add the service unittests. All the test cases of service unittest run in the same process, while the IO thread will be re-created when setup each test case. But in the product code, there are many thread_checkers to make sure the DeviceSensorService instance runs in the same thread. So we have to use UI thread to simulate the IO thread in order to not breaking those DCHECKs. The shared_memory_seqlock_reader.{cc|h} is used by both render side and service unittest, so move it into //device/sensors/public/cpp/ folder. BUG=694888

Patch Set 1 #

Patch Set 2 : Replace device_sensor browsertest by service unittest. #

Patch Set 3 : Replace device_sensor browsertest by service unittest. #

Patch Set 4 : Set the default message_loop type of main thread as TYPE_UI #

Patch Set 5 : add java file deps for android #

Patch Set 6 : service unittest pass on android #

Patch Set 7 : Replace device_sensor browsertest by service unittest. #

Total comments: 24

Patch Set 8 : Addressed Reilly Grant's review comments. #

Patch Set 9 : code rebase #

Patch Set 10 : eliminate "unreachable code" warning. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+597 lines, -1231 lines) Patch
D content/browser/device_sensors/DEPS View 1 chunk +0 lines, -3 lines 0 comments Download
D content/browser/device_sensors/OWNERS View 1 chunk +0 lines, -3 lines 0 comments Download
D content/browser/device_sensors/device_sensor_browsertest.cc View 1 chunk +0 lines, -469 lines 0 comments Download
M content/renderer/BUILD.gn View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -2 lines 0 comments Download
M content/renderer/device_sensors/device_light_event_pump.h View 1 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/device_sensors/device_motion_event_pump.h View 1 2 chunks +2 lines, -2 lines 0 comments Download
M content/renderer/device_sensors/device_orientation_event_pump.h View 1 2 chunks +2 lines, -2 lines 0 comments Download
D content/renderer/shared_memory_seqlock_reader.h View 1 chunk +0 lines, -78 lines 0 comments Download
D content/renderer/shared_memory_seqlock_reader.cc View 1 chunk +0 lines, -62 lines 0 comments Download
M content/test/BUILD.gn View 1 2 3 4 5 6 7 8 2 chunks +0 lines, -3 lines 0 comments Download
D content/test/data/device_sensors/device_inertial_sensor_diagnostics.html View 1 2 3 4 5 6 1 chunk +0 lines, -228 lines 0 comments Download
D content/test/data/device_sensors/device_light_infinity_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -29 lines 0 comments Download
D content/test/data/device_sensors/device_light_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -31 lines 0 comments Download
D content/test/data/device_sensors/device_motion_null_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -37 lines 0 comments Download
D content/test/data/device_sensors/device_motion_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -40 lines 0 comments Download
D content/test/data/device_sensors/device_orientation_absolute_null_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -31 lines 0 comments Download
D content/test/data/device_sensors/device_orientation_absolute_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -35 lines 0 comments Download
D content/test/data/device_sensors/device_orientation_null_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -31 lines 0 comments Download
D content/test/data/device_sensors/device_orientation_test.html View 1 2 3 4 5 6 1 chunk +0 lines, -36 lines 0 comments Download
D content/test/data/device_sensors/device_sensors_null_test_with_alert.html View 1 2 3 4 5 6 1 chunk +0 lines, -66 lines 0 comments Download
M device/sensors/device_sensor_host.cc View 1 2 3 1 chunk +0 lines, -2 lines 0 comments Download
M device/sensors/device_sensor_service.cc View 1 chunk +1 line, -0 lines 0 comments Download
M device/sensors/public/cpp/BUILD.gn View 1 1 chunk +5 lines, -0 lines 0 comments Download
A + device/sensors/public/cpp/shared_memory_seqlock_reader.h View 1 3 chunks +12 lines, -14 lines 0 comments Download
A + device/sensors/public/cpp/shared_memory_seqlock_reader.cc View 1 2 chunks +12 lines, -12 lines 0 comments Download
M services/BUILD.gn View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M services/device/BUILD.gn View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -0 lines 0 comments Download
M services/device/device_service_test_base.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -0 lines 0 comments Download
M services/device/device_service_test_base.cc View 1 2 3 4 5 6 7 4 chunks +23 lines, -13 lines 0 comments Download
A + services/device/sensors/DEPS View 0 chunks +-1 lines, --1 lines 0 comments Download
A + services/device/sensors/OWNERS View 0 chunks +-1 lines, --1 lines 0 comments Download
A services/device/sensors/device_sensor_service_unittest.cc View 1 2 3 4 5 6 7 8 9 1 chunk +530 lines, -0 lines 0 comments Download
M services/device/unittest_manifest.json View 1 chunk +2 lines, -1 line 0 comments Download
M services/service_manager/public/cpp/lib/service_test.cc View 1 2 3 1 chunk +1 line, -1 line 0 comments Download

Dependent Patchsets:

Messages

Total messages: 65 (55 generated)
ke.he
Hi, Colin, PTAL, thanks!
3 years, 8 months ago (2017-04-17 05:01:11 UTC) #41
ke.he
Reillyg@ is working on the design doc to replace //device/sensor by //device/generic_sensor. Hi, Reillyg@, I ...
3 years, 8 months ago (2017-04-17 05:29:45 UTC) #43
Reilly Grant (use Gerrit)
On 2017/04/17 05:29:45, ke.he wrote: > Reillyg@ is working on the design doc to replace ...
3 years, 8 months ago (2017-04-17 15:52:31 UTC) #44
ke.he
On 2017/04/17 15:52:31, Reilly Grant wrote: > On 2017/04/17 05:29:45, ke.he wrote: > > Reillyg@ ...
3 years, 8 months ago (2017-04-18 03:49:11 UTC) #46
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2812223006/diff/180001/services/device/device_service_test_base.cc File services/device/device_service_test_base.cc (right): https://codereview.chromium.org/2812223006/diff/180001/services/device/device_service_test_base.cc#newcode98 services/device/device_service_test_base.cc:98: // each test case. So we decide to use ...
3 years, 8 months ago (2017-04-18 19:36:18 UTC) #47
ke.he
Reilly, Thanks very much! CL updated, PTAL. https://codereview.chromium.org/2812223006/diff/180001/services/device/device_service_test_base.cc File services/device/device_service_test_base.cc (right): https://codereview.chromium.org/2812223006/diff/180001/services/device/device_service_test_base.cc#newcode98 services/device/device_service_test_base.cc:98: // each ...
3 years, 8 months ago (2017-04-19 06:49:02 UTC) #61
blundell
I'm slightly confused about what will happen to this test once the device sensors impl ...
3 years, 8 months ago (2017-04-19 09:15:54 UTC) #62
ke.he
On 2017/04/19 09:15:54, blundell wrote: > I'm slightly confused about what will happen to this ...
3 years, 8 months ago (2017-04-19 09:57:18 UTC) #63
blundell
On 2017/04/19 09:57:18, ke.he wrote: > On 2017/04/19 09:15:54, blundell wrote: > > I'm slightly ...
3 years, 8 months ago (2017-04-19 15:10:40 UTC) #64
ke.he
3 years, 8 months ago (2017-04-20 08:32:03 UTC) #65
On 2017/04/19 15:10:40, blundell wrote:
> On 2017/04/19 09:57:18, ke.he wrote:
> > On 2017/04/19 09:15:54, blundell wrote:
> > > I'm slightly confused about what will happen to this test once the device
> > > sensors impl and interface are eliminated. Reilly, is your vision that you
> > will
> > > port it to be a similar test of generic sensors rather than just
eliminating
> > it?
> > > Otherwise, it seems like we could just leave the browsertest and then
> > eliminate
> > > that when the time comes.
> > 
> > Hi, Colin and Reilly, The related work status is:
> > 
> > For //device/sensor, there are 2 tasks ongoing, but almost done.
> > 1) Replace device sensor browsertest by service unittest. --- in reviewing.
> > 2) Move //device/sensors into //services/device/. (it is the last step of
> device
> > sensor servicification)   --- depend on task 1) above, but almost done,
> > See(https://codereview.chromium.org/2819273006/#).
> > 
> > For //device/generic_sensor, similarly 2 tasks in plan:
> > 3) Replace device generic sensor browsertest by service unittest. --- just
> > started.
> > 4) Move //device/generic_sensors into //services/device/.  --- not start.
> > 
> > Should we finished the servification of device sensor first? because it is
> > almost done. And, should I continue the task 3)?
> > 
> > Thanks very much.
> 
> Based on comments #31 and #32 in crbug.com/612322, I would have said that we
> should mark the device sensor servicification bugs as obsolete and replace
them
> with a bug to eliminate usage of device sensors in favor of usage of generic
> sensors (Reilly, does such a bug exist?). However, I'm curious for Reilly's
> response to my question above, as proceeding with this CL doesn't match my
> understanding based on those comments.
> 
> Steps (3) and (4) seem like great work to pursue independent of the resolution
> of how/whether to proceed on device sensors work at this point. Reilly, is
there
> any coordination to do between Ke He pursuing servicification of generic
sensors
> and your work to replace device sensors usage with generic sensors usage?
> 
> Thanks,
> 
> Colin

Colin, Thanks! I'll stop proceeding with this CL.
I see the discussions that the current solution of replacing browsertest is not
good enough, so I'll also temporarily stop steps 3) and 4).

Powered by Google App Engine
This is Rietveld 408576698