summaryrefslogtreecommitdiffstats
path: root/browser/components/feeds/test/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/feeds/test/chrome')
-rw-r--r--browser/components/feeds/test/chrome/.eslintrc.js7
-rw-r--r--browser/components/feeds/test/chrome/chrome.ini10
-rw-r--r--browser/components/feeds/test/chrome/sample_feed.atom23
-rw-r--r--browser/components/feeds/test/chrome/test_423060.xul56
-rw-r--r--browser/components/feeds/test/chrome/test_bug368464.html32
-rw-r--r--browser/components/feeds/test/chrome/test_bug408328.html37
-rw-r--r--browser/components/feeds/test/chrome/test_maxSniffing.html37
7 files changed, 202 insertions, 0 deletions
diff --git a/browser/components/feeds/test/chrome/.eslintrc.js b/browser/components/feeds/test/chrome/.eslintrc.js
new file mode 100644
index 000000000..8c0f4f574
--- /dev/null
+++ b/browser/components/feeds/test/chrome/.eslintrc.js
@@ -0,0 +1,7 @@
+"use strict";
+
+module.exports = {
+ "extends": [
+ "../../../../../testing/mochitest/chrome.eslintrc.js"
+ ]
+};
diff --git a/browser/components/feeds/test/chrome/chrome.ini b/browser/components/feeds/test/chrome/chrome.ini
new file mode 100644
index 000000000..7bad142ab
--- /dev/null
+++ b/browser/components/feeds/test/chrome/chrome.ini
@@ -0,0 +1,10 @@
+[DEFAULT]
+support-files = sample_feed.atom
+ !/browser/components/feeds/test/bug408328-data.xml
+ !/browser/components/feeds/test/valid-feed.xml
+ !/browser/components/feeds/test/valid-unsniffable-feed.xml
+
+[test_423060.xul]
+[test_bug368464.html]
+[test_bug408328.html]
+[test_maxSniffing.html]
diff --git a/browser/components/feeds/test/chrome/sample_feed.atom b/browser/components/feeds/test/chrome/sample_feed.atom
new file mode 100644
index 000000000..add75efb4
--- /dev/null
+++ b/browser/components/feeds/test/chrome/sample_feed.atom
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+
+ <title>Example Feed</title>
+ <link href="http://example.org/"/>
+ <updated>2003-12-13T18:30:02Z</updated>
+
+ <author>
+ <name>John Doe</name>
+ </author>
+ <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
+
+ <entry>
+
+ <title>Atom-Powered Robots Run Amok</title>
+ <link href="http://example.org/2003/12/13/atom03"/>
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+ <updated>2003-12-13T18:30:02Z</updated>
+
+ <summary>Some text.</summary>
+ </entry>
+
+</feed>
diff --git a/browser/components/feeds/test/chrome/test_423060.xul b/browser/components/feeds/test/chrome/test_423060.xul
new file mode 100644
index 000000000..465cf2dd2
--- /dev/null
+++ b/browser/components/feeds/test/chrome/test_423060.xul
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet
+ href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window title="Make sure feed preview works when a default reader is selected"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+ <body xmlns="http://www.w3.org/1999/xhtml" />
+
+ <script type="application/javascript">
+ SimpleTest.waitForExplicitFinish();
+
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
+
+ var wccrID = "@mozilla.org/embeddor.implemented/web-content-handler-registrar;1";
+ /* abort the test if web feed handlers are not available */
+ if (!Cc[wccrID])
+ SimpleTest.finish()
+
+ /* Turn off the first run UI */
+ var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
+ prefBranch.setBoolPref("browser.feeds.showFirstRunUI", false);
+
+ /* register a handler for the feed type */
+ const MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
+ var handlerPage = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/demohandler.html?feedurl=%s";
+ var wccr = Cc[wccrID].getService(Ci.nsIWebContentConverterService);
+ wccr.registerContentHandler(MAYBE_FEED, handlerPage, "Demo handler", null);
+ var demoHandler = wccr.getWebContentHandlerByURI(MAYBE_FEED, handlerPage);
+ wccr.setAutoHandler(MAYBE_FEED, demoHandler);
+
+ /* Don't show the preview page */
+ prefBranch.setCharPref("browser.feeds.handler", "reader");
+
+ function finishUp() {
+ var theframe = document.getElementById('theframe');
+ var previewURL = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/demohandler.html?feedurl=http%3A%2F%2Fmochi.test%3A8888%2Ftests%2Ftoolkit%2Fcomponents%2Fplaces%2Ftests%2Fchrome%2Fsample_feed.atom";
+ is(theframe.contentDocument.URL, previewURL);
+
+ /* remove our demoHandler */
+ wccr.setAutoHandler(MAYBE_FEED, null);
+ wccr.removeContentHandler(MAYBE_FEED, handlerPage);
+ prefBranch.setCharPref("browser.feeds.handler", "ask");
+ prefBranch.setBoolPref("browser.feeds.showFirstRunUI", true);
+
+ SimpleTest.finish();
+ }
+ </script>
+ <html:iframe src="http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/sample_feed.atom" height="400px"
+ id="theframe" onload="finishUp();">
+ </html:iframe>
+</window>
diff --git a/browser/components/feeds/test/chrome/test_bug368464.html b/browser/components/feeds/test/chrome/test_bug368464.html
new file mode 100644
index 000000000..dd7486f66
--- /dev/null
+++ b/browser/components/feeds/test/chrome/test_bug368464.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=368464
+-->
+<head>
+ <title>Test that RSS 0.90 isn't sniffed</title>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=368464">Mozilla Bug 368464</a>
+<p id="display"><iframe id="testFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/bug368464-data.xml"></iframe></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 368464 **/
+SimpleTest.waitForExplicitFinish();
+
+addLoadEvent(function() {
+ ok($("testFrame").contentDocument.documentElement.id != "feedHandler",
+ "RSS 0.90 shouldn't be sniffed as a feed");
+});
+addLoadEvent(SimpleTest.finish);
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/browser/components/feeds/test/chrome/test_bug408328.html b/browser/components/feeds/test/chrome/test_bug408328.html
new file mode 100644
index 000000000..e4901320a
--- /dev/null
+++ b/browser/components/feeds/test/chrome/test_bug408328.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=408328
+-->
+<head>
+ <title>Test feed preview safe-linkification</title>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=408328">Mozilla Bug 408328</a>
+<p id="display"><iframe id="testFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/bug408328-data.xml"></iframe></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 408328 **/
+SimpleTest.waitForExplicitFinish();
+
+addLoadEvent(function() {
+ var links = $("testFrame").contentDocument.getElementById("feedContent").getElementsByTagName("a");
+ is(links.length, 5, "wrong number of linked items in feed preview");
+ for (var i = 0; i < links.length; i++) {
+ if (links[i].href)
+ is(links[i].href, "http://example.org/first", "bad linkified item");
+ }
+});
+addLoadEvent(SimpleTest.finish);
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/browser/components/feeds/test/chrome/test_maxSniffing.html b/browser/components/feeds/test/chrome/test_maxSniffing.html
new file mode 100644
index 000000000..7a2044687
--- /dev/null
+++ b/browser/components/feeds/test/chrome/test_maxSniffing.html
@@ -0,0 +1,37 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=739040
+-->
+<head>
+ <title>Test that we only sniff 512 bytes</title>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=739040">Mozilla Bug 739040</a>
+<p id="display">
+ <iframe id="validTestFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/valid-feed.xml"></iframe>
+ <iframe id="unsniffableTestFrame" src="http://mochi.test:8888/tests/browser/components/feeds/test/valid-unsniffable-feed.xml"></iframe>
+</p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/** Test for Bug 739040 **/
+SimpleTest.waitForExplicitFinish();
+
+addLoadEvent(function() {
+ is($("validTestFrame").contentDocument.documentElement.id, "feedHandler",
+ "valid feed should be sniffed");
+ isnot($("unsniffableTestFrame").contentDocument.documentElement.id, "feedHandler",
+ "unsniffable feed should not be sniffed");
+});
+addLoadEvent(SimpleTest.finish);
+
+</script>
+</pre>
+</body>
+</html>