TurbolinksView extends FrameLayout { boolean attachWebView(WebView webView, boolean screenshotsEnabled, boolean pullToRefreshEnabled) { if (webView.getParent() == refreshLayout) return false; refreshLayout.setEnabled(pullToRefreshEnabled); if (webView.getParent() instanceof TurbolinksSwipeRefreshLayout) { TurbolinksSwipeRefreshLayout previousRefreshLayout = (TurbolinksSwipeRefreshLayout) webView.getParent(); TurbolinksView previousTurbolinksView = (TurbolinksView) previousRefreshLayout.getParent(); if (screenshotsEnabled) previousTurbolinksView.screenshotView(); try { previousRefreshLayout.removeView(webView); } catch (Exception e) { previousRefreshLayout.removeView(webView); } } if (getBackground() instanceof ColorDrawable) { webView.setBackgroundColor(((ColorDrawable) getBackground()).getColor()); } refreshLayout.addView(webView); return true; } TurbolinksView(Context context);  TurbolinksView(Context context, AttributeSet attrs);  TurbolinksView(Context context, AttributeSet attrs, int defStyleAttr); @TargetApi(Build.VERSION_CODES.LOLLIPOP)  TurbolinksView(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes);   }
@Test public void attachWebView() { TurbolinksView view = new TurbolinksView(context); view.attachWebView(webView, false, false); assertThat(view.getRefreshLayout().getChildAt(1)).isEqualTo(webView); }