_runBenchmarkAndRecordResults: function()

in MotionMark/resources/runner/benchmark-runner.js [80:113]


    _runBenchmarkAndRecordResults: function(state)
    {
        var promise = new SimplePromise;
        var suite = state.currentSuite();
        var test = state.currentTest();

        if (this._client && this._client.willRunTest)
            this._client.willRunTest(suite, test);

        var contentWindow = this._frame.contentWindow;
        var self = this;

        var options = { complexity: test.complexity };
        Utilities.extendObject(options, this._client.options);
        Utilities.extendObject(options, contentWindow.Utilities.parseParameters());

        var benchmark = new contentWindow.benchmarkClass(options);
        document.body.style.backgroundColor = benchmark.backgroundColor();
        benchmark.run().then(function(testData) {
            var suiteResults = self._suitesResults[suite.name] || {};
            suiteResults[test.name] = testData;
            self._suitesResults[suite.name] = suiteResults;

            if (self._client && self._client.didRunTest)
                self._client.didRunTest(testData);

            state.next();
            if (state.currentSuite() != suite)
                self._removeFrame();
            promise.resolve(state);
        });

        return promise;
    },