Upstream version 9.37.197.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Tools / GardeningServer / scripts / svn-log_unittests.js
1 /*
2  * Copyright (C) 2011 Google 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 (function () {
27
28 module("svn-log");
29
30 var kExampleCommitDataXML =
31    "<feed xmlns='http://www.w3.org/2005/Atom'>\n" +
32    "<title>blink, branch master</title>\n" +
33    "<subtitle>Mirror of the Chromium Blink repository.</subtitle>\n" +
34    "<link rel='alternate' type='text/html' href='http://blink.lc/blink/'/>\n" +
35    "<entry>\n" +
36    "<title>Throw SecurityError when setting 'Replaceable' properties cross-origin.</title>\n" +
37    "<updated>2013-09-30T20:22:01Z</updated>\n" +
38    "<author>\n" +
39    "<name>mkwst@chromium.org</name>\n" +
40    "</author>\n" +
41    "<published>2013-09-30T20:22:01Z</published>\n" +
42    "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?id=723e62a4a4e093435b4772b4839aa3fd7cf6b991'/>\n" +
43    "<id>723e62a4a4e093435b4772b4839aa3fd7cf6b991</id>\n" +
44    "<content type='text'>\n" +
45    "This matches Gecko's behavior for these types of properties.\n" +
46    "\n" +
47    "BUG=17325\n" +
48    "R=jochen@chromium.org\n" +
49    "CC=abarth@chromium.org\n" +
50    "\n" +
51    "Review URL: https://chromiumcodereview.appspot.com/25022002\n" +
52    "\n" +
53    "git-svn-id: svn://svn.chromium.org/blink/trunk@158545 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
54    "</content>\n" +
55    "<content type='xhtml'>\n" +
56    "<div xmlns='http://www.w3.org/1999/xhtml'>\n" +
57    "<pre>\n" +
58    "This matches Gecko's behavior for these types of properties.\n" +
59    "\n" +
60    "BUG=17325\n" +
61    "R=jochen@chromium.org\n" +
62    "CC=abarth@chromium.org\n" +
63    "\n" +
64    "Review URL: https://chromiumcodereview.appspot.com/25022002\n" +
65    "\n" +
66    "git-svn-id: svn://svn.chromium.org/blink/trunk@158545 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
67    "</pre>\n" +
68    "</div>\n" +
69    "</content>\n" +
70    "</entry>\n" +
71    "<entry>\n" +
72    "<title>Fix one more layering violation caught by check-blink-deps</title>\n" +
73    "<updated>2013-09-30T19:36:21Z</updated>\n" +
74    "<author>\n" +
75    "<name>eseidel@chromium.org</name>\n" +
76    "</author>\n" +
77    "<published>2013-09-30T19:36:21Z</published>\n" +
78    "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?id=51e5c70050dcb0980eb31f112d0cd948f3ece820'/>\n" +
79    "<id>51e5c70050dcb0980eb31f112d0cd948f3ece820</id>\n" +
80    "<content type='text'>\n" +
81    "core/platform may not depend on core/ even for testing.\n" +
82    "\n" +
83    "BUG=301947\n" +
84    "TBR=abarth@chromium.org, abarth\n" +
85    "\n" +
86    "Review URL: https://codereview.chromium.org/25284004\n" +
87    "\n" +
88    "git-svn-id: svn://svn.chromium.org/blink/trunk@158544 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
89    "</content>\n" +
90    "<content type='xhtml'>\n" +
91    "<div xmlns='http://www.w3.org/1999/xhtml'>\n" +
92    "<pre>\n" +
93    "core/platform may not depend on core/ even for testing.\n" +
94    "\n" +
95    "BUG=301947\n" +
96    "TBR=abarth@chromium.org, abarth\n" +
97    "\n" +
98    "Review URL: https://codereview.chromium.org/25284004\n" +
99    "\n" +
100    "git-svn-id: svn://svn.chromium.org/blink/trunk@158544 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
101    "</pre>\n" +
102    "</div>\n" +
103    "</content>\n" +
104    "</entry>\n" +
105    "<entry>\n" +
106    "<title>Update DEPS include_rules after addition of root-level platform directory</title>\n" +
107    "<updated>2013-09-30T19:28:49Z</updated>\n" +
108    "<author>\n" +
109    "<name>eseidel@chromium.org</name>\n" +
110    "</author>\n" +
111    "<published>2013-09-30T19:28:49Z</published>\n" +
112    "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?id=227add0156e8ab272abcd3368dfc0b5a91f35749'/>\n" +
113    "<id>227add0156e8ab272abcd3368dfc0b5a91f35749</id>\n" +
114    "<content type='text'>\n" +
115    "These were all failures noticed when running check-blink-deps\n" +
116    "\n" +
117    "R=abarth@chromium.org,abarth,abarth\n" +
118    "BUG=301947\n" +
119    "\n" +
120    "Review URL: https://codereview.chromium.org/25275005\n" +
121    "\n" +
122    "git-svn-id: svn://svn.chromium.org/blink/trunk@158543 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
123    "</content>\n" +
124    "<content type='xhtml'>\n" +
125    "<div xmlns='http://www.w3.org/1999/xhtml'>\n" +
126    "<pre>\n" +
127    "These were all failures noticed when running check-blink-deps\n" +
128    "\n" +
129    "R=abarth@chromium.org,abarth,abarth\n" +
130    "BUG=301947\n" +
131    "\n" +
132    "Review URL: https://codereview.chromium.org/25275005\n" +
133    "\n" +
134    "git-svn-id: svn://svn.chromium.org/blink/trunk@158543 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
135    "</pre>\n" +
136    "</div>\n" +
137    "</content>\n" +
138    "<entry>\n" +
139    "<title>Mark Skia suppressions for rebasline.</title>\n" +
140    "<updated>2014-02-27T14:44:41Z</updated>\n" +
141    "<author>\n" +
142    "<name>fmalita@chromium.org</name>\n" +
143    "</author>\n" +
144    "<published>2014-02-27T14:44:41Z</published>\n" +
145    "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?id=35030357db3c0967974273faf5e65fe3d7cc041b'/>\n" +
146    "<id>35030357db3c0967974273faf5e65fe3d7cc041b</id>\n" +
147    "<content type='text'>\n" +
148    "Unreviewed gardening.\n" +
149    "Stray R=123 in the middle...\n" +
150    "\n" +
151    "BUG=/341448,344497\n" +
152    "TBR=robertphillips@google.com\n" +
153    "\n" +
154    "Review URL: https://codereview.chromium.org/183123002\n" +
155    "\n" +
156    "git-svn-id: svn://svn.chromium.org/blink/trunk@168027 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
157    "</content>\n" +
158    "<content type='xhtml'>\n" +
159    "<div xmlns='http://www.w3.org/1999/xhtml'>\n" +
160    "<pre>\n" +
161    "Unreviewed gardening.\n" +
162    "Stray R=123 in the middle...\n" +
163    "\n" +
164    "BUG=/341448 ,   344497/ \n" +
165    "TBR=robertphillips@google.com\n" +
166    "\n" +
167    "Review URL: https://codereview.chromium.org/183123002\n" +
168    "\n" +
169    "git-svn-id: svn://svn.chromium.org/blink/trunk@168027 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
170    "</pre>\n" +
171    "</div>\n" +
172    "</content>\n" +
173    "</entry>\n" +
174
175    "<entry>\n" +
176    "<title>Remove yurys and loislo from WTF watchlist</title>\n" +
177    "<updated>2014-03-03T07:23:31Z</updated>\n" +
178    "<author>\n" +
179    "<name>yurys@chromium.org</name>\n" +
180    "</author>\n" +
181    "<published>2014-03-03T07:23:31Z</published>\n" +
182    "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?id=43118424ccd1d65ea7ec9ba26c32195e5fdde6e4'/>\n" +
183    "<id>43118424ccd1d65ea7ec9ba26c32195e5fdde6e4</id>\n" +
184    "<content type='text'>\n" +
185    "BUG=None\n" +
186    "R=loislo@chromium.org\n" +
187    "\n" +
188    "Review URL: https://codereview.chromium.org/176883013\n" +
189    "\n" +
190    "git-svn-id: svn://svn.chromium.org/blink/trunk@168268 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
191    "</content>\n" +
192    "<content type='xhtml'>\n" +
193    "<div xmlns='http://www.w3.org/1999/xhtml'>\n" +
194    "<pre>\n" +
195    "BUG=None\n" +
196    "R=loislo@chromium.org\n" +
197    "\n" +
198    "Review URL: https://codereview.chromium.org/176883013\n" +
199    "\n" +
200    "git-svn-id: svn://svn.chromium.org/blink/trunk@168268 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
201    "</pre>\n" +
202    "</div>\n" +
203    "</content>\n" +
204    "</entry>\n" +
205    "</feed>\n";
206
207 var kExampleCommitDataList = [{
208     "revision": 158545,
209     "title": "Throw SecurityError when setting 'Replaceable' properties cross-origin.",
210     "time": "2013-09-30T20:22:01Z",
211     "summary": "This matches Gecko's behavior for these types of properties.",
212     "author": "mkwst@chromium.org",
213     "reviewer": "jochen@chromium.org",
214     "bugID": [17325],
215     "revertedRevision": undefined
216   },
217   {
218     "revision": 158544,
219     "title": "Fix one more layering violation caught by check-blink-deps",
220     "time": "2013-09-30T19:36:21Z",
221     "summary": "core/platform may not depend on core/ even for testing.",
222     "author": "eseidel@chromium.org",
223     "reviewer": "abarth@chromium.org, abarth",
224     "bugID": [301947],
225     "revertedRevision": undefined
226   },
227   {
228     "revision": 158543,
229     "title": "Update DEPS include_rules after addition of root-level platform directory",
230     "time": "2013-09-30T19:28:49Z",
231     "summary": "These were all failures noticed when running check-blink-deps",
232     "author": "eseidel@chromium.org",
233     "reviewer": "abarth@chromium.org, abarth, abarth",
234     "bugID": [301947],
235     "revertedRevision": undefined
236   },
237   {
238     "revision": 168027,
239     "title": "Mark Skia suppressions for rebasline.",
240     "time": "2014-02-27T14:44:41Z",
241     "summary": "Unreviewed gardening.",
242     "author": "fmalita@chromium.org",
243     "reviewer": "robertphillips@google.com",
244     "bugID": [341448, 344497],
245     "revertedRevision": undefined
246   },
247   {
248     "revision": 168268,
249     "title": "Remove yurys and loislo from WTF watchlist",
250     "time": "2014-03-03T07:23:31Z",
251     "summary": "BUG=None",
252     "author": "yurys@chromium.org",
253     "reviewer": "loislo@chromium.org",
254     "bugID": null,
255     "revertedRevision": undefined
256   }
257 ];
258
259 test("changesetURL", 1, function() {
260     equals(trac.changesetURL(1234), "http://src.chromium.org/viewvc/blink?view=rev&revision=1234");
261 });
262
263 asyncTest("recentCommitData", 3, function() {
264     var simulator = new NetworkSimulator();
265     simulator.xml = function(url)
266     {
267         equals(url, 'http://blink.lc/blink/atom');
268         var parser = new DOMParser();
269         var responseDOM = parser.parseFromString(kExampleCommitDataXML, "application/xml");
270         return Promise.resolve(responseDOM);
271     };
272
273     simulator.runTest(function() {
274         return trac.recentCommitData('trunk', 10).then(function(commitDataList) {
275             $.each(commitDataList, function(index, commitData) {
276                 // Including the entire message makes the deepEqual below to unwieldy.
277                 delete commitData.message;
278             });
279             deepEqual(commitDataList, kExampleCommitDataList);
280         });
281     }).then(start);
282 });
283
284 })();