Bug 1183008 - Modify test_ocsp_caching.js to use modified thisUpdate rather than sleep. r?keeler draft
authorMark Goodwin <mgoodwin@mozilla.com>
Thu, 17 Aug 2017 17:36:04 +0100
changeset 648360 a16f5cdff6ab2f4ce66c7bb60c1e60f65cafd8c9
parent 648260 04bee69b3274bd8d5cf52d54a0a5cc14dbe8693a
child 726800 1b5f4880d26cd6da33aa878466cf9d9f982b1410
push id74727
push usermgoodwin@mozilla.com
push dateThu, 17 Aug 2017 16:40:50 +0000
reviewerskeeler
bugs1183008
milestone57.0a1
Bug 1183008 - Modify test_ocsp_caching.js to use modified thisUpdate rather than sleep. r?keeler MozReview-Commit-ID: K9JKCkWOO31
security/manager/ssl/tests/unit/test_ocsp_caching.js
security/manager/ssl/tests/unit/xpcshell.ini
--- a/security/manager/ssl/tests/unit/test_ocsp_caching.js
+++ b/security/manager/ssl/tests/unit/test_ocsp_caching.js
@@ -31,18 +31,18 @@ function respondWithSHA1OCSP(request, re
 
 function respondWithError(request, response) {
   do_print("returning 500 Internal Server Error");
   response.setStatusLine(request.httpVersion, 500, "Internal Server Error");
   let body = "Refusing to return a response";
   response.bodyOutputStream.write(body, body.length);
 }
 
-function generateGoodOCSPResponse() {
-  let args = [ ["good", "default-ee", "unused", 0 ] ];
+function generateGoodOCSPResponse(thisUpdateSkew) {
+  let args = [ ["good", "default-ee", "unused", thisUpdateSkew ] ];
   let responses = generateOCSPResponses(args, "ocsp_certs");
   return responses[0];
 }
 
 function add_ocsp_test(aHost, aExpectedResult, aResponses, aMessage,
                        aOriginAttributes) {
   add_connection_test(aHost, aExpectedResult,
       function() {
@@ -143,23 +143,17 @@ function add_tests() {
   // A valid Good response from the OCSP responder must override the cached
   // Unknown response.
   //
   // Note that We need to make sure that the Unknown response and the Good
   // response have different thisUpdate timestamps; otherwise, the Good
   // response will be seen as "not newer" and it won't replace the existing
   // entry.
   add_test(function() {
-    let duration = 1200;
-    do_print("Sleeping for " + duration + "ms");
-    let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-    timer.initWithCallback(run_next_test, duration, Ci.nsITimer.TYPE_ONE_SHOT);
-  });
-  add_test(function() {
-    gGoodOCSPResponse = generateGoodOCSPResponse();
+    gGoodOCSPResponse = generateGoodOCSPResponse(1200);
     run_next_test();
   });
   add_ocsp_test("ocsp-stapling-none.example.com", PRErrorCodeSuccess,
                 [respondWithGoodOCSP],
                 "Cached Unknown response, no stapled response -> a fetch" +
                 " should have been attempted");
 
   // The Good response retrieved from the previous fetch must have replaced
--- a/security/manager/ssl/tests/unit/xpcshell.ini
+++ b/security/manager/ssl/tests/unit/xpcshell.ini
@@ -101,18 +101,16 @@ run-sequentially = hardcoded ports
 [test_name_constraints.js]
 [test_nsCertType.js]
 run-sequentially = hardcoded ports
 [test_nsIX509Cert_utf8.js]
 [test_nsIX509CertValidity.js]
 [test_nss_shutdown.js]
 [test_ocsp_caching.js]
 run-sequentially = hardcoded ports
-# bug 1183008
-skip-if = toolkit == 'android' || asan
 [test_ocsp_enabled_pref.js]
 run-sequentially = hardcoded ports
 [test_ocsp_fetch_method.js]
 run-sequentially = hardcoded ports
 [test_ocsp_must_staple.js]
 run-sequentially = hardcoded ports
 [test_ocsp_no_hsts_upgrade.js]
 run-sequentially = hardcoded ports