Closed Bug 939637 Opened 11 years ago Closed 11 years ago

B2G Bluetooth: add test cases for navigator.BluetoothManager.onadapteradded

Categories

(Firefox OS Graveyard :: Bluetooth, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
1.3 C1/1.4 S1(20dec)

People

(Reporter: vicamo, Assigned: vicamo)

References

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Comment on attachment 8333638 [details] [diff] [review]
patch

Review of attachment 8333638 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/bluetooth/tests/marionette/test_dom_BluetoothManager_adapteradded.js
@@ +9,5 @@
> +
> +startBluetoothTest(function testCaseMain(aAdapter) {
> +  log("Checking adapter attributes ...");
> +  is(aAdapter.name, "Full Android on Emulator", "adapter.name");
> +  is(aAdapter.class, 0, "adapter.class");

Racing condition for |adapter.class|.  It seems this attribute is edited as 5767692 soon after onadapteradded event is emitted.  Most of the time we got 0, but it should be 5767692 at the end.
Attachment #8333638 - Flags: review?(echou)
$ adb shell hciconfig /dev/ttyS2 class
hci0:	Type: BR/EDR  Bus: UART
	BD Address: 56:34:12:00:54:52  ACL MTU: 512:1  SCO MTU: 0:0
	Class: 0x58020c
	Service Classes: Capturing, Object Transfer, Telephony
	Device Class: Phone, Smart phone
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #2)
> ::: dom/bluetooth/tests/marionette/test_dom_BluetoothManager_adapteradded.js
> > +  is(aAdapter.class, 0, "adapter.class");
> 
> Racing condition for |adapter.class|.  It seems this attribute is edited as
> 5767692 soon after onadapteradded event is emitted.  Most of the time we got
> 0, but it should be 5767692 at the end.

See bug 932914 comment 22, 23.  Sometimes PropertyChange events come after onadapteradded.
Attached patch patch : v2Splinter Review
1) add a 3 seconds time delay before returning |aAdapter|.
2) refactor |startBluetoothTest| a little bit more so that it still works with either value of 'bluetooth.enabled'.
Attachment #8333638 - Attachment is obsolete: true
Attachment #8333760 - Flags: review?
See also bug 912930, "stop using adapteradded event".
Attachment #8333760 - Flags: review? → review?(echou)
Comment on attachment 8333760 [details] [diff] [review]
patch : v2

Review of attachment 8333760 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good to me. Thanks.
Attachment #8333760 - Flags: review?(echou) → review+
https://hg.mozilla.org/mozilla-central/rev/fc6d66e72c59
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → 1.3 C1/1.4 S1(20dec)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: