@@ -55,10 +55,9 @@ function setupServer(targetPlatform) {
5555}
5656exports . setupServer = setupServer ;
5757/**
58- * The real content hash of each update archive built during this run, keyed by archive path.
59- * Populated by setPackageHashForPath and applied to exports.updateResponse.
58+ * The real content hash of the update archive most recently built during this test scenario.
6059 */
61- var packageHashesByPath = { } ;
60+ var knownPackageHash ;
6261var _updatePackagePath ;
6362Object . defineProperty ( exports , "updatePackagePath" , {
6463 enumerable : true ,
@@ -70,18 +69,17 @@ Object.defineProperty(exports, "updatePackagePath", {
7069 }
7170} ) ;
7271/**
73- * Records the real content hash for an update archive, so that any update_check response
74- * pointing exports.updatePackagePath at this archive gets the matching package_hash instead
75- * of the one filled in by default.
72+ * Records the real content hash for the update archive that will be served next, so that
73+ * any update_check response gets the matching package_hash instead of the one filled in
74+ * by default.
7675 */
77- function setPackageHashForPath ( archivePath , packageHash ) {
78- packageHashesByPath [ archivePath ] = packageHash ;
76+ function setKnownPackageHash ( packageHash ) {
77+ knownPackageHash = packageHash ;
7978}
80- exports . setPackageHashForPath = setPackageHashForPath ;
79+ exports . setKnownPackageHash = setKnownPackageHash ;
8180function applyKnownPackageHash ( ) {
82- var knownHash = _updatePackagePath && packageHashesByPath [ _updatePackagePath ] ;
83- if ( knownHash && exports . updateResponse && exports . updateResponse . update_info ) {
84- exports . updateResponse . update_info . package_hash = knownHash ;
81+ if ( knownPackageHash && exports . updateResponse && exports . updateResponse . update_info ) {
82+ exports . updateResponse . update_info . package_hash = knownPackageHash ;
8583 }
8684}
8785/**
0 commit comments