Skip to content

Commit

Permalink
Merge pull request #6217 from AnalyticalGraphicsInc/fix-test-warnings
Browse files Browse the repository at this point in the history
Fix deprecation warnings for load functions
  • Loading branch information
Hannah authored Feb 14, 2018
2 parents 0e4afd3 + 35b4dae commit 2f6a5ad
Show file tree
Hide file tree
Showing 39 changed files with 574 additions and 654 deletions.
12 changes: 6 additions & 6 deletions Specs/Core/BingMapsGeocoderServiceSpec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defineSuite([
'Core/BingMapsGeocoderService',
'Core/loadJsonp',
'Core/Rectangle',
'Core/Resource',
'Specs/createScene'
], function(
BingMapsGeocoderService,
loadJsonp,
Rectangle,
Resource,
createScene) {
'use strict';

Expand All @@ -22,7 +22,7 @@ defineSuite([
});

afterAll(function() {
loadJsonp.loadAndExecuteScript = loadJsonp.defaultLoadAndExecuteScript;
Resource._Implementations.loadAndExecuteScript = Resource._DefaultImplementations.loadAndExecuteScript;
});

it('constructor throws without scene', function() {
Expand All @@ -41,7 +41,7 @@ defineSuite([
}]
}]
};
loadJsonp.loadAndExecuteScript = function(url, functionName, deferred) {
Resource._Implementations.loadAndExecuteScript = function(url, functionName, deferred) {
deferred.resolve(data);
};
service.geocode(query).then(function(results) {
Expand All @@ -57,7 +57,7 @@ defineSuite([
var data = {
resourceSets: []
};
loadJsonp.loadAndExecuteScript = function(url, functionName, deferred) {
Resource._Implementations.loadAndExecuteScript = function(url, functionName, deferred) {
deferred.resolve(data);
};
service.geocode(query).then(function(results) {
Expand All @@ -73,7 +73,7 @@ defineSuite([
resources: []
}]
};
loadJsonp.loadAndExecuteScript = function(url, functionName, deferred) {
Resource._Implementations.loadAndExecuteScript = function(url, functionName, deferred) {
deferred.resolve(data);
};
service.geocode(query).then(function(results) {
Expand Down
90 changes: 44 additions & 46 deletions Specs/Core/CesiumTerrainProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ defineSuite([
'Core/GeographicTilingScheme',
'Core/getAbsoluteUri',
'Core/HeightmapTerrainData',
'Core/loadWithXhr',
'Core/Math',
'Core/QuantizedMeshTerrainData',
'Core/Request',
Expand All @@ -21,7 +20,6 @@ defineSuite([
GeographicTilingScheme,
getAbsoluteUri,
HeightmapTerrainData,
loadWithXhr,
CesiumMath,
QuantizedMeshTerrainData,
Request,
Expand All @@ -37,14 +35,14 @@ defineSuite([
});

afterEach(function() {
loadWithXhr.load = loadWithXhr.defaultLoad;
Resource._Implementations.loadWithXhr = Resource._DefaultImplementations.loadWithXhr;
});

function returnTileJson(path) {
var oldLoad = loadWithXhr.load;
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var oldLoad = Resource._Implementations.loadWithXhr;
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
if (url.indexOf('layer.json') >= 0) {
loadWithXhr.defaultLoad(path, responseType, method, data, headers, deferred);
Resource._DefaultImplementations.loadWithXhr(path, responseType, method, data, headers, deferred);
} else {
return oldLoad(url, responseType, method, data, headers, deferred, overrideMimeType);
}
Expand Down Expand Up @@ -79,10 +77,10 @@ defineSuite([
var paths = ['Data/CesiumTerrainTileJson/ParentUrl.tile.json',
'Data/CesiumTerrainTileJson/Parent.tile.json'];
var i = 0;
var oldLoad = loadWithXhr.load;
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
var oldLoad = Resource._Implementations.loadWithXhr;
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
if (url.indexOf('layer.json') >= 0) {
loadWithXhr.defaultLoad(paths[i++], responseType, method, data, headers, deferred);
Resource._DefaultImplementations.loadWithXhr(paths[i++], responseType, method, data, headers, deferred);
} else {
return oldLoad(url, responseType, method, data, headers, deferred, overrideMimeType);
}
Expand Down Expand Up @@ -473,15 +471,15 @@ defineSuite([
return pollToPromise(function() {
return provider.ready;
}).then(function() {
spyOn(loadWithXhr, 'load');
spyOn(Resource._Implementations, 'loadWithXhr');
provider.requestTileGeometry(0, 0, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo0.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo0.com');
provider.requestTileGeometry(1, 0, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo1.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo1.com');
provider.requestTileGeometry(1, -1, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo2.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo2.com');
provider.requestTileGeometry(1, 0, 1);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo3.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo3.com');
});
});

Expand All @@ -497,26 +495,26 @@ defineSuite([
return pollToPromise(function() {
return provider.ready;
}).then(function() {
spyOn(loadWithXhr, 'load');
spyOn(Resource._Implementations, 'loadWithXhr');
provider.requestTileGeometry(0, 0, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo0.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo0.com');
provider.requestTileGeometry(1, 0, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo1.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo1.com');
provider.requestTileGeometry(1, -1, 0);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo2.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo2.com');
provider.requestTileGeometry(1, 0, 1);
expect(loadWithXhr.load.calls.mostRecent().args[0]).toContain('foo3.com');
expect(Resource._Implementations.loadWithXhr.calls.mostRecent().args[0]).toContain('foo3.com');
});
});

it('uses the proxy if one is supplied', function() {
var baseUrl = 'made/up/url';

loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
expect(url.indexOf('/proxy/?')).toBe(0);

// Just return any old file, as long as its big enough
loadWithXhr.defaultLoad('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred);
Resource._DefaultImplementations.loadWithXhr('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred);
};

returnHeightmapTileJson();
Expand All @@ -534,9 +532,9 @@ defineSuite([
});

it('provides HeightmapTerrainData', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
// Just return any old file, as long as its big enough
loadWithXhr.defaultLoad('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred);
Resource._DefaultImplementations.loadWithXhr('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred);
};

returnHeightmapTileJson();
Expand All @@ -547,8 +545,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.terrain', responseType, method, data, headers, deferred);
};

returnQuantizedMeshTileJson();
Expand All @@ -559,8 +557,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with 32bit indices', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.32bitIndices.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.32bitIndices.terrain', responseType, method, data, headers, deferred);
};

returnQuantizedMeshTileJson();
Expand All @@ -572,8 +570,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with VertexNormals', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.vertexnormals.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.vertexnormals.terrain', responseType, method, data, headers, deferred);
};

returnVertexNormalTileJson();
Expand All @@ -585,8 +583,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with WaterMask', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.watermask.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.watermask.terrain', responseType, method, data, headers, deferred);
};

returnWaterMaskTileJson();
Expand All @@ -598,8 +596,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with VertexNormals and WaterMask', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.octvertexnormals.watermask.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.octvertexnormals.watermask.terrain', responseType, method, data, headers, deferred);
};

returnWaterMaskTileJson();
Expand All @@ -612,8 +610,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with OctVertexNormals', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.octvertexnormals.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.octvertexnormals.terrain', responseType, method, data, headers, deferred);
};

returnOctVertexNormalTileJson();
Expand All @@ -625,8 +623,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with VertexNormals and unknown extensions', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.vertexnormals.unknownext.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.vertexnormals.unknownext.terrain', responseType, method, data, headers, deferred);
};

returnVertexNormalTileJson();
Expand All @@ -638,8 +636,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with OctVertexNormals and unknown extensions', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.octvertexnormals.unknownext.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.octvertexnormals.unknownext.terrain', responseType, method, data, headers, deferred);
};

returnOctVertexNormalTileJson();
Expand All @@ -651,8 +649,8 @@ defineSuite([
});

it('provides QuantizedMeshTerrainData with unknown extension', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.unknownext.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.unknownext.terrain', responseType, method, data, headers, deferred);
};

returnOctVertexNormalTileJson();
Expand All @@ -667,7 +665,7 @@ defineSuite([

var deferreds = [];

loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
// Do nothing, so requests never complete
deferreds.push(deferred);
};
Expand Down Expand Up @@ -701,8 +699,8 @@ defineSuite([
it('supports getTileDataAvailable()', function() {
var baseUrl = 'made/up/url';

loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
loadWithXhr.defaultLoad('Data/CesiumTerrainTileJson/tile.terrain', responseType, method, data, headers, deferred);
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._DefaultImplementations.loadWithXhr('Data/CesiumTerrainTileJson/tile.terrain', responseType, method, data, headers, deferred);
};

returnQuantizedMeshTileJson();
Expand Down Expand Up @@ -737,9 +735,9 @@ defineSuite([
});

it('supports a query string in the base URL', function() {
loadWithXhr.load = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) {
// Just return any old file, as long as its big enough
loadWithXhr.defaultLoad('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred);
Resource._DefaultImplementations.loadWithXhr('Data/EarthOrientationParameters/IcrfToFixedStkComponentsRotationData.json', responseType, method, data, headers, deferred);
};

returnHeightmapTileJson();
Expand Down
Loading

0 comments on commit 2f6a5ad

Please sign in to comment.