| 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("bugzilla"); | |
| 29 | |
| 30 var kExampleResponseXML = | |
| 31 '<?xml version="1.0" encoding="UTF-8"?>' + | |
| 32 '<feed xmlns="http://www.w3.org/2005/Atom">' + | |
| 33 ' <title>Bugzilla Bugs</title>' + | |
| 34 ' <link rel="alternate" type="text/html"' + | |
| 35 ' href="https://bugs.webkit.org/buglist.cgi?bug_status=REOPENED&b
ug_status=NEW&bug_status=ASSIGNED&bug_status=UNCONFIRMED&field-1-0-0
=bug_status&field0-0-0=product&field0-0-1=component&field0-0-2=short
_desc&field0-0-3=status_whiteboard&field0-0-4=longdesc&query_format=
advanced&remaction=&type-1-0-0=anyexact&type0-0-0=substring&type
0-0-1=substring&type0-0-2=substring&type0-0-3=substring&type0-0-4=su
bstring&value-1-0-0=REOPENED%2CNEW%2CASSIGNED%2CUNCONFIRMED&value0-0-0=g
arden-o-matic&value0-0-1=garden-o-matic&value0-0-2=garden-o-matic&va
lue0-0-3=garden-o-matic&value0-0-4=garden-o-matic"/>' + | |
| 36 ' <link rel="self" type="application/atom+xml"' + | |
| 37 ' href="https://bugs.webkit.org/buglist.cgi?bug_status=REOPENED&b
ug_status=NEW&bug_status=ASSIGNED&bug_status=UNCONFIRMED&ctype=atom&
amp;field-1-0-0=bug_status&field0-0-0=product&field0-0-1=component&f
ield0-0-2=short_desc&field0-0-3=status_whiteboard&field0-0-4=longdesc&am
p;query_format=advanced&remaction=&type-1-0-0=anyexact&type0-0-0=sub
string&type0-0-1=substring&type0-0-2=substring&type0-0-3=substring&a
mp;type0-0-4=substring&value-1-0-0=REOPENED%2CNEW%2CASSIGNED%2CUNCONFIRMED&a
mp;value0-0-0=garden-o-matic&value0-0-1=garden-o-matic&value0-0-2=garden
-o-matic&value0-0-3=garden-o-matic&value0-0-4=garden-o-matic"/>' + | |
| 38 ' <updated>2011-08-04T00:22:49Z</updated>' + | |
| 39 ' <id>https://bugs.webkit.org/buglist.cgi?bug_status=REOPENED&bug_statu
s=NEW&bug_status=ASSIGNED&bug_status=UNCONFIRMED&ctype=atom&fiel
d-1-0-0=bug_status&field0-0-0=product&field0-0-1=component&field0-0-
2=short_desc&field0-0-3=status_whiteboard&field0-0-4=longdesc&query_
format=advanced&remaction=&type-1-0-0=anyexact&type0-0-0=substring&a
mp;type0-0-1=substring&type0-0-2=substring&type0-0-3=substring&type0
-0-4=substring&value-1-0-0=REOPENED%2CNEW%2CASSIGNED%2CUNCONFIRMED&value
0-0-0=garden-o-matic&value0-0-1=garden-o-matic&value0-0-2=garden-o-matic
&value0-0-3=garden-o-matic&value0-0-4=garden-o-matic</id>' + | |
| 40 '' + | |
| 41 ' <entry>' + | |
| 42 ' <title>[Bug 65654] Add missing license blocks to garden-o-matic</title>
' + | |
| 43 ' <link rel="alternate" type="text/html"' + | |
| 44 ' href="https://bugs.webkit.org/show_bug.cgi?id=65654"/>' + | |
| 45 ' <id>https://bugs.webkit.org/show_bug.cgi?id=65654</id>' + | |
| 46 ' <author>' + | |
| 47 ' <name>Adam Barth</name>' + | |
| 48 ' </author>' + | |
| 49 ' <updated>2011-08-04T00:22:26Z</updated> ' + | |
| 50 ' <summary type="html">' + | |
| 51 ' ' + | |
| 52 ' <table>' + | |
| 53 ' <tr>' + | |
| 54 ' <th>Field</th><th>Value</th>' + | |
| 55 ' </tr><tr class="bz_feed_product">' + | |
| 56 ' <td>Product</td>' + | |
| 57 ' <td>WebKit</td>' + | |
| 58 ' </tr><tr class="bz_feed_component">' + | |
| 59 ' <td>Component</td>' + | |
| 60 ' <td>New Bugs</td>' + | |
| 61 ' </tr><tr class="bz_feed_assignee">' + | |
| 62 ' <td>Assignee</td>' + | |
| 63 ' <td>Adam Barth</td>' + | |
| 64 ' </tr><tr class="bz_feed_reporter">' + | |
| 65 ' <td>Reporter</td>' + | |
| 66 ' <td>Adam Barth</td>' + | |
| 67 ' </tr><tr class="bz_feed_bug_status">' + | |
| 68 ' <td>Status</td>' + | |
| 69 ' <td>NEW</td>' + | |
| 70 ' </tr><tr class="bz_feed_resolution">' + | |
| 71 ' <td>Resolution </td>' + | |
| 72 ' <td></td>' + | |
| 73 ' </tr><tr class="bz_feed_priority">' + | |
| 74 ' <td>Priority</td>' + | |
| 75 ' <td>P2</td>' + | |
| 76 ' </tr><tr class="bz_feed_severity">' + | |
| 77 ' <td>Severity </td>' + | |
| 78 ' <td>Normal</td>' + | |
| 79 ' </tr><tr class="bz_feed_creation_date">' + | |
| 80 ' <td>Opened</td>' + | |
| 81 ' <td>16:21:52</td>' + | |
| 82 ' </tr><tr class="bz_feed_changed_date">' + | |
| 83 ' <td>Changed</td>' + | |
| 84 ' <td>16:22:26</td>' + | |
| 85 ' </tr>' + | |
| 86 ' </table>' + | |
| 87 ' </summary>' + | |
| 88 ' </entry>' + | |
| 89 ' <entry>' + | |
| 90 ' <title>[Bug 65653] garden-o-matic needs a way to mock out the network</
title>' + | |
| 91 ' <link rel="alternate" type="text/html"' + | |
| 92 ' href="https://bugs.webkit.org/show_bug.cgi?id=65653"/>' + | |
| 93 ' <id>https://bugs.webkit.org/show_bug.cgi?id=65653</id>' + | |
| 94 ' <author>' + | |
| 95 ' <name>Adam Barth</name>' + | |
| 96 ' </author>' + | |
| 97 ' <updated>2011-08-04T00:22:49Z</updated> ' + | |
| 98 ' <summary type="html">' + | |
| 99 ' ' + | |
| 100 ' <table>' + | |
| 101 ' <tr>' + | |
| 102 ' <th>Field</th><th>Value</th>' + | |
| 103 ' </tr><tr class="bz_feed_product">' + | |
| 104 ' <td>Product</td>' + | |
| 105 ' <td>WebKit</td>' + | |
| 106 ' </tr><tr class="bz_feed_component">' + | |
| 107 ' <td>Component</td>' + | |
| 108 ' <td>New Bugs</td>' + | |
| 109 ' </tr><tr class="bz_feed_assignee">' + | |
| 110 ' <td>Assignee</td>' + | |
| 111 ' <td>Adam Barth</td>' + | |
| 112 ' </tr><tr class="bz_feed_reporter">' + | |
| 113 ' <td>Reporter</td>' + | |
| 114 ' <td>Adam Barth</td>' + | |
| 115 ' </tr><tr class="bz_feed_bug_status">' + | |
| 116 ' <td>Status</td>' + | |
| 117 ' <td>NEW</td>' + | |
| 118 ' </tr><tr class="bz_feed_resolution">' + | |
| 119 ' <td>Resolution </td>' + | |
| 120 ' <td></td>' + | |
| 121 ' </tr><tr class="bz_feed_priority">' + | |
| 122 ' <td>Priority</td>' + | |
| 123 ' <td>P2</td>' + | |
| 124 ' </tr><tr class="bz_feed_severity">' + | |
| 125 ' <td>Severity </td>' + | |
| 126 ' <td>Normal</td>' + | |
| 127 ' </tr><tr class="bz_feed_creation_date">' + | |
| 128 ' <td>Opened</td>' + | |
| 129 ' <td>16:16:44</td>' + | |
| 130 ' </tr><tr class="bz_feed_changed_date">' + | |
| 131 ' <td>Changed</td>' + | |
| 132 ' <td>16:22:49</td>' + | |
| 133 ' </tr>' + | |
| 134 ' </table>' + | |
| 135 ' </summary>' + | |
| 136 ' </entry>' + | |
| 137 ' <entry>' + | |
| 138 ' <title>[Bug 65650] Use failureInfo more pervasively in garden-o-matic</
title>' + | |
| 139 ' <link rel="alternate" type="text/html"' + | |
| 140 ' href="https://bugs.webkit.org/show_bug.cgi?id=65650"/>' + | |
| 141 ' <id>https://bugs.webkit.org/show_bug.cgi?id=65650</id>' + | |
| 142 ' <author>' + | |
| 143 ' <name>Adam Barth</name>' + | |
| 144 ' </author>' + | |
| 145 ' <updated>2011-08-03T23:40:34Z</updated> ' + | |
| 146 ' <summary type="html">' + | |
| 147 ' ' + | |
| 148 ' <table>' + | |
| 149 ' <tr>' + | |
| 150 ' <th>Field</th><th>Value</th>' + | |
| 151 ' </tr><tr class="bz_feed_product">' + | |
| 152 ' <td>Product</td>' + | |
| 153 ' <td>WebKit</td>' + | |
| 154 ' </tr><tr class="bz_feed_component">' + | |
| 155 ' <td>Component</td>' + | |
| 156 ' <td>New Bugs</td>' + | |
| 157 ' </tr><tr class="bz_feed_assignee">' + | |
| 158 ' <td>Assignee</td>' + | |
| 159 ' <td>Adam Barth</td>' + | |
| 160 ' </tr><tr class="bz_feed_reporter">' + | |
| 161 ' <td>Reporter</td>' + | |
| 162 ' <td>Adam Barth</td>' + | |
| 163 ' </tr><tr class="bz_feed_bug_status">' + | |
| 164 ' <td>Status</td>' + | |
| 165 ' <td>NEW</td>' + | |
| 166 ' </tr><tr class="bz_feed_resolution">' + | |
| 167 ' <td>Resolution </td>' + | |
| 168 ' <td></td>' + | |
| 169 ' </tr><tr class="bz_feed_priority">' + | |
| 170 ' <td>Priority</td>' + | |
| 171 ' <td>P2</td>' + | |
| 172 ' </tr><tr class="bz_feed_severity">' + | |
| 173 ' <td>Severity </td>' + | |
| 174 ' <td>Normal</td>' + | |
| 175 ' </tr><tr class="bz_feed_creation_date">' + | |
| 176 ' <td>Opened</td>' + | |
| 177 ' <td>15:35:55</td>' + | |
| 178 ' </tr><tr class="bz_feed_changed_date">' + | |
| 179 ' <td>Changed</td>' + | |
| 180 ' <td>15:40:34</td>' + | |
| 181 ' </tr>' + | |
| 182 ' </table>' + | |
| 183 ' </summary>' + | |
| 184 ' </entry>' + | |
| 185 '</feed>' | |
| 186 | |
| 187 test("quickSearch", 3, function() { | |
| 188 var simulator = new NetworkSimulator(); | |
| 189 | |
| 190 var requestedURLs = []; | |
| 191 simulator.get = function(url, callback) | |
| 192 { | |
| 193 requestedURLs.push(url); | |
| 194 simulator.scheduleCallback(function() { | |
| 195 var parser = new DOMParser(); | |
| 196 var responseDOM = parser.parseFromString(kExampleResponseXML, "appli
cation/xml"); | |
| 197 callback(responseDOM); | |
| 198 }); | |
| 199 }; | |
| 200 | |
| 201 simulator.runTest(function() { | |
| 202 bugzilla.quickSearch('garden-o-matic', function(bugs) { | |
| 203 deepEqual(bugs, [{ | |
| 204 "title": "[Bug 65654] Add missing license blocks to garden-o-mat
ic", | |
| 205 "url": "https://bugs.webkit.org/show_bug.cgi?id=65654", | |
| 206 "status": "NEW" | |
| 207 }, { | |
| 208 "title": "[Bug 65653] garden-o-matic needs a way to mock out the
network", | |
| 209 "url": "https://bugs.webkit.org/show_bug.cgi?id=65653", | |
| 210 "status": "NEW" | |
| 211 }, { | |
| 212 "title": "[Bug 65650] Use failureInfo more pervasively in garden
-o-matic", | |
| 213 "url": "https://bugs.webkit.org/show_bug.cgi?id=65650", | |
| 214 "status": "NEW" | |
| 215 }]); | |
| 216 }); | |
| 217 }); | |
| 218 | |
| 219 deepEqual(requestedURLs, [ | |
| 220 "https://bugs.webkit.org/buglist.cgi?ctype=rss&order=bugs.bug_id+desc&qu
icksearch=garden-o-matic", | |
| 221 ]); | |
| 222 }); | |
| 223 | |
| 224 test("isOpenStatus", 6, function() { | |
| 225 ok(bugzilla.isOpenStatus('UNCONFIRMED')); | |
| 226 ok(bugzilla.isOpenStatus('NEW')); | |
| 227 ok(bugzilla.isOpenStatus('ASSIGNED')); | |
| 228 ok(bugzilla.isOpenStatus('REOPENED')); | |
| 229 ok(!bugzilla.isOpenStatus('FIXED')); | |
| 230 ok(!bugzilla.isOpenStatus('VERIFIED')); | |
| 231 }); | |
| 232 | |
| 233 })(); | |
| OLD | NEW |