Closed Bug 777451 Opened 12 years ago Closed 9 years ago

Allow better communication between pages and java in robocop tests

Categories

(Firefox for Android Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wesj, Unassigned)

Details

Attachments

(1 file, 2 obsolete files)

Two things I've wanted for robocop: 1.) The ability to load pages with chrome privileges. Those pages can then register for Java notifications and respond to them. 2.) The ability for java to get back responses from the pages. We're already shipping a roboextender extension. We can provide some easy hooks to push chrome pages with it. Those pages can then register as observers for messages from java. Java will have to also register for messages from pages, but we can pass messages with those so that Java can get data back from pages. Sound good? Patch coming.
Attached patch Patch (obsolete) — Splinter Review
This copies files from mobile/android/base/tests/roboextender to the roboextender base directory during build, and also includes a chrome.manifest file so that the chrome://roboextender/content directory is recognized.
Assignee: nobody → wjohnston
Attachment #645841 - Flags: review?(gbrown)
Attached patch Patch 2/2 (obsolete) — Splinter Review
This adds a waitForReturn method to the eventExpecter which can be used to get any data sent from js.
Attachment #645843 - Flags: review?(gbrown)
Comment on attachment 645843 [details] [diff] [review] Patch 2/2 Review of attachment 645843 [details] [diff] [review]: ----------------------------------------------------------------- Good idea. Do you have another patch that makes use of it? ::: build/mobile/robocop/FennecNativeActions.java.in @@ +112,5 @@ > return null; > } > } > > + public class GeckoEventExpecter implements EventExpecter { why does this need to change to public? @@ +117,4 @@ > private final String mGeckoEvent; > private final Object[] mRegistrationParams; > private boolean mEventReceived; > + private String mEventName; I don't see mEventName accessed/read anywhere. Will it be used? @@ +137,5 @@ > FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG, > "unblocked on expecter for " + mGeckoEvent); > } > > + public synchronized String waitForReturn() { nit - I would prefer a name that parallels the existing method names: blockForEventAndGetData / blockForEventData / blockForEventReturn?
Attachment #645843 - Flags: review?(gbrown) → review+
Comment on attachment 645841 [details] [diff] [review] Patch Review of attachment 645841 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/mochitest/roboextender/Makefile.in @@ +25,5 @@ > libs:: $(_TEST_FILES) > $(MKDIR) -p $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org > $(INSTALL) $(foreach f,$^,"$f") $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org/ > + $(MKDIR) -p $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org/base > + cp $(TESTPATH)/* $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org/base Neither patch creates or populates TESTPATH. Do you have another patch for that? Without it, make fails: mkdir -p ../../../_tests/testing/mochitest/extensions/roboextender@mozilla.org/base cp /home/mozdev/src/mobile/android/base/tests/roboextender/* ../../../_tests/testing/mochitest/extensions/roboextender@mozilla.org/base cp: cannot stat `/home/mozdev/src/mobile/android/base/tests/roboextender/*': No such file or directory
Attachment #645841 - Flags: review?(gbrown) → review-
Whoops. sorry about that. I have some partially working tests that use this for prompts that I was hoping to put in bug 757481. The tests in there right now are not up to date using this. The tests that do use it are racy and fail sometimes when calling clickOnButton("OK"). So I shelved that project for a bit. I'll update this so it doesn't fail if the test path doesn't exist. Margaret was also looking for something similar. Maybe she's got some tests that could use this?
Comment on attachment 645843 [details] [diff] [review] Patch 2/2 Marking this as obsolete because I stole it and updated it for bug 840825.
Attachment #645843 - Attachment is obsolete: true
(In reply to Wesley Johnston (:wesj) from comment #0) > Two things I've wanted for robocop: > > 1.) The ability to load pages with chrome privileges. Those pages can then > register for Java notifications and respond to them. > 2.) The ability for java to get back responses from the pages. This need has re-surfaced in bug 855146; see especially comment 16.
And the evolution continues...see bug 870908. I am much happier with the capabilities we have today. I think we can probably close this bug now.
Flags: needinfo?(wjohnston)
Sonds good to me.
Status: NEW → RESOLVED
Closed: 11 years ago
Flags: needinfo?(wjohnston)
Resolution: --- → FIXED
Attached patch Patch v2Splinter Review
I'm back to wanting this again for bug 757481. This creates the directory if it doesn't exist. It also ignores errors in the copy command because an error gets thrown if the dir is empty.
Attachment #645841 - Attachment is obsolete: true
Attachment #811624 - Flags: review?(gbrown)
Attachment #811624 - Flags: review?(gbrown) → review+
This needed build peer review.
Flags: needinfo?(wjohnston)
Comment on attachment 811624 [details] [diff] [review] Patch v2 No idea who to ask for this stuff.
Attachment #811624 - Flags: review?(gps)
Comment on attachment 811624 [details] [diff] [review] Patch v2 Review of attachment 811624 [details] [diff] [review]: ----------------------------------------------------------------- ::: testing/mochitest/roboextender/Makefile.in @@ +5,5 @@ > > +DEPTH = ../../.. > +topsrcdir = @top_srcdir@ > +srcdir = @srcdir@ > +VPATH = @srcdir@ You don't need everything up through here. @@ +10,5 @@ > +relativesrcdir = testing/mochitest/roboextender > +TESTPATH = $(topsrcdir)/mobile/android/base/tests/roboextender > + > +include $(DEPTH)/config/autoconf.mk > + You can define relativesrcdir and TESTPATH here. @@ +26,5 @@ > $(MKDIR) -p $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org > $(INSTALL) $(foreach f,$^,"$f") $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org/ > + $(MKDIR) -p $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org/base > + $(MKDIR) -p $(TESTPATH) > + -cp $(TESTPATH)/* $(TEST_EXTENSIONS_DIR)/roboextender@mozilla.org/base This whole block is suboptimal. You should use INSTALL_TARGETS for copying files. See toolkit/components/telemetry/Makefile.in.
Attachment #811624 - Flags: review?(gps) → review-
Reopening to track fixing the build config badness.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to Wesley Johnston (:wesj) from comment #14) > Comment on attachment 811624 [details] [diff] [review] > Patch v2 > > No idea who to ask for this stuff. I blame our tools. Read my blog post about Phabricator and try out the demo site I hosted. You can configure Phabricator to have it automatically request review from people when certain files change. It's awesome. I'm using it to audit changes to Makefile.in that didn't go through build peer review. http://gregoryszorc.com/blog/2013/10/14/phabricator-is-awesome/
Not going to be able to work on this. nalexander might want to glance at it though :( Sorry for the mess
Assignee: wjohnston → nobody
Flags: needinfo?(wjohnston) → needinfo?(nalexander)
i.e. I know you've seen this code nick. Just making sure you know this bug exists.
I think this is RESO FIXED by Robocop's JavascriptTest and Bug 983811.
Status: REOPENED → RESOLVED
Closed: 11 years ago9 years ago
Flags: needinfo?(nalexander)
Resolution: --- → FIXED
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: