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

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

Issue 1124873002: Mocha adapter for Polymer browser tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: override setUp Created 5 years, 6 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/data/webui/mocha_adapter.js ('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 2015 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 * @fileoverview Framework for running JavaScript tests of Polymer elements.
7 */
8
9 /**
10 * Test fixture for Polymer element testing.
11 * @constructor
12 * @extends testing.Test
13 */
14 function PolymerTest() {
15 }
16
17 PolymerTest.prototype = {
18 __proto__: testing.Test.prototype,
19
20 /**
21 * Navigate to a WebUI to satisfy BrowserTest conditions. Override to load a
22 * more useful WebUI.
23 * @override
24 */
25 browsePreload: 'chrome://chrome-urls/',
26
27 /**
28 * The mocha adapter assumes all tests are async.
29 * @override
30 * @final
31 */
32 isAsync: true,
33
34 /**
35 * @override
36 * @final
37 */
38 extraLibraries: ['../../../../third_party/mocha/mocha.js',
39 'mocha_adapter.js'],
40
41 /** @override */
42 setUp: function() {
43 testing.Test.prototype.setUp.call(this);
44
45 // Import Polymer before running tests.
46 suiteSetup(function(done) {
47 var link = document.createElement('link');
48 link.rel = 'import';
49 link.onload = function() {
50 done();
51 };
52 link.onerror = function() {
53 done(new Error('Failed to load Polymer!'));
54 };
55 link.href = 'chrome://resources/polymer/v0_8/polymer/polymer.html';
56 document.head.appendChild(link);
57 });
58 },
59 };
60
61 /**
62 * Imports the HTML file, then calls |done| on success or throws an error.
63 * @param {String} href The URL to load.
64 * @param {Function} done The done callback.
65 */
66 PolymerTest.importHref = function(href, done) {
67 Polymer.Base.importHref(
68 href,
69 function() { done(); },
70 function() { throw new Error('Failed to load ' + href); });
71 };
72
73 /**
74 * Removes all content from the body.
75 */
76 PolymerTest.clearBody = function() {
77 document.body.innerHTML = '';
78 };
OLDNEW
« no previous file with comments | « chrome/test/data/webui/mocha_adapter.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698