Create Fake Cronet API: FakeCronetController.
FakeCronetController is used to create fake CronetEngines and control responses to UrlRequests that the fake CronetEngine makes. Primarily, the test should instantiate a FakeCronetController and from that instance generate CronetEngine.Builders which will use their FakeCronetController for responses once they are built. The FakeCronetController can also be used statically to retrieve a FakeCrontroller that is created by the production code, such as via FakeCronetProvider. To do this, it maintains a static list of all fake CronetEngines in order of creation. This list can be retrieved and the desired CronetEngine can be passed back to the FakeCronetController's static method getControllerForFakeEngine() in order for the test to get a pointer to the controller for it's production code's CronetEngine. It should be noted that a CronetEngine.Builder can build multiple fake CronetEngines which will all point to the same controller. This is also true for multiple calls of getFakeCronetEngineBuilder: the created CronetEngines will all use the same controller. Design Doc: https://docs.google.com/document/d/1IsBwiqR5f6ksvmHPq5skV802C02We8zjK-c552Tp4lE/edit#heading=h.7nki9mck5t64 Bug: 669707 Change-Id: I8955a97e4a4a6dd8040b5b30fea3c5cbeae30221 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1701534 Commit-Queue: Benjamin Kirchman <kirchman@google.com> Reviewed-by:Paul Jensen <pauljensen@chromium.org> Cr-Commit-Position: refs/heads/master@{#679983}
Showing
Please register or sign in to comment