Introduce simple activity to test UI components without needing native or loading tabs |
||||||||||||||
Issue descriptionCurrently there is no way to test UI components with Activity dependencies without spinning up an existing Activity within Chrome. Each of these activities has tons of baggage, is slow, and causes our tests to be unnecessarily flaky and long running. We should find a way to introduce a new Activity just for testing that is fast to run and where we can attach views and test the Android dependencies w/o all the rest of Chrome running.
,
May 31 2017
,
May 31 2017
,
Jun 15 2017
+jbudorick
,
Jun 30 2017
Sending to Ted for triage.
,
Sep 21 2017
,
Sep 21 2017
I messed around with this some earlier this week -- convincing the OS to load an Activity defined in the test package from within the app package is going to be tricky. Solutions here will probably involve either: - a separate suite - merging the test APK and the app APK
,
Sep 22 2017
I think this might be easier with JUnit 4 tests? At least it should be possible to use an ActivityTestRule that launches a custom SimpleUiActivity.
,
Sep 8
Bulk edit: Moving back into the untriaged pool, as I'm leaving the project.
,
Oct 18
,
Oct 18
,
Oct 18
,
Oct 19
Sorry I might miss something but why add this SimpleUiActivity in test package, as org.chromium.chrome.tests? Would that be easier if we add it in app package or some isolated application if don't want to affect current chrome app, and launch with ActivityTestRule?
,
Dec 11
,
Dec 11
,
Dec 11
@yliuyliu, I'm definitely OK with this being in a different package/application. We just didn't want this to be part of the shipping Chrome app. With it being in the same test package, the thinking was that it would create one fewer things to test/be tested on the bots. It would be part of existing workflows and thus be easier to adopt. If we found that isn't feasible, I think we could look at moving it elsewhere, but I think the ideal case is that it would work within the existing test packages/APKs.
,
Dec 12
,
Dec 12
,
Dec 12
Seems this became much easier to implement after test APK and app APK merged into just one apk, ChromePublicTest.apk, with all chrome app libraries and no package difference. We can simply add one basic activity in javatests/AndroidManifest.xml to skip native and skip Chrome browser initialization to just attach UI components for testing.
,
Jan 9
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0 commit b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0 Author: Yun Liu <yliuyliu@google.com> Date: Wed Jan 09 23:06:26 2019 Add DummyUiActivity for testing UI components without accessing native Bug: 728297 Change-Id: Iaa573cb32e624544dcf5a1fdbdc9215505596574 Reviewed-on: https://chromium-review.googlesource.com/c/1356593 Commit-Queue: Yun Liu <yliuyliu@google.com> Reviewed-by: David Trainor <dtrainor@chromium.org> Cr-Commit-Position: refs/heads/master@{#621357} [modify] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/java/src/org/chromium/chrome/browser/download/home/DownloadManagerCoordinatorImpl.java [modify] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/java/src/org/chromium/chrome/browser/download/home/list/UiUtils.java [modify] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/java/src/org/chromium/chrome/browser/download/home/toolbar/ToolbarCoordinator.java [modify] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/java/src/org/chromium/chrome/browser/download/home/toolbar/ToolbarUtils.java [modify] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/java/src/org/chromium/chrome/browser/download/ui/DownloadManagerUi.java [modify] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/java_sources.gni [modify] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/javatests/AndroidManifest.xml [add] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java [add] https://crrev.com/b70ea5992740bfa0ddb87c244b47f31d9b8d1dc0/chrome/android/javatests/src/org/chromium/chrome/test/ui/DummyUiActivity.java
,
Jan 17
(6 days ago)
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/84ad844a557d24efd260cfd5afb177799a40cabc commit 84ad844a557d24efd260cfd5afb177799a40cabc Author: Yun Liu <yliuyliu@google.com> Date: Thu Jan 17 20:50:27 2019 Move DisableAnimationsTestRule to test/ui and add base DummyUiActivityTestCase for DummyUiActivity Bug: 728297 Change-Id: I5945bb2abaef870e10f60f82b0ff41dab116cd00 Reviewed-on: https://chromium-review.googlesource.com/c/1415771 Commit-Queue: Yun Liu <yliuyliu@google.com> Reviewed-by: David Trainor <dtrainor@chromium.org> Cr-Commit-Position: refs/heads/master@{#623833} [modify] https://crrev.com/84ad844a557d24efd260cfd5afb177799a40cabc/chrome/android/java_sources.gni [modify] https://crrev.com/84ad844a557d24efd260cfd5afb177799a40cabc/chrome/android/javatests/src/org/chromium/chrome/browser/download/DownloadActivityTest.java [modify] https://crrev.com/84ad844a557d24efd260cfd5afb177799a40cabc/chrome/android/javatests/src/org/chromium/chrome/browser/download/home/DownloadActivityV2Test.java [rename] https://crrev.com/84ad844a557d24efd260cfd5afb177799a40cabc/chrome/android/javatests/src/org/chromium/chrome/test/ui/DisableAnimationsTestRule.java [add] https://crrev.com/84ad844a557d24efd260cfd5afb177799a40cabc/chrome/android/javatests/src/org/chromium/chrome/test/ui/DummyUiActivityTestCase.java |
||||||||||||||
►
Sign in to add a comment |
||||||||||||||
Comment 1 by tedc...@chromium.org
, May 31 2017Status: Available (was: Untriaged)
My initial attempt was to add a new <activity> in chrome/android/javatests/AndroidManifest.xml. <activity android:name="org.chromium.chrome.test.ui.SimpleUiActivity" android:exported="true"/> I first had issues with writing an ActivityTestRule that would actually trigger the new activity. Despite setting the class name in getActivityIntent, it would be overwritten in launchActivity. I could start it manually from the command line via: adb shell am start -n org.chromium.chrome.tests/org.chromium.chrome.test.ui.SimpleUiActivity I had to add a hack to stash the intent and overwrite the class name again in beforeActivityLaunched. At that point, it complained about the activity being in a different process, so I needed hardcode the process: <activity android:name="org.chromium.chrome.test.ui.SimpleUiActivity" android:process="{{manifest_package}}" android:exported="true"/> Now the activity was being launched, but it was crashing because it never returned to idle within 45 seconds. At that point, I gave up. We might need to add a new <instrumentation> attribute pointing to the test package or something to allow such a crazy thing.