<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[161480] trunk/PerformanceTests</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/161480">161480</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-07 19:58:16 -0800 (Tue, 07 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>DoYouEvenBench: Turn BenchmarkRunner into a real class
https://bugs.webkit.org/show_bug.cgi?id=126613

Reviewed by Stephanie Lewis.

Made BenchmarkRunner an instantiatable class. Made tests.js simply create an array of suite objects
instead of calling BenchmarkRunner.Suite now that we can have mulitple instances of BenchmarkRunner.

* DoYouEvenBench/benchmark.html:
(formatTestName): Moved and renamed from BenchmarkRunner._testName.
(createUIForSuites): Extracted from a giant blob of code.
(startTest): Ditto.
* DoYouEvenBench/resources/benchmark-runner.js:
(BenchmarkRunner): Added.
(BenchmarkRunner.prototype.waitForElement):
(BenchmarkRunner.prototype._removeFrame):
(BenchmarkRunner.prototype._appendFrame):
(BenchmarkRunner.prototype._waitAndWarmUp):
(BenchmarkRunner.prototype._runTest):
(BenchmarkState.prototype.prepareCurrentSuite):
(BenchmarkRunner.prototype.step):
(BenchmarkRunner.prototype._runTestAndRecordResults):
(BenchmarkRunner.prototype._finalize):
* DoYouEvenBench/resources/tests.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkPerformanceTestsChangeLog">trunk/PerformanceTests/ChangeLog</a></li>
<li><a href="#trunkPerformanceTestsDoYouEvenBenchbenchmarkhtml">trunk/PerformanceTests/DoYouEvenBench/benchmark.html</a></li>
<li><a href="#trunkPerformanceTestsDoYouEvenBenchresourcesbenchmarkrunnerjs">trunk/PerformanceTests/DoYouEvenBench/resources/benchmark-runner.js</a></li>
<li><a href="#trunkPerformanceTestsDoYouEvenBenchresourcestestsjs">trunk/PerformanceTests/DoYouEvenBench/resources/tests.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkPerformanceTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/ChangeLog (161479 => 161480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/ChangeLog        2014-01-08 03:26:02 UTC (rev 161479)
+++ trunk/PerformanceTests/ChangeLog        2014-01-08 03:58:16 UTC (rev 161480)
</span><span class="lines">@@ -1,5 +1,32 @@
</span><span class="cx"> 2014-01-07  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
</span><span class="cx"> 
</span><ins>+        DoYouEvenBench: Turn BenchmarkRunner into a real class
+        https://bugs.webkit.org/show_bug.cgi?id=126613
+
+        Reviewed by Stephanie Lewis.
+
+        Made BenchmarkRunner an instantiatable class. Made tests.js simply create an array of suite objects
+        instead of calling BenchmarkRunner.Suite now that we can have mulitple instances of BenchmarkRunner.
+
+        * DoYouEvenBench/benchmark.html:
+        (formatTestName): Moved and renamed from BenchmarkRunner._testName.
+        (createUIForSuites): Extracted from a giant blob of code.
+        (startTest): Ditto.
+        * DoYouEvenBench/resources/benchmark-runner.js:
+        (BenchmarkRunner): Added.
+        (BenchmarkRunner.prototype.waitForElement):
+        (BenchmarkRunner.prototype._removeFrame):
+        (BenchmarkRunner.prototype._appendFrame):
+        (BenchmarkRunner.prototype._waitAndWarmUp):
+        (BenchmarkRunner.prototype._runTest):
+        (BenchmarkState.prototype.prepareCurrentSuite):
+        (BenchmarkRunner.prototype.step):
+        (BenchmarkRunner.prototype._runTestAndRecordResults):
+        (BenchmarkRunner.prototype._finalize):
+        * DoYouEvenBench/resources/tests.js:
+
+2014-01-07  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
</ins><span class="cx">         DoYouEvenBench: Extract tests and runner code from benchmark.js/html
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=126596
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkPerformanceTestsDoYouEvenBenchbenchmarkhtml"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/DoYouEvenBench/benchmark.html (161479 => 161480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/DoYouEvenBench/benchmark.html        2014-01-08 03:26:02 UTC (rev 161479)
+++ trunk/PerformanceTests/DoYouEvenBench/benchmark.html        2014-01-08 03:58:16 UTC (rev 161480)
</span><span class="lines">@@ -16,11 +16,12 @@
</span><span class="cx"> &lt;body&gt;
</span><span class="cx"> &lt;script&gt;
</span><span class="cx"> 
</span><del>-window.addEventListener('load', function () {
-    var self = BenchmarkRunner;
</del><ins>+function formatTestName(suiteName, testName) {
+    return suiteName + (testName ? '/' + testName : '');
+}
+
+function createUIForSuites(suites, onstep, onrun) {
</ins><span class="cx">     var control = document.createElement('nav');
</span><del>-
-    var suites = BenchmarkRunner._suites;
</del><span class="cx">     var ol = document.createElement('ol');
</span><span class="cx">     var checkboxes = [];
</span><span class="cx">     for (var suiteIndex = 0; suiteIndex &lt; suites.length; suiteIndex++) {
</span><span class="lines">@@ -36,7 +37,7 @@
</span><span class="cx"> 
</span><span class="cx">         li.appendChild(checkbox);
</span><span class="cx">         var label = document.createElement('label');
</span><del>-        label.appendChild(document.createTextNode(self._testName(suite)));
</del><ins>+        label.appendChild(document.createTextNode(formatTestName(suite.name)));
</ins><span class="cx">         li.appendChild(label);
</span><span class="cx">         label.htmlFor = checkbox.id;
</span><span class="cx"> 
</span><span class="lines">@@ -47,7 +48,7 @@
</span><span class="cx">             var anchor = document.createElement('a');
</span><span class="cx">             anchor.id = suite.name + '-' + test.name;
</span><span class="cx">             test.anchor = anchor;
</span><del>-            anchor.appendChild(document.createTextNode(self._testName(suite, test.name)));
</del><ins>+            anchor.appendChild(document.createTextNode(formatTestName(suite.name, test.name)));
</ins><span class="cx">             testItem.appendChild(anchor);
</span><span class="cx">             testList.appendChild(testItem);
</span><span class="cx">         }
</span><span class="lines">@@ -58,7 +59,21 @@
</span><span class="cx"> 
</span><span class="cx">     control.appendChild(ol);
</span><span class="cx"> 
</span><del>-    BenchmarkRunner.setClient({
</del><ins>+    var button = document.createElement('button');
+    button.textContent = 'Step';
+    button.onclick = onstep;
+    control.appendChild(button);
+
+    var button = document.createElement('button');
+    button.textContent = 'Run';
+    button.onclick = onrun;
+    control.appendChild(button);
+
+    return control;
+}
+
+function startTest() {
+    var runner = new BenchmarkRunner(Suites, {
</ins><span class="cx">         willRunTest: function (suite, test) {
</span><span class="cx">             test.anchor.classList.add('running');
</span><span class="cx">         },
</span><span class="lines">@@ -94,30 +109,21 @@
</span><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     var currentState = null;
</span><del>-
-    // Don't call step while step is already executing.
-    var button = document.createElement('button');
-    button.textContent = 'Step';
-    button.onclick = function () {
-        self.step(currentState).then(function (state) { currentState = state; });
-    }
-    control.appendChild(button);
-
</del><span class="cx">     function callNextStep(state) {
</span><del>-        self.step(state).then(function (newState) {
</del><ins>+        runner.step(state).then(function (newState) {
</ins><span class="cx">             currentState = newState;
</span><span class="cx">             if (newState)
</span><span class="cx">                 callNextStep(newState);
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    var button = document.createElement('button');
-    button.textContent = 'Run';
-    button.onclick = function () { callNextStep(currentState); }
-    control.appendChild(button);
</del><ins>+    // Don't call step while step is already executing.
+    document.body.appendChild(createUIForSuites(Suites,
+        function () { runner.step(currentState).then(function (state) { currentState = state; }); },
+        function () { callNextStep(currentState); }));
+}
</ins><span class="cx"> 
</span><del>-    document.body.appendChild(control);
-});
</del><ins>+window.addEventListener('load', startTest);
</ins><span class="cx"> 
</span><span class="cx"> &lt;/script&gt;
</span><span class="cx"> &lt;/body&gt;
</span></span></pre></div>
<a id="trunkPerformanceTestsDoYouEvenBenchresourcesbenchmarkrunnerjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/DoYouEvenBench/resources/benchmark-runner.js (161479 => 161480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/DoYouEvenBench/resources/benchmark-runner.js        2014-01-08 03:26:02 UTC (rev 161479)
+++ trunk/PerformanceTests/DoYouEvenBench/resources/benchmark-runner.js        2014-01-08 03:58:16 UTC (rev 161480)
</span><span class="lines">@@ -37,20 +37,16 @@
</span><span class="cx">     this.run = testFunction;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-var BenchmarkRunner = {_suites: [], _prepareReturnValue: null, _measuredValues: {}, _client: null};
-
-BenchmarkRunner.suite = function (suite) {
-    BenchmarkRunner._suites.push(suite);
</del><ins>+function BenchmarkRunner(suites, client) {
+    this._suites = suites;
+    this._prepareReturnValue = null;
+    this._measuredValues = {};
+    this._client = client;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner.setClient = function (client) {
-    BenchmarkRunner._client = client;
-}
-
-BenchmarkRunner.waitForElement = function (selector) {
-    var self = BenchmarkRunner;
</del><ins>+BenchmarkRunner.prototype.waitForElement = function (selector) {
</ins><span class="cx">     var promise = new SimplePromise;
</span><del>-    var contentDocument = self._frame.contentDocument;
</del><ins>+    var contentDocument = this._frame.contentDocument;
</ins><span class="cx"> 
</span><span class="cx">     function resolveIfReady() {
</span><span class="cx">         var element = contentDocument.querySelector(selector);
</span><span class="lines">@@ -63,25 +59,23 @@
</span><span class="cx">     return promise;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner._removeFrame = function () {
-    var self = BenchmarkRunner;
-    if (self._frame) {
-        self._frame.parentNode.removeChild(self._frame);
-        self._frame = null;
</del><ins>+BenchmarkRunner.prototype._removeFrame = function () {
+    if (this._frame) {
+        this._frame.parentNode.removeChild(this._frame);
+        this._frame = null;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner._appendFrame = function (src) {
-    var self = BenchmarkRunner;
</del><ins>+BenchmarkRunner.prototype._appendFrame = function (src) {
</ins><span class="cx">     var frame = document.createElement('iframe');
</span><span class="cx">     frame.style.width = '800px';
</span><span class="cx">     frame.style.height = '600px'
</span><span class="cx">     document.body.appendChild(frame);
</span><del>-    self._frame = frame;
</del><ins>+    this._frame = frame;
</ins><span class="cx">     return frame;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner._waitAndWarmUp = function () {
</del><ins>+BenchmarkRunner.prototype._waitAndWarmUp = function () {
</ins><span class="cx">     var startTime = Date.now();
</span><span class="cx"> 
</span><span class="cx">     function Fibonacci(n) {
</span><span class="lines">@@ -103,13 +97,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // This function ought be as simple as possible. Don't even use SimplePromise.
</span><del>-BenchmarkRunner._runTest = function(suite, testFunction, prepareReturnValue, callback)
</del><ins>+BenchmarkRunner.prototype._runTest = function(suite, testFunction, prepareReturnValue, callback)
</ins><span class="cx"> {
</span><del>-    var self = BenchmarkRunner;
</del><span class="cx">     var now = window.performance &amp;&amp; window.performance.now ? function () { return window.performance.now(); } : Date.now;
</span><span class="cx"> 
</span><del>-    var contentWindow = self._frame.contentWindow;
-    var contentDocument = self._frame.contentDocument;
</del><ins>+    var contentWindow = this._frame.contentWindow;
+    var contentDocument = this._frame.contentDocument;
</ins><span class="cx"> 
</span><span class="cx">     var startTime = now();
</span><span class="cx">     testFunction(prepareReturnValue, contentWindow, contentDocument);
</span><span class="lines">@@ -123,12 +116,6 @@
</span><span class="cx">     }, 0);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner._testName = function (suite, testName, metric) {
-    if (!testName)
-        return suite.name;
-    return suite.name + '/' + testName + (metric ? '/' + metric : '');
-}
-
</del><span class="cx"> function BenchmarkState(suites) {
</span><span class="cx">     this._suites = suites;
</span><span class="cx">     this._suiteIndex = -1;
</span><span class="lines">@@ -164,51 +151,49 @@
</span><span class="cx">     return !this._testIndex;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkState.prototype.prepareCurrentSuite = function (frame) {
-    var self = this;
</del><ins>+BenchmarkState.prototype.prepareCurrentSuite = function (runner, frame) {
</ins><span class="cx">     var suite = this.currentSuite();
</span><span class="cx">     var promise = new SimplePromise;
</span><span class="cx">     frame.onload = function () {
</span><del>-        suite.prepare(frame.contentWindow, frame.contentDocument).then(function (result) { promise.resolve(result); });
</del><ins>+        suite.prepare(runner, frame.contentWindow, frame.contentDocument).then(function (result) { promise.resolve(result); });
</ins><span class="cx">     }
</span><span class="cx">     frame.src = suite.url;
</span><span class="cx">     return promise;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner.step = function (state) {
-    var self = BenchmarkRunner;
-
</del><ins>+BenchmarkRunner.prototype.step = function (state) {
</ins><span class="cx">     if (!state)
</span><del>-        state = new BenchmarkState(self._suites);
</del><ins>+        state = new BenchmarkState(this._suites);
</ins><span class="cx"> 
</span><span class="cx">     var suite = state.currentSuite();
</span><span class="cx">     if (!suite) {
</span><del>-        self._finalize();
</del><ins>+        this._finalize();
</ins><span class="cx">         var promise = new SimplePromise;
</span><span class="cx">         promise.resolve();
</span><span class="cx">         return promise;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (state.isFirstTest()) {
</span><del>-        self._masuredValuesForCurrentSuite = {};
-        return state.prepareCurrentSuite(self._appendFrame()).then(function (prepareReturnValue) {
</del><ins>+        this._masuredValuesForCurrentSuite = {};
+        var self = this;
+        return state.prepareCurrentSuite(this, this._appendFrame()).then(function (prepareReturnValue) {
</ins><span class="cx">             self._prepareReturnValue = prepareReturnValue;
</span><span class="cx">             return self._runTestAndRecordResults(state);
</span><span class="cx">         });
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return self._runTestAndRecordResults(state);
</del><ins>+    return this._runTestAndRecordResults(state);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner._runTestAndRecordResults = function (state) {
-    var self = BenchmarkRunner;
</del><ins>+BenchmarkRunner.prototype._runTestAndRecordResults = function (state) {
</ins><span class="cx">     var promise = new SimplePromise;
</span><span class="cx">     var suite = state.currentSuite();
</span><span class="cx">     var test = state.currentTest();
</span><span class="cx"> 
</span><del>-    if (self._client &amp;&amp; self._client.willRunTest)
-        self._client.willRunTest(suite, test);
</del><ins>+    if (this._client &amp;&amp; this._client.willRunTest)
+        this._client.willRunTest(suite, test);
</ins><span class="cx"> 
</span><ins>+    var self = this;
</ins><span class="cx">     setTimeout(function () {
</span><span class="cx">         self._runTest(suite, test.run, self._prepareReturnValue, function (syncTime, asyncTime) {
</span><span class="cx">             var suiteResults = self._measuredValues[suite.name] || {tests:{}, total: 0};
</span><span class="lines">@@ -228,14 +213,12 @@
</span><span class="cx">     return promise;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-BenchmarkRunner._finalize = function () {
-    var self = BenchmarkRunner;
</del><ins>+BenchmarkRunner.prototype._finalize = function () {
+    this._removeFrame();
</ins><span class="cx"> 
</span><del>-    self._removeFrame();
</del><ins>+    if (this._client &amp;&amp; this._client.didRunSuites)
+        this._client.didRunSuites(this._measuredValues);
</ins><span class="cx"> 
</span><del>-    if (self._client &amp;&amp; self._client.didRunSuites)
-        self._client.didRunSuites(self._measuredValues);
-
</del><span class="cx">     // FIXME: This should be done when we start running tests.
</span><del>-    self._measuredValues = {};
</del><ins>+    this._measuredValues = {};
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkPerformanceTestsDoYouEvenBenchresourcestestsjs"></a>
<div class="modfile"><h4>Modified: trunk/PerformanceTests/DoYouEvenBench/resources/tests.js (161479 => 161480)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/PerformanceTests/DoYouEvenBench/resources/tests.js        2014-01-08 03:26:02 UTC (rev 161479)
+++ trunk/PerformanceTests/DoYouEvenBench/resources/tests.js        2014-01-08 03:58:16 UTC (rev 161480)
</span><span class="lines">@@ -1,10 +1,11 @@
</span><span class="cx"> var numberOfItemsToAdd = 100;
</span><ins>+var Suites = [];
</ins><span class="cx"> 
</span><del>-BenchmarkRunner.suite({
</del><ins>+Suites.push({
</ins><span class="cx">     name: 'VanillaJS-TodoMVC',
</span><span class="cx">     url: 'todomvc/vanilla-examples/vanillajs/index.html',
</span><del>-    prepare: function (contentWindow, contentDocument) {
-        return BenchmarkRunner.waitForElement('#new-todo').then(function (element) {
</del><ins>+    prepare: function (runner, contentWindow, contentDocument) {
+        return runner.waitForElement('#new-todo').then(function (element) {
</ins><span class="cx">             element.focus();
</span><span class="cx">             return element;
</span><span class="cx">         });
</span><span class="lines">@@ -30,17 +31,17 @@
</span><span class="cx">     ]
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-BenchmarkRunner.suite({
</del><ins>+Suites.push({
</ins><span class="cx">     name: 'EmberJS-TodoMVC',
</span><span class="cx">     url: 'todomvc/architecture-examples/emberjs/index.html',
</span><del>-    prepare: function (contentWindow, contentDocument) {
</del><ins>+    prepare: function (runner, contentWindow, contentDocument) {
</ins><span class="cx">         contentWindow.Todos.Store = contentWindow.DS.Store.extend({
</span><span class="cx">             revision: 12,
</span><span class="cx">             adapter: 'Todos.LSAdapter',
</span><span class="cx">             commit: function () { }
</span><span class="cx">         });
</span><span class="cx"> 
</span><del>-        return BenchmarkRunner.waitForElement('#new-todo').then(function (element) {
</del><ins>+        return runner.waitForElement('#new-todo').then(function (element) {
</ins><span class="cx">             element.focus();
</span><span class="cx">             return {
</span><span class="cx">                 views: contentWindow.Ember.View.views,
</span><span class="lines">@@ -70,12 +71,12 @@
</span><span class="cx">     ]
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-BenchmarkRunner.suite({
</del><ins>+Suites.push({
</ins><span class="cx">     name: 'BackboneJS-TodoMVC',
</span><span class="cx">     url: 'todomvc/architecture-examples/backbone/index.html',
</span><del>-    prepare: function (contentWindow, contentDocument) {
</del><ins>+    prepare: function (runner, contentWindow, contentDocument) {
</ins><span class="cx">     contentWindow.Backbone.sync = function () {}
</span><del>-        return BenchmarkRunner.waitForElement('#new-todo').then(function (element) {
</del><ins>+        return runner.waitForElement('#new-todo').then(function (element) {
</ins><span class="cx">             element.focus();
</span><span class="cx">             return element;
</span><span class="cx">         });
</span><span class="lines">@@ -102,11 +103,11 @@
</span><span class="cx">     ]
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-BenchmarkRunner.suite({
</del><ins>+Suites.push({
</ins><span class="cx">     name: 'jQuery-TodoMVC',
</span><span class="cx">     url: 'todomvc/architecture-examples/jquery/index.html',
</span><del>-    prepare: function (contentWindow, contentDocument) {
-        return BenchmarkRunner.waitForElement('#new-todo').then(function (element) {
</del><ins>+    prepare: function (runner, contentWindow, contentDocument) {
+        return runner.waitForElement('#new-todo').then(function (element) {
</ins><span class="cx">             element.focus();
</span><span class="cx">             return element;
</span><span class="cx">         });
</span><span class="lines">@@ -158,11 +159,11 @@
</span><span class="cx">     ]
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-BenchmarkRunner.suite({
</del><ins>+Suites.push({
</ins><span class="cx">     name: 'AngularJS-TodoMVC',
</span><span class="cx">     url: 'todomvc/architecture-examples/angularjs/index.html',
</span><del>-    prepare: function (contentWindow, contentDocument) {
-        return BenchmarkRunner.waitForElement('#new-todo').then(function (element) {
</del><ins>+    prepare: function (runner, contentWindow, contentDocument) {
+        return runner.waitForElement('#new-todo').then(function (element) {
</ins><span class="cx">             element.focus();
</span><span class="cx">             return element;
</span><span class="cx">         });
</span><span class="lines">@@ -193,12 +194,12 @@
</span><span class="cx">     ]
</span><span class="cx"> });
</span><span class="cx"> 
</span><del>-BenchmarkRunner.suite({
</del><ins>+Suites.push({
</ins><span class="cx">     name: 'React-TodoMVC',
</span><span class="cx">     url: 'todomvc/labs/architecture-examples/react/index.html',
</span><del>-    prepare: function (contentWindow, contentDocument) {
</del><ins>+    prepare: function (runner, contentWindow, contentDocument) {
</ins><span class="cx">         contentWindow.Utils.store = function () {}
</span><del>-        return BenchmarkRunner.waitForElement('#new-todo').then(function (element) {
</del><ins>+        return runner.waitForElement('#new-todo').then(function (element) {
</ins><span class="cx">             element.focus();
</span><span class="cx">             return element;
</span><span class="cx">         });
</span><span class="lines">@@ -229,11 +230,11 @@
</span><span class="cx"> });
</span><span class="cx"> 
</span><span class="cx"> var actionCount = 50;
</span><del>-BenchmarkRunner.suite({
</del><ins>+Suites.push({
</ins><span class="cx">     name: 'FlightJS-MailClient',
</span><span class="cx">     url: 'flightjs-example-app/index.html',
</span><del>-    prepare: function (contentWindow, contentDocument) {
-        return BenchmarkRunner.waitForElement('.span8').then(function (element) {
</del><ins>+    prepare: function (runner, contentWindow, contentDocument) {
+        return runner.waitForElement('.span8').then(function (element) {
</ins><span class="cx">             element.focus();
</span><span class="cx">             return element;
</span><span class="cx">         });
</span></span></pre>
</div>
</div>

</body>
</html>