Closed Bug 1105795 Opened 10 years ago Closed 10 years ago

testAboutHomeVisibility | java.lang.ClassCastException: org.mozilla.gecko.widget.ThemedImageView cannot be cast to android.widget.ImageButton

Categories

(Firefox for Android Graveyard :: Testing, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 37

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

Attachments

(1 file)

Robocop testAboutHomeVisibility consistently throws an exception. Because Robocop exception handling is missing in some tests (bug 1105522), the exception is not reported and the test ends suddenly, but otherwise appears to pass.

When exception handling is restored, the failure becomes evident.

https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=22a4eb2e6cc9

http://ftp.mozilla.org/pub/mozilla.org/mobile/try-builds/gbrown@mozilla.com-22a4eb2e6cc9/try-android/try_panda_android_test-robocop-6-bm100-tests1-panda-build84.txt.gz

16:24:43     INFO -  EventExpecter: no longer listening for DOMContentLoaded
16:24:43     INFO -  EventExpecter: no longer listening for DOMTitleChanged
16:24:43     INFO -  ToolbarTitleTextChangeVerifier: state changed to title, "mochi.test:8888/tests/robocop/robocop_blank_02.html".
16:24:43     INFO -  ToolbarTitleTextChangeVerifier: was satisfied.
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | Waiting for Toolbar to exit editing mode. -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The title argument is not null - Browser Blank Page 02 should not equal null
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The url argument is not null - /robocop/robocop_blank_02.html should not equal null
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | url is not null - /robocop/robocop_blank_02.html should not equal null
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The toolbar is not in the editing state -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The Toolbar title is mochi.test:8888/tests/robocop/robocop_blank_02.html - mochi.test:8888/tests/robocop/robocop_blank_02.html should equal mochi.test:8888/tests/robocop/robocop_blank_02.html
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The HomePager is not visible -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The toolbar is not in the editing state -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | Waiting for Toolbar to enter editing mode. -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | Waiting for UrlEditText to be input method target. -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The HomePager is visible -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The HomePager is visible -
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The current HomePager panel is top_sites - 0 should equal 0
16:24:43     INFO -  TEST-PASS | testAboutHomeVisibility | The toolbar is in the editing state -
16:24:43     INFO -  0 ERROR Exception caught during test! - java.lang.ClassCastException: org.mozilla.gecko.widget.ThemedImageView cannot be cast to android.widget.ImageButton
16:24:43  WARNING -  TEST-UNEXPECTED-FAIL | testAboutHomeVisibility | Exception caught - java.lang.ClassCastException: org.mozilla.gecko.widget.ThemedImageView cannot be cast to android.widget.ImageButton
16:24:43     INFO -  TEST-OK | testAboutHomeVisibility | took 15373ms
16:24:43     INFO -  TEST-START | Shutdown
16:24:43     INFO -  Passed: 55
16:24:43     INFO -  Failed: 1
16:24:43     INFO -  Todo: 0
Depends on: 1093137
With the fix for bug 1093137, we can see the stack trace:

java.lang.ClassCastException: org.mozilla.gecko.widget.ThemedImageView cannot be cast to android.widget.ImageButton
	at org.mozilla.gecko.tests.components.ToolbarComponent.getEditCancelButton(ToolbarComponent.java:116)
	at org.mozilla.gecko.tests.components.ToolbarComponent.dismissEditingMode(ToolbarComponent.java:178)
	at org.mozilla.gecko.tests.testAboutHomeVisibility.testAboutHomeVisibility(testAboutHomeVisibility.java:38)
	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:186)
	at org.mozilla.gecko.tests.UITest.runTest(UITest.java:102)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:537)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
Attached patch avoid castSplinter Review
Attachment #8529917 - Flags: review?(michael.l.comella)
Blocks: 1105887
Comment on attachment 8529917 [details] [diff] [review]
avoid cast

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

::: mobile/android/base/tests/components/ToolbarComponent.java
@@ +111,5 @@
>      }
>      /**
>       * Returns the View for the edit cancel button in the browser toolbar.
>       */
> +    private View getEditCancelButton() {

I wonder if this return type should be as specific as possible - i.e. ThemedImageView.

However, we can cross that bridge when we get there.
Attachment #8529917 - Flags: review?(michael.l.comella) → review+
https://hg.mozilla.org/mozilla-central/rev/5c191da183d6
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 37
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: