More temporary logging to diagnose testPendingWidget_autoRestored

And waiting to loader to finish to improve determinism.

Bug: 117332845
Test: running Launcher
Change-Id: Icdfce969b61f8ceb952a2715037783458da4d4c4
This commit is contained in:
Vadim Tryshev 2018-10-05 20:03:57 -07:00
parent 51146bc7e6
commit a7da86e14a
3 changed files with 27 additions and 0 deletions

View File

@ -563,6 +563,11 @@ public class LauncherModel extends BroadcastReceiver
synchronized (mLock) { synchronized (mLock) {
// Everything loaded bind the data. // Everything loaded bind the data.
mModelLoaded = true; mModelLoaded = true;
if (com.android.launcher3.Utilities.IS_RUNNING_IN_TEST_HARNESS
&& com.android.launcher3.Utilities.IS_DEBUG_DEVICE) {
android.util.Log.d("b/117332845",
android.util.Log.getStackTraceString(new Throwable()));
}
} }
} }

View File

@ -298,6 +298,11 @@ public abstract class AbstractLauncherUiTest {
} }
protected void resetLoaderState() { protected void resetLoaderState() {
if (com.android.launcher3.Utilities.IS_RUNNING_IN_TEST_HARNESS
&& com.android.launcher3.Utilities.IS_DEBUG_DEVICE) {
android.util.Log.d("b/117332845",
"START " + android.util.Log.getStackTraceString(new Throwable()));
}
try { try {
mMainThreadExecutor.execute(new Runnable() { mMainThreadExecutor.execute(new Runnable() {
@Override @Override
@ -308,6 +313,13 @@ public abstract class AbstractLauncherUiTest {
} catch (Throwable t) { } catch (Throwable t) {
throw new IllegalArgumentException(t); throw new IllegalArgumentException(t);
} }
waitForLauncherCondition(launcher ->
LauncherAppState.getInstance(mTargetContext).getModel().isModelLoaded());
if (com.android.launcher3.Utilities.IS_RUNNING_IN_TEST_HARNESS
&& com.android.launcher3.Utilities.IS_DEBUG_DEVICE) {
android.util.Log.d("b/117332845",
"FINISH " + android.util.Log.getStackTraceString(new Throwable()));
}
} }
/** /**

View File

@ -84,6 +84,11 @@ public class BindWidgetTest extends AbstractLauncherUiTest {
@Override @Override
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
if (com.android.launcher3.Utilities.IS_RUNNING_IN_TEST_HARNESS
&& com.android.launcher3.Utilities.IS_DEBUG_DEVICE) {
android.util.Log.d("b/117332845",
android.util.Log.getStackTraceString(new Throwable()));
}
super.setUp(); super.setUp();
mResolver = mTargetContext.getContentResolver(); mResolver = mTargetContext.getContentResolver();
@ -105,6 +110,11 @@ public class BindWidgetTest extends AbstractLauncherUiTest {
} }
super.tearDown(); super.tearDown();
if (com.android.launcher3.Utilities.IS_RUNNING_IN_TEST_HARNESS
&& com.android.launcher3.Utilities.IS_DEBUG_DEVICE) {
android.util.Log.d("b/117332845",
android.util.Log.getStackTraceString(new Throwable()));
}
} }
@Test @Test