Commit 78f31cea authored by Becky Zhou's avatar Becky Zhou Committed by Commit Bot

Speculative fix for FeedNewTabPageTest#testFeedDisabledByPolicy

Bug: 888996, 901414
Change-Id: I3482ea6f7f9083ac11fce0ff0f8f18e690d65607
Reviewed-on: https://chromium-review.googlesource.com/c/1296828
Commit-Queue: Becky Zhou <huayinz@chromium.org>
Reviewed-by: default avatarSky Malice <skym@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609453}
parent f3832e54
......@@ -62,7 +62,9 @@ public class FeedSchedulerBridge implements FeedScheduler {
@Override
public int shouldSessionRequestData(SessionManagerState sessionManagerState) {
assert mNativeBridge != 0;
// Bridge could have been destroyed for policy when this is called.
// See https://crbug.com/901414.
if (mNativeBridge == 0) return SchedulerApi.RequestBehavior.UNKNOWN;
@NativeRequestBehavior
int nativeBehavior = nativeShouldSessionRequestData(mNativeBridge,
......
......@@ -33,7 +33,6 @@ import org.junit.runner.RunWith;
import org.chromium.base.ThreadUtils;
import org.chromium.base.test.util.CommandLineFlags;
import org.chromium.base.test.util.DisabledTest;
import org.chromium.base.test.util.Feature;
import org.chromium.base.test.util.UrlUtils;
import org.chromium.chrome.R;
......@@ -250,7 +249,6 @@ public class FeedNewTabPageTest {
@Test
@MediumTest
@DisabledTest(message = "https://crbug.com/888996")
@Feature({"FeedNewTabPage"})
public void testFeedDisabledByPolicy() throws Exception {
final boolean pref = ThreadUtils.runOnUiThreadBlocking(
......@@ -269,7 +267,6 @@ public class FeedNewTabPageTest {
// policy as child.
ThreadUtils.runOnUiThreadBlocking(() -> PrefServiceBridge.getInstance().setBoolean(
Pref.NTP_ARTICLES_SECTION_ENABLED, false));
ViewUtils.waitForStableView(rootView);
Assert.assertNotNull(mNtp.getScrollViewForPolicy());
Assert.assertNull(mNtp.getStream());
Assert.assertEquals(1, rootView.getChildCount());
......@@ -281,7 +278,6 @@ public class FeedNewTabPageTest {
ViewGroup rootView2 = (ViewGroup) ntp2.getView();
// Verify that NTP root view contains only the view for policy as child.
ViewUtils.waitForStableView(rootView2);
Assert.assertNotNull(ntp2.getScrollViewForPolicy());
Assert.assertNull(ntp2.getStream());
Assert.assertEquals(1, rootView2.getChildCount());
......@@ -291,7 +287,6 @@ public class FeedNewTabPageTest {
// don't re-enable the Feed until the next restart.
ThreadUtils.runOnUiThreadBlocking(() -> PrefServiceBridge.getInstance().setBoolean(
Pref.NTP_ARTICLES_SECTION_ENABLED, true));
ViewUtils.waitForStableView(rootView2);
Assert.assertNotNull(ntp2.getScrollViewForPolicy());
Assert.assertNull(ntp2.getStream());
Assert.assertEquals(1, rootView2.getChildCount());
......@@ -299,7 +294,6 @@ public class FeedNewTabPageTest {
// Switch to the old tab. Verify the NTP root view is the view for policy.
ChromeTabUtils.switchTabInCurrentTabModel(mActivityTestRule.getActivity(), mTab.getId());
ViewUtils.waitForStableView(rootView);
Assert.assertNotNull(mNtp.getScrollViewForPolicy());
Assert.assertNull(mNtp.getStream());
Assert.assertEquals(1, rootView.getChildCount());
......
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