2 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23 * THE POSSIBILITY OF SUCH DAMAGE.
30 test("subversionURLForTest", 1, function() {
31 equals(checkout.subversionURLForTest("path/to/test.html"), "http://svn.webkit.org/repository/webkit/trunk/LayoutTests/path/to/test.html");
34 test("updateExpectations", 4, function() {
35 var simulator = new NetworkSimulator();
37 // FIXME: This leaks state into g_haveSeenCheckoutAvailable, which is global.
38 simulator.ajax = function(options) { options.success.call(); },
40 simulator.post = function(url, data, callback)
42 equals(url, 'http://127.0.0.1:8127/updateexpectations');
43 equals(data, '[{"builderName":"WebKit Linux","testName":"another/test.svg"}]');
44 simulator.scheduleCallback(callback);
47 simulator.runTest(function() {
48 checkout.updateExpectations([{
49 'builderName': 'WebKit Linux',
50 'testName': 'another/test.svg',
59 test("optimizeBaselines", 3, function() {
60 var simulator = new NetworkSimulator();
61 simulator.post = function(url, callback)
63 equals(url, 'http://127.0.0.1:8127/optimizebaselines?test=another%2Ftest.svg');
64 simulator.scheduleCallback(callback);
67 simulator.runTest(function() {
68 checkout.optimizeBaselines('another/test.svg', function() {
74 test("rebaseline", 7, function() {
75 var simulator = new NetworkSimulator();
77 var requestedURLs = [];
78 simulator.post = function(url, callback)
80 requestedURLs.push(url);
81 simulator.scheduleCallback(callback);
83 simulator.ajax = function(options)
85 ok(options.url.indexOf('/ping') != -1);
86 simulator.scheduleCallback(options.success);
89 var kExpectedTestNameProgressStack = [
92 'another/test.svg', // This is the first one.
95 simulator.runTest(function() {
96 checkout.rebaseline([{
97 'builderName': 'WebKit Linux',
98 'testName': 'another/test.svg',
100 'builderName': 'WebKit Mac10.6',
101 'testName': 'another/test.svg',
103 'builderName': 'Webkit Vista',
104 'testName': 'fast/test.html',
107 }, function(failureInfo) {
108 equals(failureInfo.testName, kExpectedTestNameProgressStack.pop());
110 ok(false, 'Checkout should be available.');
114 deepEqual(requestedURLs, [
115 "http://127.0.0.1:8127/rebaseline?builder=WebKit+Linux&test=another%2Ftest.svg",
116 "http://127.0.0.1:8127/rebaseline?builder=WebKit+Mac10.6&test=another%2Ftest.svg",
117 "http://127.0.0.1:8127/rebaseline?builder=Webkit+Vista&test=fast%2Ftest.html",
118 "http://127.0.0.1:8127/optimizebaselines?test=another%2Ftest.svg",
119 "http://127.0.0.1:8127/optimizebaselines?test=fast%2Ftest.html"