PTAL at the third leg of the requestDevice filters patch.
4 years, 10 months ago
(2015-06-15 21:27:17 UTC)
#2
PTAL at the third leg of the requestDevice filters patch.
scheib
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/requestDevice.html File LayoutTests/bluetooth/requestDevice.html (right): https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/requestDevice.html#newcode50 LayoutTests/bluetooth/requestDevice.html:50: }).catch(function(e) { Would be nice to have a .then(/* ...
4 years, 10 months ago
(2015-06-15 23:47:15 UTC)
#3
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
File LayoutTests/bluetooth/requestDevice.html (right):
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:50: }).catch(function(e) {
Would be nice to have a .then(/* verify something worked */, /* assert_unreached
*/)
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:71:
Hmm, more test ideas to consider:
- Multiple devices each match one of multiple filters.
e.g. filters: [{services: [glucoseServiceUuid,
heartRateServiceUuid]}]
(returns either one of them).
- Multiple devices match a single filter?
e.g. filters: [{services: [glucoseServiceUuid]}]
(adapter has 2+ glucose devices, any one of them returned)
- More filters exist than devices, but one is returned.
e.g. filters: [{services: [somethingNotFoundServiceUuid,
heartRateServiceUuid,
somethingNotFoundServiceUuid2]}]
(adapter has only heart rate device, it is returned)
Jeffrey Yasskin
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/requestDevice.html File LayoutTests/bluetooth/requestDevice.html (right): https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/requestDevice.html#newcode50 LayoutTests/bluetooth/requestDevice.html:50: }).catch(function(e) { On 2015/06/15 23:47:14, scheib wrote: > Would ...
4 years, 10 months ago
(2015-06-16 01:31:33 UTC)
#4
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
File LayoutTests/bluetooth/requestDevice.html (right):
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:50: }).catch(function(e) {
On 2015/06/15 23:47:14, scheib wrote:
> Would be nice to have a .then(/* verify something worked */, /*
assert_unreached
> */)
With your suggestion on the browser side, I can drop the .catch entirely. Simply
getting a device back verifies that it worked.
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:71:
On 2015/06/15 23:47:14, scheib wrote:
> Hmm, more test ideas to consider:
>
> - Multiple devices each match one of multiple filters.
> e.g. filters: [{services: [glucoseServiceUuid]},
> {services: [heartRateServiceUuid]}]
> (returns either one of them).
>
> - Multiple devices match a single filter?
> e.g. filters: [{services: [glucoseServiceUuid]}]
> (adapter has 2+ glucose devices, any one of them returned)
So these two are basically "doesn't crash" tests? I'd like to be able to assert
that we show _all_ of the devices in the dialog, but we don't have the dialog
hooked up yet, or a pathway to report which devices were shown. Maybe we should
wait on these until we have that?
> - More filters exist than devices, but one is returned.
> e.g. filters: [{services: [somethingNotFoundServiceUuid]},
> {services: [heartRateServiceUuid]},
> {services: [somethingNotFoundServiceUuid2]}]
> (adapter has only heart rate device, it is returned)
I've added this one, and a couple others.
4 years, 10 months ago
(2015-06-16 03:11:48 UTC)
#5
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
File LayoutTests/bluetooth/requestDevice.html (right):
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:50: }).catch(function(e) {
On 2015/06/16 01:31:33, Jeffrey Yasskin wrote:
> On 2015/06/15 23:47:14, scheib wrote:
> > Would be nice to have a .then(/* verify something worked */, /*
> assert_unreached
> > */)
>
> With your suggestion on the browser side, I can drop the .catch entirely.
Simply
> getting a device back verifies that it worked.
This one is nearly identical to "An extra filter doesn\'t prevent matching."
now, though it has optionalServices. Perhaps make them adjacent and name them
similarly or in another way to draw out the small diference.
I think it's best as in the latter test to have the .then ...
assert_equals(device.name so that the expected result of the request is clear.
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:71:
On 2015/06/16 01:31:33, Jeffrey Yasskin wrote:
> On 2015/06/15 23:47:14, scheib wrote:
> > Hmm, more test ideas to consider:
> >
> > - Multiple devices each match one of multiple filters.
> > e.g. filters: [{services: [glucoseServiceUuid]},
> > {services: [heartRateServiceUuid]}]
> > (returns either one of them).
> >
> > - Multiple devices match a single filter?
> > e.g. filters: [{services: [glucoseServiceUuid]}]
> > (adapter has 2+ glucose devices, any one of them returned)
>
> So these two are basically "doesn't crash" tests?
Yes, not essential, but not a bad idea.
> I'd like to be able to assert
> that we show _all_ of the devices in the dialog, but we don't have the dialog
> hooked up yet, or a pathway to report which devices were shown. Maybe we
should
> wait on these until we have that?
OK, That's a good idea, though. Perhaps file an issue for ship blocking that we
bother to test the results of filters and what is shown? We'd have to plumb back
more info, and I'm unsure if we want to widen the testing API surface so much.
Later perhaps we'll see more nice to have testing API items and plan a design
for it.
>
> > - More filters exist than devices, but one is returned.
> > e.g. filters: [{services: [somethingNotFoundServiceUuid]},
> > {services: [heartRateServiceUuid]},
> > {services: [somethingNotFoundServiceUuid2]}]
> > (adapter has only heart rate device, it is returned)
>
> I've added this one, and a couple others.
Jeffrey Yasskin
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/requestDevice.html File LayoutTests/bluetooth/requestDevice.html (right): https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/requestDevice.html#newcode50 LayoutTests/bluetooth/requestDevice.html:50: }).catch(function(e) { On 2015/06/16 03:11:48, scheib wrote: > On ...
4 years, 10 months ago
(2015-06-16 17:18:08 UTC)
#6
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
File LayoutTests/bluetooth/requestDevice.html (right):
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:50: }).catch(function(e) {
On 2015/06/16 03:11:48, scheib wrote:
> On 2015/06/16 01:31:33, Jeffrey Yasskin wrote:
> > On 2015/06/15 23:47:14, scheib wrote:
> > > Would be nice to have a .then(/* verify something worked */, /*
> > assert_unreached
> > > */)
> >
> > With your suggestion on the browser side, I can drop the .catch entirely.
> Simply
> > getting a device back verifies that it worked.
>
> This one is nearly identical to "An extra filter doesn\'t prevent matching."
> now, though it has optionalServices. Perhaps make them adjacent and name them
> similarly or in another way to draw out the small diference.
>
> I think it's best as in the latter test to have the .then ...
> assert_equals(device.name so that the expected result of the request is clear.
The important thing for this test is the ScanFilterCheckingAdapter, not anything
about the returned data. We're asserting that the platform is asked to scan with
the UUIDs in the filtered services, but not any UUIDs in the optional services.
So any similarity with a later test is probably more distracting than something
to draw out.
I can add a comment to that effect, so it's clearer to the next reader.
There isn't really any expected result of the request, since the work happens in
the mock adapter, not in this test. It's not even important to have the promise
reject when the test fails, since the EXPECT_CALL failing will cause the test to
fail.
https://codereview.chromium.org/1174843002/diff/40001/LayoutTests/bluetooth/r...
LayoutTests/bluetooth/requestDevice.html:71:
On 2015/06/16 03:11:48, scheib wrote:
> On 2015/06/16 01:31:33, Jeffrey Yasskin wrote:
> > I'd like to be able to assert
> > that we show _all_ of the devices in the dialog, but we don't have the
dialog
> > hooked up yet, or a pathway to report which devices were shown. Maybe we
> should
> > wait on these until we have that?
>
> OK, That's a good idea, though. Perhaps file an issue for ship blocking that
we
> bother to test the results of filters and what is shown? We'd have to plumb
back
> more info, and I'm unsure if we want to widen the testing API surface so much.
> Later perhaps we'll see more nice to have testing API items and plan a design
> for it.
Here's an issue for wiring up the dialog in a testable way:
https://crbug.com/500989.
scheib
LGTM
4 years, 10 months ago
(2015-06-16 17:25:18 UTC)
#7
LGTM
ortuno
https://codereview.chromium.org/1174843002/diff/80001/LayoutTests/bluetooth/requestDevice.html File LayoutTests/bluetooth/requestDevice.html (right): https://codereview.chromium.org/1174843002/diff/80001/LayoutTests/bluetooth/requestDevice.html#newcode60 LayoutTests/bluetooth/requestDevice.html:60: filters: [{services: [glucoseServiceUuid]}] If you pass something other than ...
4 years, 10 months ago
(2015-06-18 22:04:42 UTC)
#8
Issue 1174843002: Add tests for RequestDeviceOptions and clean up.
(Closed)
Created 4 years, 10 months ago by Jeffrey Yasskin
Modified 4 years, 10 months ago
Reviewers: ortuno, scheib
Base URL: https://chromium.googlesource.com/chromium/blink.git@pinned
Comments: 9