Java 类org.robolectric.tester.org.apache.http.FakeHttpLayer 实例源码

项目:FullRobolectricTestSample    文件:DefaultRequestDirectorTest.java   
@Before
public void setUp_EnsureStaticStateIsReset() {
  FakeHttpLayer fakeHttpLayer = Robolectric.getFakeHttpLayer();
  assertFalse(fakeHttpLayer.hasPendingResponses());
  assertFalse(fakeHttpLayer.hasRequestInfos());
  assertFalse(fakeHttpLayer.hasResponseRules());
  assertNull(fakeHttpLayer.getDefaultResponse());

  connectionKeepAliveStrategy = new ConnectionKeepAliveStrategy() {
    @Override public long getKeepAliveDuration(HttpResponse httpResponse, HttpContext httpContext) {
      return 0;
    }
  };
  requestDirector = new DefaultRequestDirector(null, null, null, connectionKeepAliveStrategy, null, null, null, null, null, null, null, null);
}
项目:silent-text-android    文件:ClientTestFixture.java   
protected static void inject( RequestMatcher request, HttpResponse response ) {
    FakeHttpLayer http = Robolectric.getFakeHttpLayer();
    if( !http.isInterceptingHttpRequests() ) {
        http.interceptHttpRequests( true );
    }
    http.addHttpResponseRule( request, response );
}
项目:FullRobolectricTestSample    文件:ShadowApplication.java   
public FakeHttpLayer getFakeHttpLayer() {
  return fakeHttpLayer;
}
项目:FullRobolectricTestSample    文件:ShadowApplication.java   
public void setFakeHttpLayer(FakeHttpLayer fakeHttpLayer) {
  if (fakeHttpLayer == null) {
    throw new IllegalArgumentException();
  }
  this.fakeHttpLayer = fakeHttpLayer;
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static boolean httpRequestWasMade(String uri) {
  return getShadowApplication().getFakeHttpLayer().hasRequestMatchingRule(
      new FakeHttpLayer.UriRequestMatcher(uri));
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static FakeHttpLayer getFakeHttpLayer() {
  return getShadowApplication().getFakeHttpLayer();
}
项目:silent-text-android    文件:ClientTestFixture.java   
protected static void doItLive() {
    FakeHttpLayer http = Robolectric.getFakeHttpLayer();
    http.interceptHttpRequests( false );
    http.logHttpRequests();
}
项目:silent-text-android    文件:ClientTestFixture.java   
protected static RequestMatcher whenRequested( String method, String uriPattern ) {
    return new FakeHttpLayer.UriRegexMatcher( method, uriPattern );
}