Projet

Général

Profil

Paste
Télécharger (5,61 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / libraries / simplepie / tests / data / fftests.html @ 41cc1b08

1
<!DOCTYPE HTML>
2
<html>
3
<!--
4
https://bugzilla.mozilla.org/show_bug.cgi?id=377611
5

6
From Firefox Source Code, mozilla.org, licensed under LGPL 2.1:
7

8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
This library is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
Lesser General Public License for more details.
16

17
You should have received a copy of the GNU Lesser General Public
18
License along with this library; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
-->
21
  <head>
22
    <title>Test for feed discovery</title>
23

    
24
    <!-- Straight up standard -->
25
    <link rel="alternate" type="application/atom+xml" title="1" href="/1.atom" />
26
    <link rel="alternate" type="application/rss+xml" title="2" href="/2.rss" />
27
    <link rel="feed" title="3" href="/3.xml" />
28

    
29
    <!-- rel is a space-separated list -->
30
    <link rel=" alternate " type="application/atom+xml" title="4" href="/4.atom" />
31
    <link rel="foo alternate" type="application/atom+xml" title="5" href="/5.atom" />
32
    <link rel="alternate foo" type="application/atom+xml" title="6" href="/6.atom" />
33
    <link rel="foo alternate foo" type="application/atom+xml" title="7" href="/7.atom" />
34
    <link rel="meat feed cake" title="8" href="/8.atom" />
35

    
36
    <!-- rel is case-insensitive -->
37
    <link rel="ALTERNate" type="application/atom+xml" title="9" href="/9.atom" />
38
    <link rel="fEEd" title="10" href="/10.atom" />
39

    
40
    <!-- type can have leading and trailing whitespace -->
41
    <link rel="alternate" type="  application/atom+xml  " title="11" href="/11.atom" />
42

    
43
    <!-- type is case-insensitive -->
44
    <link rel="alternate" type="aPPliCAtion/ATom+xML" title="12" href="/12.atom" />
45

    
46
    <!-- "feed stylesheet" is a feed, though "alternate stylesheet" isn't -->
47
    <link rel="feed stylesheet" title="13" href="/13.atom" />
48

    
49
    <!-- hyphens or letters around rel not allowed -->
50
    <link rel="disabled-alternate" type="application/atom+xml" title="Bogus1" href="/Bogus1" />
51
    <link rel="alternates" type="application/atom+xml" title="Bogus2" href="/Bogus2" />
52
    <link rel=" alternate-like" type="application/atom+xml" title="Bogus3" href="/Bogus3" />
53

    
54
    <!-- don't tolerate text/xml if title includes 'rss' not as a word -->
55
    <link rel="alternate" type="text/xml" title="Bogus4 scissorsshaped" href="/Bogus4" />
56

    
57
    <!-- don't tolerate application/xml if title includes 'rss' not as a word -->
58
    <link rel="alternate" type="application/xml" title="Bogus5 scissorsshaped" href="/Bogus5" />
59

    
60
    <!-- don't tolerate application/rdf+xml if title includes 'rss' not as a word -->
61
    <link rel="alternate" type="application/rdf+xml" title="Bogus6 scissorsshaped" href="/Bogus6" />
62

    
63
    <!-- don't tolerate random types -->
64
    <link rel="alternate" type="text/plain" title="Bogus7 rss" href="/Bogus7" />
65

    
66
    <!-- don't find Atom by title -->
67
    <link rel="foopy" type="application/atom+xml" title="Bogus8 Atom and RSS" href="/Bogus8" />
68

    
69
    <!-- don't find application/rss+xml by title -->
70
    <link rel="goats" type="application/rss+xml" title="Bogus9 RSS and Atom" href="/Bogus9" />
71

    
72
    <!-- don't find application/rdf+xml by title -->
73
    <link rel="alternate" type="application/rdf+xml" title="Bogus10 RSS and Atom" href="/Bogus10" />
74

    
75
    <!-- don't find application/xml by title -->
76
    <link rel="alternate" type="application/xml" title="Bogus11 RSS and Atom" href="/Bogus11" />
77

    
78
    <!-- don't find text/xml by title -->
79
    <link rel="alternate" type="text/xml" title="Bogus12 RSS and Atom" href="/Bogus12" />
80

    
81
    <!-- alternate and stylesheet isn't a feed -->
82
    <link rel="alternate stylesheet" type="application/rss+xml" title="Bogus13 RSS" href="/Bogus13" />
83
  </head>
84
  <body>
85
    <script type="text/javascript">
86
      window.onload = function() {
87
        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
88

89
        var tests = new Array();
90

91
        var currentWindow =
92
        window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
93
                              .getInterface(Components.interfaces.nsIWebNavigation)
94
                              .QueryInterface(Components.interfaces.nsIDocShellTreeItem)
95
                              .rootTreeItem
96
                              .QueryInterface(Components.interfaces.nsIInterfaceRequestor)
97
                              .getInterface(Components.interfaces.nsIDOMWindow);
98
        var browser = currentWindow.gBrowser.selectedBrowser;
99

100
        var discovered = browser.feeds;
101
        tests.push({ check: discovered.length > 0,
102
                     message: "some feeds should be discovered" });
103

104
        var feeds = [];
105

106
        for each (var aFeed in discovered) {
107
          feeds[aFeed.href] = true;
108
        }
109

110
        for each (var aLink in document.getElementsByTagName("link")) {
111
          // ignore real stylesheets, and anything without an href property
112
          if (aLink.type != "text/css" && aLink.href) {
113
            if (/bogus/i.test(aLink.title)) {
114
              tests.push({ check: !feeds[aLink.href],
115
                           message: "don't discover " + aLink.href });
116
            } else {
117
              tests.push({ check: feeds[aLink.href],
118
                           message: "should discover " + aLink.href });
119
            }
120
          }
121
        }
122
        window.arguments[0].tests = tests;
123
        window.close();
124
      }
125
    </script>
126
  </body>
127
</html>
128