Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/runners/chromium_remote_process.js

Issue 29874649: Issue 6822 - Report browser test errors (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Left Patch Set: Also report from the chrome-remote-interface Created Sept. 13, 2018, 8:48 p.m.
Right Patch Set: throw instead of Promise.reject() Created Sept. 21, 2018, 3:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « test/runners/chromium_process.js ('k') | test/runners/firefox_process.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 if (callResult.exceptionDetails) 174 if (callResult.exceptionDetails)
175 throwException(callResult.exceptionDetails, scriptName); 175 throwException(callResult.exceptionDetails, scriptName);
176 176
177 let promiseResult = await Runtime.awaitPromise({ 177 let promiseResult = await Runtime.awaitPromise({
178 promiseObjectId: callResult.result.objectId 178 promiseObjectId: callResult.result.objectId
179 }); 179 });
180 if (promiseResult.exceptionDetails) 180 if (promiseResult.exceptionDetails)
181 throwException(promiseResult.exceptionDetails, scriptName); 181 throwException(promiseResult.exceptionDetails, scriptName);
182 182
183 return Runtime.evaluate({ 183 return Runtime.evaluate({
184 expression: "window.consoleLogs", 184 expression: "window._consoleLogs",
185 returnByValue: true 185 returnByValue: true
186 }) 186 }).then(result =>
187 .then(result => 187 {
188 { 188 if (result.result.value.failures != 0)
189 if (result.result.value.failures != 0) 189 throw "Chromium (Remote Interface)";
190 return Promise.reject("Test failure"); 190 });
191 });
192 } 191 }
193 finally 192 finally
194 { 193 {
195 client.close(); 194 client.close();
196 } 195 }
197 }); 196 });
198 } 197 }
199 198
200 module.exports = function(script, scriptName, ...scriptArgs) 199 module.exports = function(script, scriptName, ...scriptArgs)
201 { 200 {
202 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath => 201 return ensureChromium(CHROMIUM_REVISION).then(chromiumPath =>
203 { 202 {
204 let child = startChromium(chromiumPath); 203 let child = startChromium(chromiumPath);
205 return Promise.race([ 204 return Promise.race([
206 child.done, 205 child.done,
207 runScript(script, scriptName, scriptArgs) 206 runScript(script, scriptName, scriptArgs)
208 ]).then(result => 207 ]).then(result =>
209 { 208 {
210 child.kill(); 209 child.kill();
211 return result; 210 return result;
212 }).catch(error => 211 }).catch(error =>
213 { 212 {
214 child.kill(); 213 child.kill();
215 throw error; 214 throw error;
216 }); 215 });
217 }); 216 });
218 }; 217 };
LEFTRIGHT

Powered by Google App Engine
This is Rietveld