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

Issue 2816663002: Ensure tests don't depend on fake devices being added synchronously (Closed)

Created:
3 years, 8 months ago by Reilly Grant (use Gerrit)
Modified:
3 years, 8 months ago
Reviewers:
ortuno
CC:
blink-reviews, chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Ensure tests don't depend on fake devices being added synchronously As specified navigator.usb.test.addFakeDevice and removeFakeDevice do not synchronously add and remove the fake device however the Mojo-based polyfill does. This patch adds a delay and fixes the WebUSB tests so that they do not depend on this behaviors. BUG=705734 Review-Url: https://codereview.chromium.org/2816663002 Cr-Commit-Position: refs/heads/master@{#465329} Committed: https://chromium.googlesource.com/chromium/src/+/da15150a621a853c809cfc0375ef78822bfd54b7

Patch Set 1 #

Total comments: 18

Patch Set 2 : Address ortuno@ comments #

Total comments: 9

Patch Set 3 : Remove GUIDs from the test interface #

Total comments: 4

Patch Set 4 : Define FakeUSBDevice class only once #

Unified diffs Side-by-side diffs Delta from patch set Stats (+224 lines, -377 lines) Patch
M third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js View 1 2 1 chunk +32 lines, -0 lines 0 comments Download
M third_party/WebKit/LayoutTests/usb/resources/webusb-test.js View 1 2 3 8 chunks +43 lines, -26 lines 0 comments Download
M third_party/WebKit/LayoutTests/usb/usb.html View 1 2 3 chunks +36 lines, -64 lines 0 comments Download
M third_party/WebKit/LayoutTests/usb/usb-connection-event.html View 1 2 1 chunk +3 lines, -6 lines 0 comments Download
M third_party/WebKit/LayoutTests/usb/usbDevice.html View 1 2 24 chunks +106 lines, -277 lines 0 comments Download
M third_party/WebKit/LayoutTests/usb/usbDevice-iframe.html View 1 2 3 chunks +4 lines, -4 lines 0 comments Download

Messages

Total messages: 28 (13 generated)
Reilly Grant (use Gerrit)
PTAL, I think this resolves your comment on the WPT export review.
3 years, 8 months ago (2017-04-12 01:55:56 UTC) #2
ortuno
https://codereview.chromium.org/2816663002/diff/1/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js File third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js (right): https://codereview.chromium.org/2816663002/diff/1/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js#newcode29 third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js:29: function getConnectedDevice(deviceInit) { Comment what the function does. Optional: ...
3 years, 8 months ago (2017-04-12 03:31:08 UTC) #3
Reilly Grant (use Gerrit)
Address ortuno@ comments
3 years, 8 months ago (2017-04-12 22:46:25 UTC) #4
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2816663002/diff/1/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js File third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js (right): https://codereview.chromium.org/2816663002/diff/1/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js#newcode29 third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js:29: function getConnectedDevice(deviceInit) { On 2017/04/12 03:31:07, ortuno wrote: > ...
3 years, 8 months ago (2017-04-12 22:47:07 UTC) #6
Reilly Grant (use Gerrit)
Friendly ping.
3 years, 8 months ago (2017-04-17 20:52:24 UTC) #10
ortuno
lgtm https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js File third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js (right): https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js#newcode30 third_party/WebKit/LayoutTests/usb/resources/usb-helpers.js:30: // USBDevice and its guid (for calling navigator.usb.test.removeFakeDevice(). ...
3 years, 8 months ago (2017-04-18 00:44:22 UTC) #11
Reilly Grant (use Gerrit)
Remove GUIDs from the test interface
3 years, 8 months ago (2017-04-18 01:27:08 UTC) #12
Reilly Grant (use Gerrit)
Please take another look as the code I added to add a FakeUSBDevice class is ...
3 years, 8 months ago (2017-04-18 01:27:52 UTC) #15
ortuno
lgtm https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/usb.html File third_party/WebKit/LayoutTests/usb/usb.html (right): https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/usb.html#newcode56 third_party/WebKit/LayoutTests/usb/usb.html:56: return navigator.usb.requestDevice({ filters: [] }).then(chosenDevice => { On ...
3 years, 8 months ago (2017-04-18 03:04:06 UTC) #18
Reilly Grant (use Gerrit)
Define FakeUSBDevice class only once
3 years, 8 months ago (2017-04-18 18:20:15 UTC) #19
Reilly Grant (use Gerrit)
https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/usb.html File third_party/WebKit/LayoutTests/usb/usb.html (right): https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/usb.html#newcode56 third_party/WebKit/LayoutTests/usb/usb.html:56: return navigator.usb.requestDevice({ filters: [] }).then(chosenDevice => { On 2017/04/18 ...
3 years, 8 months ago (2017-04-18 18:21:38 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2816663002/60001
3 years, 8 months ago (2017-04-18 18:22:48 UTC) #23
commit-bot: I haz the power
Committed patchset #4 (id:60001) as https://chromium.googlesource.com/chromium/src/+/da15150a621a853c809cfc0375ef78822bfd54b7
3 years, 8 months ago (2017-04-18 19:38:43 UTC) #26
ortuno
https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/usb.html File third_party/WebKit/LayoutTests/usb/usb.html (right): https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/LayoutTests/usb/usb.html#newcode56 third_party/WebKit/LayoutTests/usb/usb.html:56: return navigator.usb.requestDevice({ filters: [] }).then(chosenDevice => { On 2017/04/18 ...
3 years, 8 months ago (2017-04-18 21:27:16 UTC) #27
Reilly Grant (use Gerrit)
3 years, 8 months ago (2017-04-18 21:31:58 UTC) #28
Message was sent while issue was closed.
On 2017/04/18 21:27:16, ortuno wrote:
>
https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/Layo...
> File third_party/WebKit/LayoutTests/usb/usb.html (right):
> 
>
https://codereview.chromium.org/2816663002/diff/20001/third_party/WebKit/Layo...
> third_party/WebKit/LayoutTests/usb/usb.html:56: return
> navigator.usb.requestDevice({ filters: [] }).then(chosenDevice => {
> On 2017/04/18 at 18:21:38, Reilly Grant wrote:
> > On 2017/04/18 03:04:06, ortuno wrote:
> > > On 2017/04/18 at 01:27:52, Reilly Grant wrote:
> > > > On 2017/04/18 00:44:22, ortuno wrote:
> > > > > out of topic: Out of curiosity, how do you test the chooser? For web
> > > bluetooth
> > > > > we have a test API that we use to check what happens in the chooser
e.g.
> a
> > > new
> > > > > device is added, a device is removed, etc.
> > > > 
> > > >
> > >
>
https://cs.chromium.org/chromium/src/chrome/browser/usb/usb_chooser_controlle...
> > > 
> > > hmm so for Web Bluetooth we have tests to make sure the right devices
appear
> on
> > > the chooser depending on the filters. Do WebUSB's layout tests have
> something
> > > similar?
> > 
> > What devices appear in the chooser isn't visible to layout tests. The
> filtering logic is tested in,
> > 
> >
https://cs.chromium.org/chromium/src/device/usb/usb_device_filter_unittest.cc
> 
> No need to change anything, but why isn't this tested through layout tests?
The
> algorithm to filter devices is spec'ed and without cross browser tests for the
> algorithm there is no way to know all implementations are correct.

With the current layering it is impossible to test with a layout test.

Powered by Google App Engine
This is Rietveld 408576698