diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/modules/tests/browser/browser_PageMetadata.js | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/modules/tests/browser/browser_PageMetadata.js')
-rw-r--r-- | toolkit/modules/tests/browser/browser_PageMetadata.js | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/toolkit/modules/tests/browser/browser_PageMetadata.js b/toolkit/modules/tests/browser/browser_PageMetadata.js deleted file mode 100644 index ca6e18368..000000000 --- a/toolkit/modules/tests/browser/browser_PageMetadata.js +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Tests PageMetadata.jsm, which extracts metadata and microdata from a - * document. - */ - -var {PageMetadata} = Cu.import("resource://gre/modules/PageMetadata.jsm", {}); - -var rootURL = "http://example.com/browser/toolkit/modules/tests/browser/"; - -function promiseDocument(fileName) { - let url = rootURL + fileName; - - return new Promise((resolve, reject) => { - let xhr = new XMLHttpRequest(); - xhr.onload = () => resolve(xhr.responseXML); - xhr.onerror = () => reject(new Error("Error loading document")); - xhr.open("GET", url); - xhr.responseType = "document"; - xhr.send(); - }); -} - -/** - * Load a simple document. - */ -add_task(function* simpleDoc() { - let fileName = "metadata_simple.html"; - info(`Loading a simple page, ${fileName}`); - - let doc = yield promiseDocument(fileName); - Assert.notEqual(doc, null, - "Should have a document to analyse"); - - let data = PageMetadata.getData(doc); - Assert.notEqual(data, null, - "Should have non-null result"); - Assert.equal(data.url, rootURL + fileName, - "Should have expected url property"); - Assert.equal(data.title, "Test Title", - "Should have expected title property"); - Assert.equal(data.description, "A very simple test page", - "Should have expected title property"); -}); - -add_task(function* titlesDoc() { - let fileName = "metadata_titles.html"; - info(`Loading titles page, ${fileName}`); - - let doc = yield promiseDocument(fileName); - Assert.notEqual(doc, null, - "Should have a document to analyse"); - - let data = PageMetadata.getData(doc); - Assert.notEqual(data, null, - "Should have non-null result"); - Assert.equal(data.title, "Test Titles", - "Should use the page title, not the open graph title"); -}); - -add_task(function* titlesFallbackDoc() { - let fileName = "metadata_titles_fallback.html"; - info(`Loading titles page, ${fileName}`); - - let doc = yield promiseDocument(fileName); - Assert.notEqual(doc, null, - "Should have a document to analyse"); - - let data = PageMetadata.getData(doc); - Assert.notEqual(data, null, - "Should have non-null result"); - Assert.equal(data.title, "Title", - "Should use the open graph title"); -}); |