summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvadimt <vadimt@google.com>2019-09-27 18:44:04 -0700
committerVadim Tryshev <vadimt@google.com>2019-10-01 19:18:14 +0000
commit7371e4da6846e532592ac14f3a9ab12576a29a1c (patch)
tree3bcdde0ab587c8df826368ee5424e515f9b34237
parent7cb5b73dfb86c56ea7e20a60f819e88549710717 (diff)
downloadpackages_apps_Trebuchet-7371e4da6846e532592ac14f3a9ab12576a29a1c.tar.gz
packages_apps_Trebuchet-7371e4da6846e532592ac14f3a9ab12576a29a1c.tar.bz2
packages_apps_Trebuchet-7371e4da6846e532592ac14f3a9ab12576a29a1c.zip
Waiting for Launcher model load in out-of-proc tests.
Not doing this seems to have caused flakes. Bug: 141770616 Change-Id: Ia9caf20e4a2d93298adf4249ca815ad79bced802 Merged-in: Ia9caf20e4a2d93298adf4249ca815ad79bced802
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java11
-rw-r--r--src/com/android/launcher3/testing/TestInformationHandler.java8
-rw-r--r--tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java3
-rw-r--r--tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java1
4 files changed, 12 insertions, 11 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
index da4642636..2864c4640 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -36,12 +36,6 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
return response;
}
- case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: {
- response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD,
- TouchInteractionService.isInitialized());
- return response;
- }
-
case TestProtocol.REQUEST_HOTSEAT_TOP: {
if (mLauncher == null) return null;
@@ -80,4 +74,9 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
return super.call(method);
}
+
+ @Override
+ protected boolean isLauncherInitialized() {
+ return super.isLauncherInitialized() && TouchInteractionService.isInitialized();
+ }
}
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index 790a2e844..9965572bd 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -27,6 +27,7 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.InvariantDeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherState;
import com.android.launcher3.MainThreadExecutor;
import com.android.launcher3.R;
@@ -82,7 +83,7 @@ public class TestInformationHandler implements ResourceBasedOverride {
}
case TestProtocol.REQUEST_IS_LAUNCHER_INITIALIZED: {
- response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, true);
+ response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, isLauncherInitialized());
break;
}
@@ -152,4 +153,9 @@ public class TestInformationHandler implements ResourceBasedOverride {
}
return response;
}
+
+ protected boolean isLauncherInitialized() {
+ final LauncherModel model = LauncherAppState.getInstance(mContext).getModel();
+ return model.getCallback() == null || model.isModelLoaded();
+ }
} \ No newline at end of file
diff --git a/tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java b/tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java
index a76b4a488..ff21880d0 100644
--- a/tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java
+++ b/tests/src/com/android/launcher3/ui/DefaultLayoutProviderTest.java
@@ -73,7 +73,6 @@ public class DefaultLayoutProviderTest extends AbstractLauncherUiTest {
// Launch the home activity
mDevice.pressHome();
- waitForModelLoaded();
mLauncher.getWorkspace().getHotseatAppIcon(getSettingsApp().getLabel().toString());
}
@@ -89,7 +88,6 @@ public class DefaultLayoutProviderTest extends AbstractLauncherUiTest {
// Launch the home activity
mDevice.pressHome();
- waitForModelLoaded();
// Verify widget present
assertTrue("Widget is not present",
@@ -106,7 +104,6 @@ public class DefaultLayoutProviderTest extends AbstractLauncherUiTest {
// Launch the home activity
mDevice.pressHome();
- waitForModelLoaded();
mLauncher.getWorkspace().getHotseatFolder("Folder: Copy");
}
diff --git a/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java
index e6348d9c0..f42bf1f3c 100644
--- a/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/BindWidgetTest.java
@@ -271,7 +271,6 @@ public class BindWidgetTest extends AbstractLauncherUiTest {
// Launch the home activity
mDevice.pressHome();
- waitForModelLoaded();
}
private void verifyWidgetPresent(LauncherAppWidgetProviderInfo info) {