Commit b439c06c authored by Andrei Chulkov's avatar Andrei Chulkov Committed by Commit Bot

Fix bug on Android O in password manager onboarding test

Fix bug on Android O in which the view was changed not on the UI thread.
Tested on API levels 26 and 27.

Bug: 999360
Change-Id: I4bd7a335013262337140e9595e24b9d114ea3e3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1778490
Commit-Queue: Andrei Chulkov <achulkov@google.com>
Reviewed-by: default avatarIoana Pandele <ioanap@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692171}
parent abd93b98
......@@ -119,24 +119,30 @@ public class PasswordManagerDialogTest {
mActivityTestRule.getActivity().getWindowAndroid().getDisplay().getDipScale();
// Dimensions resembling landscape orientation.
int testHeightDip = 300; // Height of the android content view.
int testWidthDip = 500; // Width of the android content view.
mMediator.onLayoutChange(null, 0, 0, (int) (testWidthDip * dipScale),
(int) (testHeightDip * dipScale), 0, 0, 0, 0);
final int testHeightDipLandscape = 300; // Height of the android content view.
final int testWidthDipLandscape = 500; // Width of the android content view.
TestThreadUtils.runOnUiThreadBlocking(() -> {
mMediator.onLayoutChange(null, 0, 0, (int) (testWidthDipLandscape * dipScale),
(int) (testHeightDipLandscape * dipScale), 0, 0, 0, 0);
});
assertThat(mModel.get(ILLUSTRATION_VISIBLE), is(false));
// Dimensions resembling portrait orientation.
testHeightDip = 500;
testWidthDip = 320;
mMediator.onLayoutChange(null, 0, 0, (int) (testWidthDip * dipScale),
(int) (testHeightDip * dipScale), 0, 0, 0, 0);
final int testHeightDipPortrait = 500;
final int testWidthDipPortrait = 320;
TestThreadUtils.runOnUiThreadBlocking(() -> {
mMediator.onLayoutChange(null, 0, 0, (int) (testWidthDipPortrait * dipScale),
(int) (testHeightDipPortrait * dipScale), 0, 0, 0, 0);
});
assertThat(mModel.get(ILLUSTRATION_VISIBLE), is(true));
// Dimensions resembling multi-window mode.
testHeightDip = 250;
testWidthDip = 320;
mMediator.onLayoutChange(null, 0, 0, (int) (testWidthDip * dipScale),
(int) (testHeightDip * dipScale), 0, 0, 0, 0);
final int testHeightDipMultiWindow = 250;
final int testWidthDipMultiWindow = 320;
TestThreadUtils.runOnUiThreadBlocking(() -> {
mMediator.onLayoutChange(null, 0, 0, (int) (testWidthDipMultiWindow * dipScale),
(int) (testHeightDipMultiWindow * dipScale), 0, 0, 0, 0);
});
assertThat(mModel.get(ILLUSTRATION_VISIBLE), is(false));
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment