Closed Bug 721495 Opened 12 years ago Closed 12 years ago

Passwordmgr tests: Use EventUtils sendChar() and sendKey(), instead of calling synthesizeKey() directly

Categories

(Toolkit :: Password Manager, defect)

defect
Not set
minor

Tracking

()

VERIFIED FIXED
mozilla12

People

(Reporter: karun.84, Assigned: karun.84)

References

()

Details

Attachments

(1 file, 3 obsolete files)

Referencing bug Bug 720087, I plan on fixing this in the passwordmgr tests first. Ive created an initial bug for this section.
Blocks: 720087
Assignee: nobody → karun.84
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Version: unspecified → Trunk
Here is the patch for this bug for password manager. I have ran the mochitests locally, and have not encountered any errors with this patch.
I added the patch again, with the code formatting fixed. For review.
Attachment #591914 - Attachment is obsolete: true
Attachment #591916 - Flags: review?(paul)
Comment on attachment 591916 [details] [diff] [review]
Patch for this bug to replace synthesizeKey with sendKey - With code formatting corrected

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

::: toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
@@ +113,5 @@
>                          Services.ww.unregisterNotification(arguments.callee);
>                      else if (aTopic == "domwindowopened") {
>                          let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
>                          SimpleTest.waitForFocus(function() {
> +                            EventUtils.sendKey("VK_RETURN")

No, this should become
EventUtils.sendKey("RETURN", win)

::: toolkit/components/passwordmgr/test/browser/browser_passwordmgrdlg.js
@@ +123,5 @@
>                          Services.ww.unregisterNotification(arguments.callee);
>                      else if (aTopic == "domwindowopened") {
>                          let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
>                          SimpleTest.waitForFocus(function() {
> +			    EventUtils.sendKey("VK_RETURN")

There are still tabs on your new line :-/
Attachment #591916 - Flags: review?(paul) → review-
(In reply to Karun Dambiec from comment #1)
> I have ran the mochitests locally, and have not encountered any errors with this patch.

Hum, at least with a debug build, you should have gotten something like
"JavaScript error: , line 0: uncaught exception: Unknown key: VK_VK_RETURN"
(In reply to Serge Gautherie (:sgautherie) from comment #4)
> (In reply to Karun Dambiec from comment #1)
> > I have ran the mochitests locally, and have not encountered any errors with this patch.
> 
> Hum, at least with a debug build, you should have gotten something like
> "JavaScript error: , line 0: uncaught exception: Unknown key: VK_VK_RETURN"

Ok, thanks. Maybe I need to have a look at how my build is setup. I will make a new patch for this bug, with it fixed to be RETURN, and not VK_Return.
I have fixed the code formatting, and the use of sendKey with this version of the patch
Attachment #591916 - Attachment is obsolete: true
Attachment #591932 - Flags: review?(sgautherie.bz)
Comment on attachment 591932 [details] [diff] [review]
Patch for this bug to replace synthesizeKey with sendKey - With code formatting corrected and use of Sendkey corrected

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

::: toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
@@ +113,5 @@
>                          Services.ww.unregisterNotification(arguments.callee);
>                      else if (aTopic == "domwindowopened") {
>                          let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
>                          SimpleTest.waitForFocus(function() {
> +                            EventUtils.sendKey("RETURN", win)

Nit: while here, could you try adding a ';'.
Attachment #591932 - Flags: review?(sgautherie.bz)
Attachment #591932 - Flags: review?(paul)
Attachment #591932 - Flags: feedback+
(In reply to Serge Gautherie (:sgautherie) from comment #7)
> Comment on attachment 591932 [details] [diff] [review]
> Patch for this bug to replace synthesizeKey with sendKey - With code
> formatting corrected and use of Sendkey corrected
> 
> Review of attachment 591932 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: toolkit/components/passwordmgr/test/browser/browser_passwordmgr_sort.js
> @@ +113,5 @@
> >                          Services.ww.unregisterNotification(arguments.callee);
> >                      else if (aTopic == "domwindowopened") {
> >                          let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
> >                          SimpleTest.waitForFocus(function() {
> > +                            EventUtils.sendKey("RETURN", win)
> 
> Nit: while here, could you try adding a ';'.

Yes a ; is good. I was not sure if this was a specific coding practice for the password manager/firefox, and did not want to change it  much initially.
This is a revision of the previous patch with a ; added to the javascript.
Attachment #591932 - Attachment is obsolete: true
Attachment #591932 - Flags: review?(paul)
Attachment #591941 - Flags: review?(paul)
Comment on attachment 591941 [details] [diff] [review]
Patch for this bug to replace synthesizeKey with sendKey - Code Formatting fixed

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

Looks good. Thanks for the contribution!
Attachment #591941 - Flags: review?(paul) → review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
Attachment #591941 - Flags: checkin+
https://hg.mozilla.org/mozilla-central/rev/ab27cd796845
Status: ASSIGNED → RESOLVED
Closed: 12 years ago12 years ago
Resolution: --- → FIXED
V.Fixed, per mxr search.
Status: RESOLVED → VERIFIED
Flags: in-testsuite+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: