Closed Bug 1537768 Opened 6 years ago Closed 6 years ago

Make it easier to start the remote agent from tests

Categories

(Remote Protocol :: Agent, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ochameau, Assigned: ochameau)

References

Details

Attachments

(2 files, 1 obsolete file)

For now, tests have to do the following in order to start a remote server:
https://searchfox.org/mozilla-central/rev/7c20ad925005fbad7b8e08813115f1ec7fa1c248/remote/test/browser/browser_cdp.js#30-33

  // Start the CDP server
  const RemoteAgent = Cc["@mozilla.org/remote/agent"].getService(Ci.nsISupports).wrappedJSObject;
  RemoteAgent.tabs.start();
  RemoteAgent.listen(Services.io.newURI("http://localhost:9222"));

The first line, to retrieve the RemoteAgent singleton is going to be simplified in bug 1536888. But there will still be the second line, where the tests have to know that internally, the remote agent has to start its TabsObserver.
It would be helpful if that step can be done as part of listen or something.

Priority: -- → P3
Assignee: nobody → poirot.alex

Start the TabObserver from RemoteAgent.listen in order to prevent
having the tests to manually start it.
Start it from listen instead of init as we do stop the TabObserver from
stop and stop is the reverse of listen, not the reverse of init.

Attached file Bug 1537768 - Simplify RemoteAgent initialization. (obsolete) (deleted) —

Automatically initialize the agent from listen in order to only
have to call this one method in order to start it.

This allows improving all tests exceptions without requiring
any specific to be done in each tests.
I'm also moving a few imports to head.js to share the most into head.js.

Status: NEW → ASSIGNED
Priority: P3 → P1
Attachment #9061751 - Attachment is obsolete: true
Depends on: 1543099
Pushed by apoirot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/216940ec115d Simplify RemoteAgent initialization. r=remote-protocol-reviewers,ato https://hg.mozilla.org/integration/autoland/rev/6586c6e89759 Override add_task to translate cdp exception from head.js. r=remote-protocol-reviewers,ato
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Regressions: 1603451
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: