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 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" +
36 "<title>Throw SecurityError when setting 'Replaceable' properties cross-origin.</title>\n" +
37 "<updated>2013-09-30T20:22:01Z</updated>\n" +
39 "<name>mkwst@chromium.org</name>\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" +
48 "R=jochen@chromium.org\n" +
49 "CC=abarth@chromium.org\n" +
51 "Review URL: https://chromiumcodereview.appspot.com/25022002\n" +
53 "git-svn-id: svn://svn.chromium.org/blink/trunk@3 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
57 "<title>Fix one more layering violation caught by check-blink-deps</title>\n" +
58 "<updated>2013-09-30T19:36:21Z</updated>\n" +
60 "<name>eseidel@chromium.org</name>\n" +
62 "<published>2013-09-30T19:36:21Z</published>\n" +
63 "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?id=51e5c70050dcb0980eb31f112d0cd948f3ece820'/>\n" +
64 "<id>51e5c70050dcb0980eb31f112d0cd948f3ece820</id>\n" +
65 "<content type='text'>\n" +
66 "core/platform may not depend on core/ even for testing.\n" +
69 "R=abarth@chromium.org, abarth\n" +
71 "Review URL: https://codereview.chromium.org/25284004\n" +
73 "git-svn-id: svn://svn.chromium.org/blink/trunk@2 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
77 "<title>Update DEPS include_rules after addition of root-level platform directory</title>\n" +
78 "<updated>2013-09-30T19:28:49Z</updated>\n" +
80 "<name>eseidel@chromium.org</name>\n" +
82 "<published>2013-09-30T19:28:49Z</published>\n" +
83 "<link rel='alternate' type='text/html' href='http://blink.lc/blink/commit/?id=227add0156e8ab272abcd3368dfc0b5a91f35749'/>\n" +
84 "<id>227add0156e8ab272abcd3368dfc0b5a91f35749</id>\n" +
85 "<content type='text'>\n" +
86 "These were all failures noticed when running check-blink-deps\n" +
88 "R=abarth@chromium.org, abarth\n" +
91 "Review URL: https://codereview.chromium.org/25275005\n" +
93 "git-svn-id: svn://svn.chromium.org/blink/trunk@1 bbb929c8-8fbe-4397-9dbb-9b2b20218538\n" +
98 test("rebaselineQueue", 3, function() {
99 var queue = model.takeRebaselineQueue();
100 deepEqual(queue, []);
101 model.queueForRebaseline('failureInfo1');
102 model.queueForRebaseline('failureInfo2');
103 var queue = model.takeRebaselineQueue();
104 deepEqual(queue, ['failureInfo1', 'failureInfo2']);
105 var queue = model.takeRebaselineQueue();
106 deepEqual(queue, []);
109 test("rebaselineQueue", 3, function() {
110 var queue = model.takeExpectationUpdateQueue();
111 deepEqual(queue, []);
112 model.queueForExpectationUpdate('failureInfo1');
113 model.queueForExpectationUpdate('failureInfo2');
114 var queue = model.takeExpectationUpdateQueue();
115 deepEqual(queue, ['failureInfo1', 'failureInfo2']);
116 var queue = model.takeExpectationUpdateQueue();
117 deepEqual(queue, []);
120 asyncTest("updateRecentCommits", 2, function() {
121 var simulator = new NetworkSimulator();
123 simulator.xml = function(url)
125 var parser = new DOMParser();
126 var responseDOM = parser.parseFromString(kExampleCommitDataXML, "application/xml");
127 return Promise.resolve(responseDOM);
130 simulator.runTest(function() {
131 model.updateRecentCommits().then(function() {
132 var recentCommits = model.state.recentCommits;
133 delete model.state.recentCommits;
134 $.each(recentCommits, function(index, commitData) {
135 delete commitData.message;
137 deepEqual(recentCommits, [{
139 "title": "Throw SecurityError when setting 'Replaceable' properties cross-origin.",
140 "time": "2013-09-30T20:22:01Z",
141 "summary": "This matches Gecko's behavior for these types of properties.",
142 "author": "mkwst@chromium.org",
143 "reviewer": "jochen@chromium.org",
145 "revertedRevision": undefined,
149 "title": "Fix one more layering violation caught by check-blink-deps",
150 "time": "2013-09-30T19:36:21Z",
151 "summary": "core/platform may not depend on core/ even for testing.",
152 "author": "eseidel@chromium.org",
153 "reviewer": "abarth@chromium.org, abarth",
155 "revertedRevision": undefined
159 "title": "Update DEPS include_rules after addition of root-level platform directory",
160 "time": "2013-09-30T19:28:49Z",
161 "summary": "These were all failures noticed when running check-blink-deps",
162 "author": "eseidel@chromium.org",
163 "reviewer": "abarth@chromium.org, abarth",
165 "revertedRevision": undefined
172 asyncTest("commitDataListForRevisionRange", 6, function() {
173 var simulator = new NetworkSimulator();
175 simulator.xml = function(url)
177 var parser = new DOMParser();
178 var responseDOM = parser.parseFromString(kExampleCommitDataXML, "application/xml");
179 return Promise.resolve(responseDOM);
182 simulator.runTest(function() {
183 model.updateRecentCommits().then(function() {
184 function extractBugIDs(commitData)
186 return commitData.bugID;
189 deepEqual(model.commitDataListForRevisionRange(3, 3).map(extractBugIDs), [[13]]);
190 deepEqual(model.commitDataListForRevisionRange(1, 3).map(extractBugIDs), [[11], [12], [13]]);
191 deepEqual(model.commitDataListForRevisionRange(0, 1).map(extractBugIDs), [[11]]);
192 deepEqual(model.commitDataListForRevisionRange(0, 4).map(extractBugIDs), [[11], [12], [13]]);
193 deepEqual(model.commitDataListForRevisionRange(4, 0).map(extractBugIDs), []);
194 delete model.state.recentCommits;
199 test("buildersInFlightForRevision", 3, function() {
200 var unmock = model.state.resultsByBuilder;
201 model.state.resultsByBuilder = {
202 'Mr. Beasley': {blink_revision: '5'},
203 'Mr Dixon': {blink_revision: '1'},
204 'Mr. Sabatini': {blink_revision: '4'},
205 'Bob': {blink_revision: '6'}
207 deepEqual(model.buildersInFlightForRevision(1), {});
208 deepEqual(model.buildersInFlightForRevision(3), {
213 deepEqual(model.buildersInFlightForRevision(10), {
227 model.state.resultsByBuilder = unmock;
230 test("latestRevisionWithNoBuildersInFlight", 1, function() {
231 var unmock = model.state.resultsByBuilder;
232 model.state.resultsByBuilder = {
234 'Mr Dixon': {blink_revision: '2'},
235 'Mr. Sabatini': {blink_revision: '4'},
236 'Bob': {blink_revision: '6'}
238 equals(model.latestRevisionWithNoBuildersInFlight(), 2);
239 model.state.resultsByBuilder = unmock;