The MockFileSource will insert garbage on the reply and report as
a request done successfully. The network stack cannot detect this
kind of errors but the consumer should report it like we do for
network problems.
This first test will simulate a request failure on every resource
directly or indirectly loaded by the ResourceLoader. The idea is
to verify whenever we are failing gracefully or not.
- MockFileSource
Will load pre-defined resources from the filesystem. It supports
passing a string, that when it matches an URL, will simulate a failure.
- MockView
It is just a no-op to not get in the way when testing
resource loading.
Few more additions:
- style.json
Specially crafted style that will look always for the same tile,
glyph range, etc at the "test/fixtures/resources/" path. No matter
where you look (or at what zoom), you always get the same stuff.
- vector.pbf
This taken from a part of Taipei that will request several glyph
ranges.
The callback will be called when any of the resources requested
from the network failed to load.
There is not recovery implemented yet, so the closest thing to
reseting the Map object and reloading all the resources would
be setting a new style.
`-pauseMetricsCollection` and `-resumeMetricsCollection` were originally introduced to mitigate concerns around battery usage, but `MGLMapboxEvents` has since evolved to tread much lighter on the battery. There’s no longer any need for the client to call these methods directly. The iOS test project now includes MGLMapboxEvents.h explicitly to avoid having to package a header that will go unused.
The MapContext can only run on its own thread because it is
registering a EnvironmentScope and it is making many assertions
on Debug mode if its methods are being called on the Map thread.
The promise could be deallocated before promise.set_value() had returned,
which apparently caused an invalid read on some implementations.
By moving the promise declaration up the stack, we ensure that the map is
deallocated first, and therefore the map thread is joined, before the
promise is deallocated.
Both Android and iOS now use pause/resume. The map thread is
always running, and be able to receive messages. When paused,
it will just refuse to render.