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 "<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-origi
n.</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/?i
d=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=13\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@3 bbb929c8-8fbe-4397-9dbb-9b2
b20218538\n" + | |
54 "</content>\n" + | |
55 "</entry>\n" + | |
56 "<entry>\n" + | |
57 "<title>Fix one more layering violation caught by check-blink-deps</title>\n"
+ | |
58 "<updated>2013-09-30T19:36:21Z</updated>\n" + | |
59 "<author>\n" + | |
60 "<name>eseidel@chromium.org</name>\n" + | |
61 "</author>\n" + | |
62 "<published>2013-09-30T19:36:21Z</published>\n" + | |
63 "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?i
d=51e5c70050dcb0980eb31f112d0cd948f3ece820'/>\n" + | |
64 "<id>51e5c70050dcb0980eb31f112d0cd948f3ece820</id>\n" + | |
65 "<content type='text'>\n" + | |
66 "core/platform may not depend on core/ even for testing.\n" + | |
67 "\n" + | |
68 "BUG=12\n" + | |
69 "R=abarth@chromium.org, abarth\n" + | |
70 "\n" + | |
71 "Review URL: https://codereview.chromium.org/25284004\n" + | |
72 "\n" + | |
73 "git-svn-id: svn://svn.chromium.org/blink/trunk@2 bbb929c8-8fbe-4397-9dbb-9b2
b20218538\n" + | |
74 "</content>\n" + | |
75 "</entry>\n" + | |
76 "<entry>\n" + | |
77 "<title>Update DEPS include_rules after addition of root-level platform direc
tory</title>\n" + | |
78 "<updated>2013-09-30T19:28:49Z</updated>\n" + | |
79 "<author>\n" + | |
80 "<name>eseidel@chromium.org</name>\n" + | |
81 "</author>\n" + | |
82 "<published>2013-09-30T19:28:49Z</published>\n" + | |
83 "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?i
d=227add0156e8ab272abcd3368dfc0b5a91f35749'/>\n" + | |
84 "<id>227add0156e8ab272abcd3368dfc0b5a91f35749</id>\n" + | |
85 "<content type='text'>\n" + | |
86 "These were all failures noticed when running check-blink-deps\n" + | |
87 "\n" + | |
88 "R=abarth@chromium.org, abarth\n" + | |
89 "BUG=11\n" + | |
90 "\n" + | |
91 "Review URL: https://codereview.chromium.org/25275005\n" + | |
92 "\n" + | |
93 "git-svn-id: svn://svn.chromium.org/blink/trunk@1 bbb929c8-8fbe-4397-9dbb-9b2
b20218538\n" + | |
94 "</content>\n" + | |
95 "</entry>\n" + | |
96 "</feed>\n"; | |
97 | |
98 asyncTest("updateRecentCommits", 2, function() { | |
99 var simulator = new NetworkSimulator(); | |
100 | |
101 simulator.xml = function(url) | |
102 { | |
103 var parser = new DOMParser(); | |
104 var responseDOM = parser.parseFromString(kExampleCommitDataXML, "applica
tion/xml"); | |
105 return Promise.resolve(responseDOM); | |
106 }; | |
107 | |
108 simulator.runTest(function() { | |
109 model.updateRecentCommits().then(function() { | |
110 var recentCommits = model.state.recentCommits; | |
111 delete model.state.recentCommits; | |
112 recentCommits.forEach(function(commitData) { | |
113 delete commitData.message; | |
114 }); | |
115 deepEqual(recentCommits, [{ | |
116 "revision": 3, | |
117 "title": "Throw SecurityError when setting 'Replaceable' propert
ies cross-origin.", | |
118 "time": "2013-09-30T20:22:01Z", | |
119 "summary": "This matches Gecko's behavior for these types of pro
perties.", | |
120 "author": "mkwst@chromium.org", | |
121 "reviewer": "jochen@chromium.org", | |
122 "bugID": [13], | |
123 "revertedRevision": undefined, | |
124 }, | |
125 { | |
126 "revision": 2, | |
127 "title": "Fix one more layering violation caught by check-blink-
deps", | |
128 "time": "2013-09-30T19:36:21Z", | |
129 "summary": "core/platform may not depend on core/ even for testi
ng.", | |
130 "author": "eseidel@chromium.org", | |
131 "reviewer": "abarth@chromium.org, abarth", | |
132 "bugID": [12], | |
133 "revertedRevision": undefined | |
134 }, | |
135 { | |
136 "revision": 1, | |
137 "title": "Update DEPS include_rules after addition of root-level
platform directory", | |
138 "time": "2013-09-30T19:28:49Z", | |
139 "summary": "These were all failures noticed when running check-b
link-deps", | |
140 "author": "eseidel@chromium.org", | |
141 "reviewer": "abarth@chromium.org, abarth", | |
142 "bugID": [11], | |
143 "revertedRevision": undefined | |
144 } | |
145 ]); | |
146 }); | |
147 }).then(start); | |
148 }); | |
149 | |
150 asyncTest("commitDataListForRevisionRange", 6, function() { | |
151 var simulator = new NetworkSimulator(); | |
152 | |
153 simulator.xml = function(url) | |
154 { | |
155 var parser = new DOMParser(); | |
156 var responseDOM = parser.parseFromString(kExampleCommitDataXML, "applica
tion/xml"); | |
157 return Promise.resolve(responseDOM); | |
158 }; | |
159 | |
160 simulator.runTest(function() { | |
161 model.updateRecentCommits().then(function() { | |
162 function extractBugIDs(commitData) | |
163 { | |
164 return commitData.bugID; | |
165 } | |
166 | |
167 deepEqual(model.commitDataListForRevisionRange(3, 3).map(extractBugI
Ds), [[13]]); | |
168 deepEqual(model.commitDataListForRevisionRange(1, 3).map(extractBugI
Ds), [[11], [12], [13]]); | |
169 deepEqual(model.commitDataListForRevisionRange(0, 1).map(extractBugI
Ds), [[11]]); | |
170 deepEqual(model.commitDataListForRevisionRange(0, 4).map(extractBugI
Ds), [[11], [12], [13]]); | |
171 deepEqual(model.commitDataListForRevisionRange(4, 0).map(extractBugI
Ds), []); | |
172 delete model.state.recentCommits; | |
173 }); | |
174 }).then(start); | |
175 }); | |
176 | |
177 test("buildersInFlightForRevision", 3, function() { | |
178 var unmock = model.state.resultsByBuilder; | |
179 model.state.resultsByBuilder = { | |
180 'Mr. Beasley': {blink_revision: '5'}, | |
181 'Mr Dixon': {blink_revision: '1'}, | |
182 'Mr. Sabatini': {blink_revision: '4'}, | |
183 'Bob': {blink_revision: '6'} | |
184 }; | |
185 deepEqual(model.buildersInFlightForRevision(1), {}); | |
186 deepEqual(model.buildersInFlightForRevision(3), { | |
187 "Mr Dixon": { | |
188 "actual": "BUILDING" | |
189 } | |
190 }); | |
191 deepEqual(model.buildersInFlightForRevision(10), { | |
192 "Mr. Beasley": { | |
193 "actual": "BUILDING" | |
194 }, | |
195 "Mr Dixon": { | |
196 "actual": "BUILDING" | |
197 }, | |
198 "Mr. Sabatini": { | |
199 "actual": "BUILDING" | |
200 }, | |
201 "Bob": { | |
202 "actual": "BUILDING" | |
203 } | |
204 }); | |
205 model.state.resultsByBuilder = unmock; | |
206 }); | |
207 | |
208 })(); | |
OLD | NEW |