OLD | NEW |
| (Empty) |
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("model"); | |
29 | |
30 var kExampleCommitDataXML = | |
31 '<?xml version="1.0"?>\n\n' + | |
32 '<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">\n\n' + | |
33 ' \n\n' + | |
34 '\n\n' + | |
35 ' <channel>\n\n' + | |
36 ' <title>Revisions of /trunk</title>\n\n' + | |
37 ' <link>http://trac.webkit.org/log/trunk?rev=92362</link>\n\n' + | |
38 ' <description>Trac Log - Revisions of /trunk</description>\n\n' + | |
39 ' <language>en-US</language>\n\n' + | |
40 ' <generator>Trac 0.11.7</generator>\n\n' + | |
41 ' <image>\n\n' + | |
42 ' <title>WebKit</title>\n\n' + | |
43 ' <url>http://trac.webkit.org/chrome/site/icon.png</url>\n\n' + | |
44 ' <link>http://trac.webkit.org/log/trunk?rev=92362</link>\n\n' + | |
45 ' </image>\n\n' + | |
46 ' <item>\n' + | |
47 ' <author>commit-queue@webkit.org</author>\n' + | |
48 ' <pubDate>Wed, 03 Aug 2011 04:26:52 GMT</pubDate>\n' + | |
49 ' <title>Revision 92259: Unreviewed, rolling out r92256.\n' + | |
50 'http://trac.webkit.org/changeset/92256 ...</title>\n' + | |
51 ' <link>http://trac.webkit.org/changeset/92259/trunk</link>\n' + | |
52 ' <guid isPermaLink="false">http://trac.webkit.org/changeset/92259/trun
k</guid>\n' + | |
53 ' <description><p>\n' + | |
54 'Unreviewed, rolling out <a class="changeset" href="http://trac.webkit.or
g/changeset/92256" title="Make EventDispatchMediator RefCounted. ...">r92256&
lt;/a>.\n' + | |
55 '<a class="ext-link" href="http://trac.webkit.org/changeset/92256"><
;span class="icon"> </span>http://trac.webkit.org/changeset/92256</a
>\n' + | |
56 '<a class="ext-link" href="https://bugs.webkit.org/show_bug.cgi?id=65593"
><span class="icon"> </span>https://bugs.webkit.org/show_bug.cgi?
id=65593</a>\n' + | |
57 '</p>\n' + | |
58 '<p>\n' + | |
59 'Causing tons of crashes on the chromium win bots (Requested by\n' + | |
60 'jamesr on #webkit).\n' + | |
61 '</p>\n' + | |
62 '<p>\n' + | |
63 'Patch by Sheriff Bot &lt;<a class="mail-link" href="mailto:webkit.re
view.bot@gmail.com"><span class="icon"> </span>webkit.review.bot@
gmail.com</a>&gt; on 2011-08-02\n' + | |
64 '</p>\n' + | |
65 '<p>\n' + | |
66 '* dom/Event.cpp:\n' + | |
67 '* dom/Event.h:\n' + | |
68 '* dom/EventDispatcher.cpp:\n' + | |
69 '(WebCore::EventDispatcher::dispatchEvent):\n' + | |
70 '* dom/EventDispatcher.h:\n' + | |
71 '* dom/KeyboardEvent.cpp:\n' + | |
72 '* dom/KeyboardEvent.h:\n' + | |
73 '* dom/MouseEvent.cpp:\n' + | |
74 '* dom/MouseEvent.h:\n' + | |
75 '* dom/Node.cpp:\n' + | |
76 '(WebCore::Node::dispatchEvent):\n' + | |
77 '(WebCore::Node::dispatchKeyEvent):\n' + | |
78 '(WebCore::Node::dispatchMouseEvent):\n' + | |
79 '(WebCore::Node::dispatchWheelEvent):\n' + | |
80 '* dom/WheelEvent.cpp:\n' + | |
81 '* dom/WheelEvent.h:\n' + | |
82 '</p>\n' + | |
83 '</description>\n' + | |
84 ' <category>Log</category>\n' + | |
85 ' </item><item>\n' + | |
86 ' <author>macpherson@chromium.org</author>\n\n' + | |
87 ' <pubDate>Thu, 04 Aug 2011 02:09:19 GMT</pubDate>\n\n' + | |
88 ' <title>Revision 92256: Support cast between CSSPrimitiveValue and EBo
xSizing, use in ...</title>\n\n' + | |
89 ' <link>http://trac.webkit.org/changeset/92256/trunk</link>\n\n' + | |
90 ' <guid isPermaLink="false">http://trac.webkit.org/changeset/92256/trun
k</guid>\n\n' + | |
91 ' <description><p>\n\n' + | |
92 'Support cast between CSSPrimitiveValue and EBoxSizing, use in CSSStyleSelec
tor.\n\n' + | |
93 '<a class="ext-link" href="https://bugs.webkit.org/show_bug.cgi?id=65657"
><span class="icon"> </span>https://bugs.webkit.org/show_bug.cgi?
id=65657</a>\n\n' + | |
94 '</p>\n\n' + | |
95 '<p>\n\n' + | |
96 'Reviewed by Simon Fraser.\n\n' + | |
97 '</p>\n\n' + | |
98 '<p>\n\n' + | |
99 'No new tests / refactoring only.\n\n' + | |
100 '</p>\n\n' + | |
101 '<p>\n\n' + | |
102 '* css/CSSPrimitiveValueMappings.h:\n\n' + | |
103 '(WebCore::CSSPrimitiveValue::CSSPrimitiveValue):\n\n' + | |
104 'Implement cast from EBoxSizing.\n' + | |
105 '(WebCore::CSSPrimitiveValue::operator EBoxSizing):\n' + | |
106 'Implement cast to EBoxSizing.\n' + | |
107 '* css/CSSStyleSelector.cpp:\n' + | |
108 '(WebCore::CSSStyleSelector::applyProperty):\n' + | |
109 'Use appropriate macro to simplify code using cast.\n' + | |
110 '</p>\n' + | |
111 '</description>\n' + | |
112 ' <category>Log</category>\n' + | |
113 ' </item>\n' + | |
114 ' </channel>\n' + | |
115 '</rss>\n' | |
116 | |
117 test("rebaselineQueue", 3, function() { | |
118 var queue = model.takeRebaselineQueue(); | |
119 deepEqual(queue, []); | |
120 model.queueForRebaseline('failureInfo1'); | |
121 model.queueForRebaseline('failureInfo2'); | |
122 var queue = model.takeRebaselineQueue(); | |
123 deepEqual(queue, ['failureInfo1', 'failureInfo2']); | |
124 var queue = model.takeRebaselineQueue(); | |
125 deepEqual(queue, []); | |
126 }); | |
127 | |
128 test("rebaselineQueue", 3, function() { | |
129 var queue = model.takeExpectationUpdateQueue(); | |
130 deepEqual(queue, []); | |
131 model.queueForExpectationUpdate('failureInfo1'); | |
132 model.queueForExpectationUpdate('failureInfo2'); | |
133 var queue = model.takeExpectationUpdateQueue(); | |
134 deepEqual(queue, ['failureInfo1', 'failureInfo2']); | |
135 var queue = model.takeExpectationUpdateQueue(); | |
136 deepEqual(queue, []); | |
137 }); | |
138 | |
139 test("updateRecentCommits", 2, function() { | |
140 var simulator = new NetworkSimulator(); | |
141 | |
142 simulator.get = function(url, callback) | |
143 { | |
144 simulator.scheduleCallback(function() { | |
145 var parser = new DOMParser(); | |
146 var responseDOM = parser.parseFromString(kExampleCommitDataXML, "app
lication/xml"); | |
147 callback(responseDOM); | |
148 }); | |
149 }; | |
150 | |
151 simulator.runTest(function() { | |
152 model.updateRecentCommits(function() { | |
153 var recentCommits = model.state.recentCommits; | |
154 delete model.state.recentCommits; | |
155 $.each(recentCommits, function(index, commitData) { | |
156 delete commitData.message; | |
157 }); | |
158 deepEqual(recentCommits, [{ | |
159 "revision": 92259, | |
160 "title": "Revision 92259: Unreviewed, rolling out r92256.\nhttp:
//trac.webkit.org/changeset/92256 ...", | |
161 "time": "Wed, 03 Aug 2011 04:26:52 GMT", | |
162 "summary": "Unreviewed, rolling out r92256.", | |
163 "author": "Sheriff Bot", | |
164 "reviewer": null, | |
165 "bugID": 65593, | |
166 "revertedRevision": 92256 | |
167 }, { | |
168 "revision": 92256, | |
169 "title": "Revision 92256: Support cast between CSSPrimitiveValue
and EBoxSizing, use in ...", | |
170 "time": "Thu, 04 Aug 2011 02:09:19 GMT", | |
171 "summary": "Support cast between CSSPrimitiveValue and EBoxSizin
g, use in CSSStyleSelector.", | |
172 "author": "macpherson@chromium.org", | |
173 "reviewer": "Simon Fraser", | |
174 "bugID": 65657, | |
175 "revertedRevision": undefined, | |
176 "wasReverted": true | |
177 }]); | |
178 }); | |
179 }); | |
180 }); | |
181 | |
182 test("commitDataListForRevisionRange", 6, function() { | |
183 var simulator = new NetworkSimulator(); | |
184 | |
185 simulator.get = function(url, callback) | |
186 { | |
187 simulator.scheduleCallback(function() { | |
188 var parser = new DOMParser(); | |
189 var responseDOM = parser.parseFromString(kExampleCommitDataXML, "app
lication/xml"); | |
190 callback(responseDOM); | |
191 }); | |
192 }; | |
193 | |
194 simulator.runTest(function() { | |
195 model.updateRecentCommits(function() { | |
196 function extractBugIDs(commitData) | |
197 { | |
198 return commitData.bugID; | |
199 } | |
200 | |
201 deepEqual(model.commitDataListForRevisionRange(92259, 92259).map(ext
ractBugIDs), [65593]); | |
202 deepEqual(model.commitDataListForRevisionRange(92256, 92259).map(ext
ractBugIDs), [65657, 65593]); | |
203 deepEqual(model.commitDataListForRevisionRange(92259, 92256).map(ext
ractBugIDs), []); | |
204 deepEqual(model.commitDataListForRevisionRange(0, 92256).map(extract
BugIDs), [65657]); | |
205 deepEqual(model.commitDataListForRevisionRange(92256, 0).map(extract
BugIDs), []); | |
206 delete model.state.recentCommits; | |
207 }); | |
208 }); | |
209 }); | |
210 | |
211 test("buildersInFlightForRevision", 3, function() { | |
212 var unmock = model.state.resultsByBuilder; | |
213 model.state.resultsByBuilder = { | |
214 'Mr. Beasley': {revision: '5'}, | |
215 'Mr Dixon': {revision: '1'}, | |
216 'Mr. Sabatini': {revision: '4'}, | |
217 'Bob': {revision: '6'} | |
218 }; | |
219 deepEqual(model.buildersInFlightForRevision(1), {}); | |
220 deepEqual(model.buildersInFlightForRevision(3), { | |
221 "Mr Dixon": { | |
222 "actual": "BUILDING" | |
223 } | |
224 }); | |
225 deepEqual(model.buildersInFlightForRevision(10), { | |
226 "Mr. Beasley": { | |
227 "actual": "BUILDING" | |
228 }, | |
229 "Mr Dixon": { | |
230 "actual": "BUILDING" | |
231 }, | |
232 "Mr. Sabatini": { | |
233 "actual": "BUILDING" | |
234 }, | |
235 "Bob": { | |
236 "actual": "BUILDING" | |
237 } | |
238 }); | |
239 model.state.resultsByBuilder = unmock; | |
240 }); | |
241 | |
242 test("latestRevisionWithNoBuildersInFlight", 1, function() { | |
243 var unmock = model.state.resultsByBuilder; | |
244 model.state.resultsByBuilder = { | |
245 'Mr. Beasley': { }, | |
246 'Mr Dixon': {revision: '2'}, | |
247 'Mr. Sabatini': {revision: '4'}, | |
248 'Bob': {revision: '6'} | |
249 }; | |
250 equals(model.latestRevisionWithNoBuildersInFlight(), 2); | |
251 model.state.resultsByBuilder = unmock; | |
252 }); | |
253 | |
254 })(); | |
OLD | NEW |