OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright (C) 2013 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 | |
27 (function () { | |
28 | |
29 module("rollbot"); | |
30 | |
31 var kSearchResults = { | |
32 "cursor": "long_string_we_call_cursor", | |
33 "results": [ | |
34 { | |
35 "description": "Blink roll 151668:151677\n\nhttp:\/\/build.chromium.org\/f
\/chromium\/perf\/dashboard\/ui\/changelog_blink.html?url=\/trunk&range=151669:1
51677&mode=html\nTBR=\nBUG=", | |
36 "cc": [ | |
37 "chromium-reviews@chromium.org", | |
38 ], | |
39 "reviewers": [ | |
40 ], | |
41 "messages": [ | |
42 { | |
43 "sender": "eseidel@chromium.org", | |
44 "recipients": [ | |
45 "eseidel@chromium.org", | |
46 "chromium-reviews@chromium.org", | |
47 ], | |
48 "text": "This roll was automatically created by the Blink AutoRollBot
(crbug.com\/242461).\nInclude STOP in this message, but should be ignored.", | |
49 "disapproval": false, | |
50 "date": "2013-06-03 18:14:34.033780", | |
51 "approval": false | |
52 }, | |
53 ], | |
54 "owner_email": "eseidel@chromium.org", | |
55 "private": false, | |
56 "base_url": "https:\/\/chromium.googlesource.com\/chromium\/src.git@master
", | |
57 "owner": "eseidel", | |
58 "subject": "Blink roll 151668:151677", | |
59 "created": "2013-06-03 18:14:28.926040", | |
60 "patchsets": [ | |
61 1 | |
62 ], | |
63 "modified": "2013-06-03 18:14:46.869990", | |
64 "closed": false, | |
65 "commit": true, | |
66 "issue": 16337011 | |
67 }, | |
68 { | |
69 "description": "Add --json-output option to layout_test_wrapper.py\n\nBUG=
238381", | |
70 "cc": [ | |
71 "chromium-reviews@chromium.org", | |
72 ], | |
73 "reviewers": [ | |
74 "iannucci@chromium.org" | |
75 ], | |
76 "messages": [ | |
77 { | |
78 "sender": "eseidel@chromium.org", | |
79 "recipients": [ | |
80 "eseidel@chromium.org", | |
81 "chromium-reviews@chromium.org", | |
82 ], | |
83 "text": "I'm not quite sure how to test this code.\n\nI'm also ", | |
84 "disapproval": false, | |
85 "date": "2013-05-30 23:42:39.309160", | |
86 "approval": false | |
87 }, | |
88 ] | |
89 } | |
90 ] | |
91 }; | |
92 | |
93 var kStoppedIssue = { | |
94 "description": "Blink roll 152079:152080\n\nhttp:\/\/build.chromium.org\/f\/ch
romium\/perf\/dashboard\/ui\/changelog_blink.html?url=\/trunk&range=152080:15208
0&mode=html\nTBR=\nBUG=", | |
95 "cc": [ | |
96 "chromium-reviews@chromium.org", | |
97 "none (channel is sheriff)@chromium.org" | |
98 ], | |
99 "reviewers": [ | |
100 "ilevy@chromium.org" | |
101 ], | |
102 "messages": [ | |
103 { | |
104 "sender": "eseidel@chromium.org", | |
105 "recipients": [ | |
106 "eseidel@chromium.org", | |
107 "chromium-reviews@chromium.org", | |
108 ], | |
109 "text": "This string has STOP in it, but should be ignored as the first me
ssage.", | |
110 "date": "2013-06-09 06:47:35.825820", | |
111 }, | |
112 { | |
113 "sender": "commit-bot@chromium.org", | |
114 "recipients": [ | |
115 "eseidel@chromium.org", | |
116 "chromium-reviews@chromium.org", | |
117 ], | |
118 "text": "CQ is trying da patch. Follow status at\nhttps:\/\/chromium-statu
s.appspot.com\/cq\/eseidel@chromium.org\/16606004\/1", | |
119 "date": "2013-06-09 06:47:45.529170", | |
120 }, | |
121 { | |
122 "sender": "ilevy@chromium.org", | |
123 "recipients": [ | |
124 "eseidel@chromium.org", | |
125 "ilevy@chromium.org", | |
126 "chromium-reviews@chromium.org", | |
127 ], | |
128 "text": "STOP", | |
129 "date": "2013-06-09 07:59:48.280360", | |
130 }, | |
131 { | |
132 "sender": "eseidel@chromium.org", | |
133 "recipients": [ | |
134 "eseidel@chromium.org", | |
135 "ilevy@chromium.org", | |
136 "chromium-reviews@chromium.org", | |
137 ], | |
138 "text": "Rollbot was stopped by the presence of \"STOP\" in an earlier com
ment on this issue.\n", | |
139 "date": "2013-06-10 19:35:44.710470", | |
140 } | |
141 ], | |
142 "owner_email": "eseidel@chromium.org", | |
143 "private": false, | |
144 "base_url": "https:\/\/chromium.googlesource.com\/chromium\/src.git@master", | |
145 "owner": "eseidel", | |
146 "subject": "Blink roll 152079:152080", | |
147 "created": "2013-06-09 06:47:31.518010", | |
148 "patchsets": [ | |
149 1 | |
150 ], | |
151 "modified": "2013-06-10 19:56:59.618710", | |
152 "closed": true, | |
153 "commit": false, | |
154 "issue": 16606004 | |
155 }; | |
156 | |
157 asyncTest("fetchCurrentRoll", 6, function() { | |
158 var simulator = new NetworkSimulator(); | |
159 simulator.json = function(url) | |
160 { | |
161 return Promise.resolve(kSearchResults); | |
162 }; | |
163 | |
164 simulator.runTest(function() { | |
165 rollbot.fetchCurrentRoll().then(function(roll) { | |
166 equals(roll.issue, 16337011); | |
167 equals(roll.url, "https://codereview.chromium.org/16337011"); | |
168 equals(roll.isStopped, false); | |
169 equals(roll.fromRevision, "151668"); | |
170 equals(roll.toRevision, "151677"); | |
171 }); | |
172 }).then(start); | |
173 }); | |
174 | |
175 test("_isRollbotStopped", 1, function() { | |
176 equals(true, rollbot._isRollbotStopped(kStoppedIssue)); | |
177 }); | |
178 | |
179 })(); | |
OLD | NEW |