Closed Bug 899655 Opened 6 years ago Closed 6 years ago

Robocop testShareLink fails on x86 emulator / RAZR / Jellybean

Categories

(Firefox for Android :: General, defect)

x86
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 25

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

Attachments

(1 file, 1 obsolete file)

Robocop's testShareLink fails when run on the x86 emulator setup (see bug 891959). It also fails locally when run on a Motorola Razr i (XT890).

This may be a fails-on-Jellybean rather than a fails-on-x86 problem, but it is the effort to get tests running on x86 that is bringing about this bug.

0 INFO SimpleTest START
1 INFO TEST-START | testShareLink
EventExpecter: no longer listening for Gecko:Ready
2 INFO TEST-PASS | testShareLink | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_big_link.html should equal http://mochi.test:8888/tests/robocop/robocop_big_link.html
EventExpecter: no longer listening for DOMContentLoaded
3 INFO TEST-PASS | testShareLink | Got the displayed share options? - Got the share options list
4 INFO TEST-PASS | testShareLink | Share option found - Bluetooth
5 INFO TEST-PASS | testShareLink | Share option found - Messages
6 INFO TEST-PASS | testShareLink | Share option found - Google+
7 INFO TEST-PASS | testShareLink | Share option found - Google
8 INFO TEST-PASS | testShareLink | Share option found - Email
9 INFO TEST-PASS | testShareLink | Share option found - Gmail
10 INFO TEST-PASS | testShareLink | Share option found - Firefox Sync
11 INFO TEST-PASS | testShareLink | Share option found - Firefox Sync
12 INFO TEST-PASS | testShareLink | Share option found - Firefox Sync
waitForTest timeout after 3000 ms
13 INFO TEST-UNEXPECTED-FAIL | testShareLink | Got the displayed share options? - Got the share options list
Exception caught during test!
junit.framework.AssertionFailedError: 13 INFO TEST-UNEXPECTED-FAIL | testShareLink | Got the displayed share options? - Got the share options list
	at junit.framework.Assert.fail(Assert.java:50)
	at org.mozilla.fennec_mozdev.FennecMochitestAssert._logMochitestResult(FennecMochitestAssert.java:107)
	at org.mozilla.fennec_mozdev.FennecMochitestAssert.ok(FennecMochitestAssert.java:136)
	at org.mozilla.fennec_mozdev.tests.testShareLink.getDisplayedShareList(testShareLink.java:207)
	at org.mozilla.fennec_mozdev.tests.testShareLink.getSharePopupOption(testShareLink.java:137)
	at org.mozilla.fennec_mozdev.tests.testShareLink.verifySharePopup(testShareLink.java:104)
	at org.mozilla.fennec_mozdev.tests.testShareLink.testShareLink(testShareLink.java:57)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
	at org.mozilla.fennec_mozdev.tests.BaseTest.runTest(BaseTest.java:133)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:115)
	at junit.framework.TestResult.runProtected(TestResult.java:133)
	at junit.framework.TestResult.run(TestResult.java:118)
	at junit.framework.TestCase.run(TestCase.java:124)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
14 INFO TEST-UNEXPECTED-FAIL | testShareLink | Exception caught - junit.framework.AssertionFailedError: 13 INFO TEST-UNEXPECTED-FAIL | testShareLink | Got the displayed share options? - Got the share options list
15 INFO TEST-END | testShareLink | finished in 21184ms
16 INFO TEST-START | Shutdown
17 INFO Passed: 11
18 INFO Failed: 2
19 INFO Todo: 0
20 INFO SimpleTest FINISHED
The correct content is visible on the screen in a "Share via" view when the test fails. Robocop can retrieve and enumerate the views, but fails because it is looking for a ListView. On JellyBean+, the items are not displayed in a list, but in a grid, as shown here: http://stackoverflow.com/questions/17517932/intent-createchooser-display-style.
mSolo.getCurrentViews returns something like:

