Dashboard tests fails to fetch the revision from commits
[WebKit-https.git] / Tools / BuildSlaveSupport / build.webkit.org-config / public_html / dashboard / Scripts / tests / resources / MockTrac.js
1 /*
2  * Copyright (C) 2016 Apple, Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
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.
12  *
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.
24  */
25
26 MockTrac = function(projectIdentifier)
27 {
28     if (projectIdentifier) {
29         var options = { };
30         options[Trac.ProjectIdentifier] = projectIdentifier;
31         Trac.call(this, "https://trac.webkit.org/", options);
32     } else {
33         Trac.call(this, "https://trac.webkit.org/");
34     }
35 };
36
37 BaseObject.addConstructorFunctions(MockTrac);
38
39 MockTrac.prototype = {
40     constructor: MockTrac,
41     __proto__: Trac.prototype,
42
43     get oldestRecordedRevisionNumber()
44     {
45         return "33018";
46     },
47
48     get latestRecordedRevisionNumber()
49     {
50         return "33022";
51     },
52
53     loadMoreHistoricalData: function()
54     {
55     },
56 };
57
58 MockTrac.EXAMPLE_TRAC_COMMITS = [
59     {
60         "revisionNumber": "33018",
61         "link": "https://trac.webkit.org/changeset/33018",
62         "title": { innerHTML: "commit message" },
63         "author": "john@webkit.org",
64         "date": new Date("2015-11-15T17:05:44.000Z"),
65         "description": "description",
66         "containsBranchLocation": true,
67         "branches": ["trunk"]
68     },
69     {
70         "revisionNumber": "33019",
71         "link": "https://trac.webkit.org/changeset/33019",
72         "title": { innerHTML: "commit message" },
73         "author": "paul@webkit.org",
74         "date": new Date("2015-11-16T01:18:23.000Z"),
75         "description": "description",
76         "containsBranchLocation": true,
77         "branches": ["someOtherBranch"]
78     },
79     {
80         "revisionNumber": "33020",
81         "link": "https://trac.webkit.org/changeset/33020",
82         "title": { innerHTML: "commit message" },
83         "author": "george@webkit.org",
84         "date": new Date("2015-11-16T01:19:27.000Z"),
85         "description": "description",
86         "containsBranchLocation": true,
87         "branches": ["trunk"]
88     },
89     {
90         "revisionNumber": "33021",
91         "link": "https://trac.webkit.org/changeset/33021",
92         "title": { innerHTML: "commit message" },
93         "author": "ringo@webkit.org",
94         "date": new Date("2015-11-16T01:20:58.000Z"),
95         "description": "description",
96         "containsBranchLocation": true,
97         "branches": ["someOtherBranch"]
98     },
99     {
100         "revisionNumber": "33022",
101         "link": "https://trac.webkit.org/changeset/33022",
102         "title": { innerHTML: "commit message" },
103         "author": "bob@webkit.org",
104         "date": new Date("2015-11-16T01:22:01.000Z"),
105         "description": "description",
106         "containsBranchLocation": true,
107         "branches": ["trunk"]
108     }
109 ];
110
111 MockTrac.recordedCommitIndicesByRevisionNumber = {
112     33018: 0,
113     33019: 1,
114     33020: 2,
115     33021: 3,
116     33022: 4,
117     33023: 5,
118     33024: 6,
119     33025: 7
120 };