Commit 38de4436 authored by bsheedy's avatar bsheedy Committed by Commit Bot

Add VR regression test for 743119

Adds a test to catch regressions of crbug.com/743119, which caused
Chrome to crash when a a history item was selected while in VR.

Bug: 743119
Change-Id: Ib447a919269d64a702bb2a6e2a6e9434dad1a28e
Reviewed-on: https://chromium-review.googlesource.com/686047Reviewed-by: default avatarTheresa <twellington@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Brian Sheedy <bsheedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504720}
parent 0f51551e
......@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.history;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.drawable.BitmapDrawable;
import android.support.annotation.VisibleForTesting;
import android.support.graphics.drawable.VectorDrawableCompat;
import android.support.v4.graphics.drawable.RoundedBitmapDrawable;
import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory;
......@@ -147,7 +148,8 @@ public class HistoryItemView extends SelectableItemView<HistoryItem> implements
}
@Override
protected void onClick() {
@VisibleForTesting(otherwise = VisibleForTesting.PROTECTED)
public void onClick() {
if (getItem() != null) getItem().open();
}
......
......@@ -123,7 +123,7 @@ public class VrShellNavigationTest {
/**
* Tests navigation from a 2D to a 2D page. Also tests that this navigation is
* properly added to Chrome's history.
* properly added to Chrome's history and is usable.
*/
@Test
@MediumTest
......@@ -136,7 +136,6 @@ public class VrShellNavigationTest {
PresentationMode.NON_PRESENTING, FullscreenMode.NON_FULLSCREENED);
// Test that the navigations were added to history
VrTransitionUtils.forceExitVr();
mVrTestRule.loadUrl("chrome://history", PAGE_LOAD_TIMEOUT_S);
HistoryPage historyPage =
(HistoryPage) mVrTestRule.getActivity().getActivityTab().getNativePage();
......@@ -150,6 +149,13 @@ public class VrShellNavigationTest {
itemViews.get(1).getItem().getUrl());
Assert.assertEquals("Second navigation is correct", getUrl(Page.PAGE_2D),
itemViews.get(0).getItem().getUrl());
// Test that clicking on history items in VR works
itemViews.get(0).onClick();
ChromeTabUtils.waitForTabPageLoaded(
mVrTestRule.getActivity().getActivityTab(), getUrl(Page.PAGE_2D));
assertState(mVrTestFramework.getFirstTabWebContents(), Page.PAGE_2D,
PresentationMode.NON_PRESENTING, FullscreenMode.NON_FULLSCREENED);
}
/**
......
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