Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/test/data/webui/text_defaults_browsertest.js

Issue 1863963004: WebUI: add functional test for text_defaults.css (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/test/base/web_ui_browser_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 /**
6 * Test fixture for testing async methods of cr.js.
7 * @constructor
8 * @extends testing.Test
9 */
10 function TextDefaultsTest() {}
11
12 TextDefaultsTest.prototype = {
13 __proto__: testing.Test.prototype,
14
15 /**
16 * Must be on same domain as text_defaults.css (chrome://resources).
17 * @override
18 */
19 browsePreload: 'chrome://resources/html/assert.html',
20
21 /** @override */
22 isAsync: true,
23 };
24
25 /**
26 * @param {string} html Text, possibly with HTML &entities; in it.
27 * @return {string} The HTML decoded text of |maybeHtml|.
dschuyler 2016/04/07 20:54:31 nit: The param name is called html and maybeHtml i
Dan Beam 2016/04/07 21:03:46 Done.
28 */
29 function decodeHtmlEntities(html) {
30 var element = document.createElement('div');
31 element.innerHTML = html;
32 return element.textContent;
33 }
34
35 TEST_F('TextDefaultsTest', 'ScrapeStyles', function() {
36 var link = document.createElement('link');
37 link.rel = 'stylesheet';
38 link.href = 'chrome://resources/css/text_defaults.css';
39 link.onload = function() {
40 var fontFamily = link.sheet.rules[1].style['font-family'];
41 assertNotEquals('', fontFamily);
42 assertEquals(decodeHtmlEntities(fontFamily), fontFamily);
43 testDone();
44 };
45 document.body.appendChild(link);
46 });
47
48 TEST_F('TextDefaultsTest', 'ScrapeMDStyles', function() {
49 var link = document.createElement('link');
50 link.rel = 'stylesheet';
51 link.href = 'chrome://resources/css/text_defaults_md.css';
52 link.onload = function() {
53 var fontFamily = link.sheet.rules[2].style['font-family'];
54 assertNotEquals('', fontFamily);
55 assertEquals(decodeHtmlEntities(fontFamily), fontFamily);
56 testDone();
57 };
58 document.body.appendChild(link);
59 });
OLDNEW
« no previous file with comments | « chrome/test/base/web_ui_browser_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698