| /* |
| * Copyright (C) 2011 Google Inc. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| * modification, are permitted provided that the following conditions |
| * are met: |
| * 1. Redistributions of source code must retain the above copyright |
| * notice, this list of conditions and the following disclaimer. |
| * 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
| * |
| * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' |
| * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS |
| * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
| * THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| |
| (function () { |
| |
| module("bugzilla"); |
| |
| var kExampleResponseXML = |
| '<?xml version="1.0" encoding="UTF-8"?>' + |
| '<feed xmlns="http://www.w3.org/2005/Atom">' + |
| ' <title>Bugzilla Bugs</title>' + |
| ' <link rel="alternate" type="text/html"' + |
| ' href="https://bugs.webkit.org/buglist.cgi?bug_status=REOPENED&bug_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&type0-0-1=substring&type0-0-2=substring&type0-0-3=substring&type0-0-4=substring&value-1-0-0=REOPENED%2CNEW%2CASSIGNED%2CUNCONFIRMED&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"/>' + |
| ' <link rel="self" type="application/atom+xml"' + |
| ' href="https://bugs.webkit.org/buglist.cgi?bug_status=REOPENED&bug_status=NEW&bug_status=ASSIGNED&bug_status=UNCONFIRMED&ctype=atom&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&type0-0-1=substring&type0-0-2=substring&type0-0-3=substring&type0-0-4=substring&value-1-0-0=REOPENED%2CNEW%2CASSIGNED%2CUNCONFIRMED&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"/>' + |
| ' <updated>2011-08-04T00:22:49Z</updated>' + |
| ' <id>https://bugs.webkit.org/buglist.cgi?bug_status=REOPENED&bug_status=NEW&bug_status=ASSIGNED&bug_status=UNCONFIRMED&ctype=atom&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&type0-0-1=substring&type0-0-2=substring&type0-0-3=substring&type0-0-4=substring&value-1-0-0=REOPENED%2CNEW%2CASSIGNED%2CUNCONFIRMED&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</id>' + |
| '' + |
| ' <entry>' + |
| ' <title>[Bug 65654] Add missing license blocks to garden-o-matic</title>' + |
| ' <link rel="alternate" type="text/html"' + |
| ' href="https://bugs.webkit.org/show_bug.cgi?id=65654"/>' + |
| ' <id>https://bugs.webkit.org/show_bug.cgi?id=65654</id>' + |
| ' <author>' + |
| ' <name>Adam Barth</name>' + |
| ' </author>' + |
| ' <updated>2011-08-04T00:22:26Z</updated> ' + |
| ' <summary type="html">' + |
| ' ' + |
| ' <table>' + |
| ' <tr>' + |
| ' <th>Field</th><th>Value</th>' + |
| ' </tr><tr class="bz_feed_product">' + |
| ' <td>Product</td>' + |
| ' <td>WebKit</td>' + |
| ' </tr><tr class="bz_feed_component">' + |
| ' <td>Component</td>' + |
| ' <td>New Bugs</td>' + |
| ' </tr><tr class="bz_feed_assignee">' + |
| ' <td>Assignee</td>' + |
| ' <td>Adam Barth</td>' + |
| ' </tr><tr class="bz_feed_reporter">' + |
| ' <td>Reporter</td>' + |
| ' <td>Adam Barth</td>' + |
| ' </tr><tr class="bz_feed_bug_status">' + |
| ' <td>Status</td>' + |
| ' <td>NEW</td>' + |
| ' </tr><tr class="bz_feed_resolution">' + |
| ' <td>Resolution </td>' + |
| ' <td></td>' + |
| ' </tr><tr class="bz_feed_priority">' + |
| ' <td>Priority</td>' + |
| ' <td>P2</td>' + |
| ' </tr><tr class="bz_feed_severity">' + |
| ' <td>Severity </td>' + |
| ' <td>Normal</td>' + |
| ' </tr><tr class="bz_feed_creation_date">' + |
| ' <td>Opened</td>' + |
| ' <td>16:21:52</td>' + |
| ' </tr><tr class="bz_feed_changed_date">' + |
| ' <td>Changed</td>' + |
| ' <td>16:22:26</td>' + |
| ' </tr>' + |
| ' </table>' + |
| ' </summary>' + |
| ' </entry>' + |
| ' <entry>' + |
| ' <title>[Bug 65653] garden-o-matic needs a way to mock out the network</title>' + |
| ' <link rel="alternate" type="text/html"' + |
| ' href="https://bugs.webkit.org/show_bug.cgi?id=65653"/>' + |
| ' <id>https://bugs.webkit.org/show_bug.cgi?id=65653</id>' + |
| ' <author>' + |
| ' <name>Adam Barth</name>' + |
| ' </author>' + |
| ' <updated>2011-08-04T00:22:49Z</updated> ' + |
| ' <summary type="html">' + |
| ' ' + |
| ' <table>' + |
| ' <tr>' + |
| ' <th>Field</th><th>Value</th>' + |
| ' </tr><tr class="bz_feed_product">' + |
| ' <td>Product</td>' + |
| ' <td>WebKit</td>' + |
| ' </tr><tr class="bz_feed_component">' + |
| ' <td>Component</td>' + |
| ' <td>New Bugs</td>' + |
| ' </tr><tr class="bz_feed_assignee">' + |
| ' <td>Assignee</td>' + |
| ' <td>Adam Barth</td>' + |
| ' </tr><tr class="bz_feed_reporter">' + |
| ' <td>Reporter</td>' + |
| ' <td>Adam Barth</td>' + |
| ' </tr><tr class="bz_feed_bug_status">' + |
| ' <td>Status</td>' + |
| ' <td>NEW</td>' + |
| ' </tr><tr class="bz_feed_resolution">' + |
| ' <td>Resolution </td>' + |
| ' <td></td>' + |
| ' </tr><tr class="bz_feed_priority">' + |
| ' <td>Priority</td>' + |
| ' <td>P2</td>' + |
| ' </tr><tr class="bz_feed_severity">' + |
| ' <td>Severity </td>' + |
| ' <td>Normal</td>' + |
| ' </tr><tr class="bz_feed_creation_date">' + |
| ' <td>Opened</td>' + |
| ' <td>16:16:44</td>' + |
| ' </tr><tr class="bz_feed_changed_date">' + |
| ' <td>Changed</td>' + |
| ' <td>16:22:49</td>' + |
| ' </tr>' + |
| ' </table>' + |
| ' </summary>' + |
| ' </entry>' + |
| ' <entry>' + |
| ' <title>[Bug 65650] Use failureInfo more pervasively in garden-o-matic</title>' + |
| ' <link rel="alternate" type="text/html"' + |
| ' href="https://bugs.webkit.org/show_bug.cgi?id=65650"/>' + |
| ' <id>https://bugs.webkit.org/show_bug.cgi?id=65650</id>' + |
| ' <author>' + |
| ' <name>Adam Barth</name>' + |
| ' </author>' + |
| ' <updated>2011-08-03T23:40:34Z</updated> ' + |
| ' <summary type="html">' + |
| ' ' + |
| ' <table>' + |
| ' <tr>' + |
| ' <th>Field</th><th>Value</th>' + |
| ' </tr><tr class="bz_feed_product">' + |
| ' <td>Product</td>' + |
| ' <td>WebKit</td>' + |
| ' </tr><tr class="bz_feed_component">' + |
| ' <td>Component</td>' + |
| ' <td>New Bugs</td>' + |
| ' </tr><tr class="bz_feed_assignee">' + |
| ' <td>Assignee</td>' + |
| ' <td>Adam Barth</td>' + |
| ' </tr><tr class="bz_feed_reporter">' + |
| ' <td>Reporter</td>' + |
| ' <td>Adam Barth</td>' + |
| ' </tr><tr class="bz_feed_bug_status">' + |
| ' <td>Status</td>' + |
| ' <td>NEW</td>' + |
| ' </tr><tr class="bz_feed_resolution">' + |
| ' <td>Resolution </td>' + |
| ' <td></td>' + |
| ' </tr><tr class="bz_feed_priority">' + |
| ' <td>Priority</td>' + |
| ' <td>P2</td>' + |
| ' </tr><tr class="bz_feed_severity">' + |
| ' <td>Severity </td>' + |
| ' <td>Normal</td>' + |
| ' </tr><tr class="bz_feed_creation_date">' + |
| ' <td>Opened</td>' + |
| ' <td>15:35:55</td>' + |
| ' </tr><tr class="bz_feed_changed_date">' + |
| ' <td>Changed</td>' + |
| ' <td>15:40:34</td>' + |
| ' </tr>' + |
| ' </table>' + |
| ' </summary>' + |
| ' </entry>' + |
| '</feed>' |
| |
| test("quickSearch", 3, function() { |
| var simulator = new NetworkSimulator(); |
| |
| var requestedURLs = []; |
| simulator.get = function(url, callback) |
| { |
| requestedURLs.push(url); |
| simulator.scheduleCallback(function() { |
| var parser = new DOMParser(); |
| var responseDOM = parser.parseFromString(kExampleResponseXML, "application/xml"); |
| callback(responseDOM); |
| }); |
| }; |
| |
| simulator.runTest(function() { |
| bugzilla.quickSearch('garden-o-matic', function(bugs) { |
| deepEqual(bugs, [{ |
| "title": "[Bug 65654] Add missing license blocks to garden-o-matic", |
| "url": "https://bugs.webkit.org/show_bug.cgi?id=65654", |
| "status": "NEW" |
| }, { |
| "title": "[Bug 65653] garden-o-matic needs a way to mock out the network", |
| "url": "https://bugs.webkit.org/show_bug.cgi?id=65653", |
| "status": "NEW" |
| }, { |
| "title": "[Bug 65650] Use failureInfo more pervasively in garden-o-matic", |
| "url": "https://bugs.webkit.org/show_bug.cgi?id=65650", |
| "status": "NEW" |
| }]); |
| }); |
| }); |
| |
| deepEqual(requestedURLs, [ |
| "https://bugs.webkit.org/buglist.cgi?ctype=rss&order=bugs.bug_id+desc&quicksearch=garden-o-matic", |
| ]); |
| }); |
| |
| test("isOpenStatus", 6, function() { |
| ok(bugzilla.isOpenStatus('UNCONFIRMED')); |
| ok(bugzilla.isOpenStatus('NEW')); |
| ok(bugzilla.isOpenStatus('ASSIGNED')); |
| ok(bugzilla.isOpenStatus('REOPENED')); |
| ok(!bugzilla.isOpenStatus('FIXED')); |
| ok(!bugzilla.isOpenStatus('VERIFIED')); |
| }); |
| |
| })(); |