Bug 1233537 - remove support for generatorTest, r?jmaher draft
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Wed, 30 Dec 2015 13:51:18 +0000
changeset 318054 3fbd6db9eb37d6982ca5784b4a11139633ae9f86
parent 318050 df0d060fbe6985324f7d797fe44c7c004c0241a3
child 512405 7d7b34e49e8f4b54fc4a7fadd3cee0b28b3ce6f9
push id8815
push usergijskruitbosch@gmail.com
push dateWed, 30 Dec 2015 15:44:15 +0000
reviewersjmaher
bugs1233537
milestone46.0a1
Bug 1233537 - remove support for generatorTest, r?jmaher
testing/mochitest/browser-test.js
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -782,26 +782,16 @@ Tester.prototype = {
               let result = new testResult(isExpected, name, ex, false, stack);
               currentTest.addResult(result);
             }
             Promise.Debugging.flushUncaughtErrors();
             this.SimpleTest.info("Leaving test " + task.name);
           }
           this.finish();
         }.bind(currentScope));
-      } else if ("generatorTest" in this.currentTest.scope) {
-        if ("test" in this.currentTest.scope) {
-          throw "Cannot run both a generator test and a normal test at the same time.";
-        }
-
-        // This test is a generator. It will not finish immediately.
-        this.currentTest.scope.waitForExplicitFinish();
-        var result = this.currentTest.scope.generatorTest();
-        this.currentTest.scope.__generator = result;
-        result.next();
       } else if (typeof this.currentTest.scope.test == "function") {
         this.currentTest.scope.test();
       } else {
         throw "This test didn't call add_task, nor did it define a generatorTest() function, nor did it define a test() function, so we don't know how to run it.";
       }
     } catch (ex) {
       let isExpected = !!this.SimpleTest.isExpectingUncaughtException();
       if (!this.SimpleTest.isIgnoringAllUncaughtExceptions()) {
@@ -981,45 +971,16 @@ function testScope(aTester, aTest, expec
   this.executeSoon = function test_executeSoon(func) {
     Services.tm.mainThread.dispatch({
       run: function() {
         func();
       }
     }, Ci.nsIThread.DISPATCH_NORMAL);
   };
 
-  this.nextStep = function test_nextStep(arg) {
-    if (self.__done) {
-      aTest.addResult(new testResult(false, "nextStep was called too many times", "", false));
-      return;
-    }
-
-    if (!self.__generator) {
-      aTest.addResult(new testResult(false, "nextStep called with no generator", "", false));
-      self.finish();
-      return;
-    }
-
-    try {
-      self.__generator.send(arg);
-    } catch (ex if ex instanceof StopIteration) {
-      // StopIteration means test is finished.
-      self.finish();
-    } catch (ex) {
-      var isExpected = !!self.SimpleTest.isExpectingUncaughtException();
-      if (!self.SimpleTest.isIgnoringAllUncaughtExceptions()) {
-        aTest.addResult(new testResult(isExpected, "Exception thrown", ex, false));
-        self.SimpleTest.expectUncaughtException(false);
-      } else {
-        aTest.addResult(new testMessage("Exception thrown: " + ex));
-      }
-      self.finish();
-    }
-  };
-
   this.waitForExplicitFinish = function test_waitForExplicitFinish() {
     self.__done = false;
   };
 
   this.waitForFocus = function test_waitForFocus(callback, targetWindow, expectBlankPage) {
     self.SimpleTest.waitForFocus(callback, targetWindow, expectBlankPage);
   };
 
@@ -1089,17 +1050,16 @@ function testScope(aTester, aTest, expec
     self.__tester.dumper.structuredLogger.deactivateBuffering();
     self.registerCleanupFunction(function() {
       self.__tester.dumper.structuredLogger.activateBuffering();
     })
   };
 }
 testScope.prototype = {
   __done: true,
-  __generator: null,
   __tasks: null,
   __waitTimer: null,
   __cleanupFunctions: [],
   __timeoutFactor: 1,
   __expectedMinAsserts: 0,
   __expectedMaxAsserts: 0,
   __expected: 'pass',