mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1007409 - Test for reading list cache. r=rnewman
This commit is contained in:
parent
c1da8b2813
commit
1ed30aacea
@ -72,6 +72,7 @@ skip-if = processor == "x86"
|
||||
# bug 957185 for x86, bug 1001657 for 2.3
|
||||
skip-if = android_version == "10" || processor == "x86"
|
||||
# [testReaderMode] # see bug 913254, 936224
|
||||
[testReadingListCache]
|
||||
[testReadingListProvider]
|
||||
[testSearchHistoryProvider]
|
||||
[testSearchSuggestions]
|
||||
|
16
mobile/android/base/tests/robocop_article.html
Normal file
16
mobile/android/base/tests/robocop_article.html
Normal file
@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Article title</title>
|
||||
<meta name="description" content="This is the article description." />
|
||||
</head>
|
||||
<body>
|
||||
<header>Site header</header>
|
||||
<div>
|
||||
<h1>Article title</h1>
|
||||
<h2 class="author">by Jane Doe</h2>
|
||||
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante hendrerit. Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean ut gravida lorem. Ut turpis felis, pulvinar a semper sed, adipiscing id dolor. Pellentesque auctor nisi id magna consequat sagittis. Curabitur dapibus enim sit amet elit pharetra tincidunt feugiat nisl imperdiet. Ut convallis libero in urna ultrices accumsan. Donec sed odio eros. Donec viverra mi quis quam pulvinar at malesuada arcu rhoncus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. In rutrum accumsan ultricies. Mauris vitae nisi at sem facilisis semper ac in est.</p>
|
||||
<p>Vivamus fermentum semper porta. Nunc diam velit, adipiscing ut tristique vitae, sagittis vel odio. Maecenas convallis ullamcorper ultricies. Curabitur ornare, ligula semper consectetur sagittis, nisi diam iaculis velit, id fringilla sem nunc vel mi. Nam dictum, odio nec pretium volutpat, arcu ante placerat erat, non tristique elit urna et turpis. Quisque mi metus, ornare sit amet fermentum et, tincidunt et orci. Fusce eget orci a orci congue vestibulum. Ut dolor diam, elementum et vestibulum eu, porttitor vel elit. Curabitur venenatis pulvinar tellus gravida ornare. Sed et erat faucibus nunc euismod ultricies ut id justo. Nullam cursus suscipit nisi, et ultrices justo sodales nec. Fusce venenatis facilisis lectus ac semper. Aliquam at massa ipsum. Quisque bibendum purus convallis nulla ultrices ultricies. Nullam aliquam, mi eu aliquam tincidunt, purus velit laoreet tortor, viverra pretium nisi quam vitae mi. Fusce vel volutpat elit. Nam sagittis nisi dui.</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
8
mobile/android/base/tests/testReadingListCache.java
Normal file
8
mobile/android/base/tests/testReadingListCache.java
Normal file
@ -0,0 +1,8 @@
|
||||
package org.mozilla.gecko.tests;
|
||||
|
||||
|
||||
public class testReadingListCache extends JavascriptTest {
|
||||
public testReadingListCache() {
|
||||
super("testReadingListCache.js");
|
||||
}
|
||||
}
|
68
mobile/android/base/tests/testReadingListCache.js
Normal file
68
mobile/android/base/tests/testReadingListCache.js
Normal file
@ -0,0 +1,68 @@
|
||||
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
const { utils: Cu } = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
|
||||
// Values from robocop_article.html
|
||||
const ARTICLE = {
|
||||
url: "http://mochi.test:8888/tests/robocop/robocop_article.html",
|
||||
title: "Article title",
|
||||
byline: "by Jane Doe",
|
||||
excerpt: "This is the article description.",
|
||||
length: 1931,
|
||||
content: "Lorem ipsum..." // This test doesn't actually compare content strings
|
||||
};
|
||||
|
||||
const ARTICLE_URI = Services.io.newURI(ARTICLE.url, null, null);
|
||||
|
||||
add_task(function test_article_not_found() {
|
||||
let Reader = Services.wm.getMostRecentWindow("navigator:browser").Reader;
|
||||
|
||||
let article = yield Reader.getArticleFromCache(ARTICLE_URI);
|
||||
do_check_eq(article, null);
|
||||
});
|
||||
|
||||
add_task(function test_store_article() {
|
||||
let Reader = Services.wm.getMostRecentWindow("navigator:browser").Reader;
|
||||
|
||||
yield Reader.storeArticleInCache(ARTICLE);
|
||||
|
||||
let article = yield Reader.getArticleFromCache(ARTICLE_URI);
|
||||
checkArticle(article);
|
||||
});
|
||||
|
||||
add_task(function test_remove_article() {
|
||||
let Reader = Services.wm.getMostRecentWindow("navigator:browser").Reader;
|
||||
|
||||
yield Reader.removeArticleFromCache(ARTICLE_URI);
|
||||
|
||||
let article = yield Reader.getArticleFromCache(ARTICLE_URI);
|
||||
do_check_eq(article, null);
|
||||
});
|
||||
|
||||
add_test(function test_parse_article() {
|
||||
let Reader = Services.wm.getMostRecentWindow("navigator:browser").Reader;
|
||||
|
||||
Reader.parseDocumentFromURL(ARTICLE.url, function parseCallback(article) {
|
||||
checkArticle(article);
|
||||
run_next_test();
|
||||
});
|
||||
});
|
||||
|
||||
function checkArticle(article) {
|
||||
do_check_neq(article, null);
|
||||
do_check_neq(article.content, null);
|
||||
do_check_eq(article.url, ARTICLE.url);
|
||||
do_check_eq(article.title, ARTICLE.title);
|
||||
do_check_eq(article.byline, ARTICLE.byline);
|
||||
do_check_eq(article.excerpt, ARTICLE.excerpt);
|
||||
do_check_eq(article.length, ARTICLE.length);
|
||||
}
|
||||
|
||||
run_next_test();
|
Loading…
Reference in New Issue
Block a user