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

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

Issue 1333473002: Support lists in <cr-settings-pref> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@PrefsTests
Patch Set: Now with 100% more correctness Created 5 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Framework for running JavaScript tests of Polymer elements. 6 * @fileoverview Framework for running JavaScript tests of Polymer elements.
7 */ 7 */
8 8
9 /** 9 /**
10 * Test fixture for Polymer element testing. 10 * Test fixture for Polymer element testing.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 return basePath + library; 95 return basePath + library;
96 }); 96 });
97 }; 97 };
98 98
99 /** 99 /**
100 * Allows chaining asynchronous function to avoid having to write nested 100 * Allows chaining asynchronous function to avoid having to write nested
101 * Promises or setTimeouts. 101 * Promises or setTimeouts.
102 * Example: PolymerTest.async(fn1).async(fn2).async(fn3).async(done); 102 * Example: PolymerTest.async(fn1).async(fn2).async(fn3).async(done);
103 */ 103 */
104 PolymerTest.async = function(fn) { 104 PolymerTest.async = function(fn) {
105 // Wrap the asynchronous call to |fn| in a Promise. 105 if (!PolymerTest.lastPromise_) {
106 var p = new Promise(function(resolve, reject) { 106 PolymerTest.lastPromise_ = new Promise(function(resolve) {
107 setTimeout(function() { 107 setTimeout(fn);
108 fn.call(); 108 setTimeout(resolve);
109 resolve(); 109 });
110 } else {
111 PolymerTest.lastPromise_ = PolymerTest.lastPromise_.then(function() {
112 return new Promise(function(resolve) {
113 fn();
114 setTimeout(resolve);
115 });
110 }); 116 });
111 }); 117 }
112 // Return a helper function of the same name which adds this function to the 118 // Return a helper function of the same name which adds this function to the
113 // Promise chain. 119 // Promise chain.
114 return { 120 return {
115 async: function(fn) { 121 async: PolymerTest.async
116 p.then(function() {
117 return PolymerTest.async(fn);
118 });
119 },
120 }; 122 };
121 }; 123 };
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/prefs/prefs.js ('k') | chrome/test/data/webui/settings/prefs_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698