@MediumTest
  public void testWebView() throws Exception {
    final RemoteViewsActivity activity = getActivity();

    RemoteViews orig =
        new RemoteViews("com.android.frameworktest", R.layout.remote_view_test_bad_2);
    Parcel p = Parcel.obtain();
    orig.writeToParcel(p, 0);
    p.setDataPosition(0);

    RemoteViews r = RemoteViews.CREATOR.createFromParcel(p);

    ViewGroup parent = (ViewGroup) activity.findViewById(R.id.parent);

    boolean exceptionThrown = false;
    View result = null;

    try {
      result = r.apply(activity, parent);
    } catch (InflateException e) {
      exceptionThrown = true;
    }

    p.recycle();

    assertTrue("WebView allowed to be inflated", exceptionThrown);
    assertNull("WebView allowed to be inflated", result);
  }
  @MediumTest
  public void testGood() throws Exception {
    final RemoteViewsActivity activity = getActivity();

    RemoteViews orig = new RemoteViews("com.android.frameworktest", R.layout.remote_view_test_good);
    Parcel p = Parcel.obtain();
    orig.writeToParcel(p, 0);
    p.setDataPosition(0);

    RemoteViews r = RemoteViews.CREATOR.createFromParcel(p);

    ViewGroup parent = (ViewGroup) activity.findViewById(R.id.parent);

    View result = r.apply(activity, parent);

    p.recycle();

    assertTrue("LinearLayout not inflated", result.findViewById(R.id.linear) != null);
    assertTrue("TextView not inflated", result.findViewById(R.id.text) != null);
    assertTrue("ImageView not inflated", result.findViewById(R.id.image) != null);
    assertTrue("FrameLayout not inflated", result.findViewById(R.id.frame) != null);
    assertTrue("RelateiveLayout not inflated", result.findViewById(R.id.relative) != null);
    assertTrue("AbsoluteLayout not inflated", result.findViewById(R.id.absolute) != null);
    assertTrue("ProgressBar not inflated", result.findViewById(R.id.progress) != null);
    assertTrue("ImageButton not inflated", result.findViewById(R.id.image_button) != null);
    assertTrue("Button not inflated", result.findViewById(R.id.button) != null);
  }