== android.widget.FrameLayout@2172efb0
== android.widget.FrameLayout@2172f570
== android.widget.LinearLayout@2172fa18
== android.widget.LinearLayout@2172fbb8
== android.view.View@2172fd78
== android.widget.LinearLayout@2172fed0
== android.widget.ImageView@21730098
== com.android.internal.widget.DialogTitle@21730218
TEXT ==>> Share via
== android.view.View@21730858
== android.widget.LinearLayout@217309a0
== android.widget.ScrollView@21730b68
== android.widget.FrameLayout@21731368
== android.widget.FrameLayout@21731540
== android.widget.LinearLayout@2172c348
== android.widget.FrameLayout@2172c900
== android.widget.GridView@2172cba0
== android.widget.LinearLayout@217347e0
== android.widget.TextView@21735ca0
TEXT ==>> 
== android.widget.ImageView@21735ed0
== android.widget.TextView@21736008
TEXT ==>> Bluetooth
== android.widget.LinearLayout@21736c80
== android.widget.TextView@21737390
TEXT ==>> 
== android.widget.ImageView@21737598
== android.widget.TextView@217376d0
TEXT ==>> Email
== android.widget.LinearLayout@21737cc0
== android.widget.TextView@217383d0
TEXT ==>> Nightly
== android.widget.ImageView@217385d8
== android.widget.TextView@21738710
TEXT ==>> Firefox Sync
== android.widget.LinearLayout@21738d38
== android.widget.TextView@21739448
TEXT ==>> Firefox Beta
== android.widget.ImageView@21739650
== android.widget.TextView@21739788
TEXT ==>> Firefox Sync
== android.widget.LinearLayout@21739ed0
== android.widget.TextView@2173a5e0
TEXT ==>> Fennec mozdev
== android.widget.ImageView@2173a7e8
== android.widget.TextView@2173a920
TEXT ==>> Firefox Sync
== android.widget.LinearLayout@2173afe0
== android.widget.TextView@2173b6f0
TEXT ==>> 
== android.widget.ImageView@2173b8f8
== android.widget.TextView@2173ba30
TEXT ==>> Gmail
== android.widget.LinearLayout@2172d6f8
== android.widget.Button@2172d8e0
TEXT ==>> Always
== android.widget.Button@2172e478
TEXT ==>> Just once
== android.widget.LinearLayout@21731718
== android.widget.LinearLayout@217318e0
== android.widget.Button@21731ac8
TEXT ==>> 
== android.widget.Button@21732190
TEXT ==>> 
== android.widget.Button@21732858
TEXT ==>> 
== android.view.ViewStub@2172f770
== com.android.internal.policy.impl.PhoneWindow$DecorView@2172ec60
Attached patch allow for GridView or ListView (obsolete) — Splinter Review
On Jellybean, the share options are typically displayed in a GridView rather than the ListView used in earlier versions of Android. This patch selects the first GridView or ListView encountered, then traverses its children, extracting the strings from TextView children.

https://tbpl.mozilla.org/?tree=Try&rev=3b6f109a09cd
Attachment #783362 - Flags: review?(jmaher)
Summary: Robocop testShareLink fails on x86 emulator / RAZR → Robocop testShareLink fails on x86 emulator / RAZR / Jellybean
Comment on attachment 783362 [details] [diff] [review]
allow for GridView or ListView

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

just some nits about dumpLog statements.

::: mobile/android/base/tests/testShareLink.java.in
@@ +144,5 @@
> +                getGroupTextViews((ViewGroup)child, list);
> +            } else if (child instanceof TextView) {
> +                String viewText = ((TextView)child).getText().toString();
> +                if (viewText != null && viewText.length() > 0) {
> +                    mAsserter.dumpLog("VG TEXT ==>> "+viewText);

why do you have a dumpLog here?

@@ +212,5 @@
>              @Override
>              public boolean test() {
> +                ArrayList<View> views = mSolo.getCurrentViews();
> +                for (View view : views) {
> +                    mAsserter.dumpLog("== "+view.toString());

this dumpLog isn't very informative.
Attachment #783362 - Flags: review?(jmaher) → review+
Glad you caught that -- I would have been cross if I had checked that in. dumpLog()s removed.

https://hg.mozilla.org/integration/mozilla-inbound/rev/373ae7605a75
Attachment #783362 - Attachment is obsolete: true
Attachment #783802 - Flags: review+
https://hg.mozilla.org/mozilla-central/rev/373ae7605a75
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Blocks: 936226
You need to log in before you can comment on or make changes to this bug.