Use XHR by default to load TileJSON in ol.source.TileJSON

This commit is contained in:
Petr Sloup
2016-01-06 11:01:02 +01:00
parent 4ba443e829
commit bc0d783f50
14 changed files with 48 additions and 45 deletions

View File

@@ -21,23 +21,9 @@ describe('ol.source.TileJSON', function() {
var source, tileGrid;
beforeEach(function(done) {
var googNetJsonp = goog.net.Jsonp;
// mock goog.net.Jsonp (used in the ol.source.TileJSON constructor)
goog.net.Jsonp = function() {
this.send = function() {
var callback = arguments[1];
var client = new XMLHttpRequest();
client.open('GET', 'spec/ol/data/tilejson.json', true);
client.onload = function() {
callback(JSON.parse(client.responseText));
};
client.send();
};
};
source = new ol.source.TileJSON({
url: 'http://api.tiles.mapbox.com/v3/mapbox.geography-class.jsonp'
url: 'spec/ol/data/tilejson.json'
});
goog.net.Jsonp = googNetJsonp;
var key = source.on('change', function() {
if (source.getState() === 'ready') {
ol.Observable.unByKey(key);
@@ -88,7 +74,6 @@ describe('ol.source.TileJSON', function() {
});
goog.require('goog.events');
goog.require('goog.net.Jsonp');
goog.require('ol.source.State');
goog.require('ol.source.TileJSON');
goog.require('ol.Observable');