Root.allDescriptors.push(...[{"skip_compilation":["AppcacheTestRunner.js","CacheStorageTestRunner.js","IndexedDBTestRunner.js","ResourceTreeTestRunner.js","ResourcesTestRunner.js","ServiceWorkersTestRunner.js"],"dependencies":["test_runner","resources","console_test_runner","sources","sources_test_runner"],"modules":[],"name":"application_test_runner","scripts":["application_test_runner_module.js"]},{"dependencies":["heap_snapshot_model","platform","common"],"modules":["heap_snapshot_worker.js","AllocationProfile.js","HeapSnapshot.js","HeapSnapshotLoader.js","HeapSnapshotWorkerDispatcher.js","HeapSnapshotWorker.js"],"name":"heap_snapshot_worker","scripts":[]},{"skip_compilation":["ElementsTestRunner.js","EditDOMTestRunner.js","SetOuterHTMLTestRunner.js","ElementsPanelShadowSelectionOnRefreshTestRunner.js","StylesUpdateLinksTestRunner.js"],"dependencies":["test_runner","elements","event_listeners","animation"],"modules":[],"name":"elements_test_runner","scripts":["elements_test_runner_module.js"]},{"skip_compilation":["ExtensionsNetworkTestRunner.js","ExtensionsTestRunner.js"],"dependencies":["test_runner","extensions"],"modules":[],"name":"extensions_test_runner","scripts":["extensions_test_runner_module.js"]},{"dependencies":["sdk","workspace","ui","host","main"],"name":"test_runner"},{"dependencies":["test_runner","audits"],"modules":[],"name":"audits_test_runner","scripts":["audits_test_runner_module.js"]},{"skip_compilation":["LayersTestRunner.js"],"dependencies":["test_runner","layers","elements","components"],"modules":[],"name":"layers_test_runner","scripts":["layers_test_runner_module.js"]},{"skip_compilation":["AccessibilityPaneTestRunner.js"],"dependencies":["test_runner","accessibility","elements_test_runner"],"modules":[],"name":"accessibility_test_runner","scripts":["accessibility_test_runner_module.js"]},{"skip_compilation":["NetworkTestRunner.js"],"dependencies":["test_runner","console_test_runner"],"modules":[],"name":"network_test_runner","scripts":["network_test_runner_module.js"]},{"skip_compilation":["../../third_party/axe-core/axe.js","AxeCoreTestRunner.js"],"dependencies":["test_runner"],"modules":[],"name":"axe_core_test_runner","scripts":["axe_core_test_runner_module.js"]},{"skip_compilation":["DeviceModeTestRunner.js"],"dependencies":["test_runner","emulation"],"modules":[],"name":"device_mode_test_runner","scripts":["device_mode_test_runner_module.js"]},{"skip_compilation":["DataGridTestRunner.js"],"dependencies":["test_runner","data_grid"],"modules":[],"name":"data_grid_test_runner","scripts":["data_grid_test_runner_module.js"]},{"skip_compilation":["HeapProfilerTestRunner.js"],"dependencies":["heap_snapshot_worker","test_runner","profiler","data_grid"],"modules":[],"name":"heap_profiler_test_runner","scripts":["heap_profiler_test_runner_module.js"]},{"skip_compilation":["CoverageTestRunner.js"],"dependencies":["test_runner","coverage","sources_test_runner"],"modules":[],"name":"coverage_test_runner","scripts":["coverage_test_runner_module.js"]},{"skip_compilation":["ProfilerTestRunner.js"],"dependencies":["profiler","test_runner"],"modules":[],"name":"cpu_profiler_test_runner","scripts":["cpu_profiler_test_runner_module.js"]},{"skip_compilation":["TimelineTestRunner.js","TimelineDataTestRunner.js"],"dependencies":["test_runner","timeline_model","timeline"],"modules":[],"name":"performance_test_runner","scripts":["performance_test_runner_module.js"]},{"skip_compilation":["DebuggerTestRunner.js","LiveEditTestRunner.js","SearchTestRunner.js","SourcesTestRunner.js","EditorTestRunner.js","AutocompleteTestRunner.js"],"dependencies":["test_runner","sources","workspace","source_frame","text_utils","cm_modes","browser_debugger"],"modules":[],"name":"sources_test_runner","scripts":["sources_test_runner_module.js"]},{"skip_compilation":["SecurityTestRunner.js"],"dependencies":["test_runner","security"],"modules":[],"name":"security_test_runner","scripts":["security_test_runner_module.js"]},{"skip_compilation":["PageMockTestRunner.js"],"dependencies":["sdk","test_runner"],"modules":[],"name":"sdk_test_runner","scripts":["sdk_test_runner_module.js"]},{"dependencies":["test_runner","console","console_counters"],"modules":[],"name":"console_test_runner","scripts":["console_test_runner_module.js"]},{"skip_compilation":["BindingsTestRunner.js","IsolatedFilesystemTestRunner.js","AutomappingTestRunner.js","PersistenceTestRunner.js","OverridesTestRunner.js"],"dependencies":["test_runner","workspace","diff","bindings","persistence"],"modules":[],"name":"bindings_test_runner","scripts":["bindings_test_runner_module.js"]}]);Root.applicationDescriptor.modules.push(...[{"name":"application_test_runner"},{"name":"heap_snapshot_worker"},{"name":"elements_test_runner"},{"name":"extensions_test_runner"},{"type":"autostart","name":"test_runner"},{"name":"audits_test_runner"},{"name":"layers_test_runner"},{"name":"security_test_runner"},{"name":"network_test_runner"},{"name":"axe_core_test_runner"},{"name":"device_mode_test_runner"},{"name":"sources_test_runner"},{"name":"data_grid_test_runner"},{"name":"heap_profiler_test_runner"},{"name":"cpu_profiler_test_runner"},{"name":"performance_test_runner"},{"name":"accessibility_test_runner"},{"name":"bindings_test_runner"},{"name":"sdk_test_runner"},{"name":"console_test_runner"},{"name":"coverage_test_runner"}]);self['TestRunner']=self['TestRunner']||{};self.testRunner;TestRunner.setupStartupTest=function(path){const absoluteURL=TestRunner.url(path);self.testRunner.navigateSecondaryWindow(absoluteURL);return new Promise(f=>TestRunner._startupTestSetupFinished=()=>{TestRunner._initializeTargetForStartupTest();delete TestRunner._startupTestSetupFinished;f();});};TestRunner._executeTestScript=function(){const testScriptURL=(Root.Runtime.queryParam('test'));fetch(testScriptURL).then(data=>data.text()).then(testScript=>{if(TestRunner._isDebugTest()){TestRunner.addResult=console.log;TestRunner.completeTest=()=>console.log('Test completed');if(!self.testRunner){eval(`(function test(){${testScript}})()\n//# sourceURL=${testScriptURL}`);}else{self.eval(`function test(){${testScript}}\n//# sourceURL=${testScriptURL}`);} return;} testScript=testScript.trimRight();if(testScript.endsWith(';')){testScript=testScript.slice(0,testScript.length-1);} (async function(){try{await eval(testScript+`\n//# sourceURL=${testScriptURL}`);}catch(err){TestRunner.addResult('TEST ENDED EARLY DUE TO UNCAUGHT ERROR:');TestRunner.addResult(err&&err.stack||err);TestRunner.addResult('=== DO NOT COMMIT THIS INTO -expected.txt ===');TestRunner.completeTest();}})();}).catch(error=>{TestRunner.addResult(`Unable to execute test script because of error: ${error}`);TestRunner.completeTest();});};TestRunner._results=[];TestRunner.completeTest=function(){TestRunner.flushResults();self.testRunner.notifyDone();};TestRunner.flushResults=function(){Array.prototype.forEach.call(document.documentElement.childNodes,x=>x.remove());const outputElement=document.createElement('div');if(outputElement.style){outputElement.style.whiteSpace='pre';outputElement.style.height='10px';outputElement.style.overflow='hidden';} document.documentElement.appendChild(outputElement);for(let i=0;iTestRunner._resolveOnFinishInits=resolve);await self.runtime.loadModulePromise(module);if(!TestRunner._pendingInits){return;} return promise;};TestRunner.showPanel=function(panel){return UI.viewManager.showView(panel);};TestRunner.createKeyEvent=function(key,ctrlKey,altKey,shiftKey,metaKey){return new KeyboardEvent('keydown',{key:key,bubbles:true,cancelable:true,ctrlKey:!!ctrlKey,altKey:!!altKey,shiftKey:!!shiftKey,metaKey:!!metaKey});};TestRunner.safeWrap=function(func,onexception){function result(){if(!func){return;} const wrapThis=this;try{return func.apply(wrapThis,arguments);}catch(e){TestRunner.addResult('Exception while running: '+func+'\n'+(e.stack||e));if(onexception){TestRunner.safeWrap(onexception)();}else{TestRunner.completeTest();}}} return result;};TestRunner.safeAsyncWrap=function(func){async function result(){if(!func){return;} const wrapThis=this;try{return await func.apply(wrapThis,arguments);}catch(e){TestRunner.addResult('Exception while running: '+func+'\n'+(e.stack||e));TestRunner.completeTest();}} return result;};TestRunner.textContentWithLineBreaks=function(node){function padding(currentNode){let result=0;while(currentNode&¤tNode!==node){if(currentNode.nodeName==='OL'&&!(currentNode.classList&¤tNode.classList.contains('object-properties-section'))){++result;} currentNode=currentNode.parentNode;} return Array(result*4+1).join(' ');} let buffer='';let currentNode=node;let ignoreFirst=false;while(currentNode.traverseNextNode(node)){currentNode=currentNode.traverseNextNode(node);if(currentNode.nodeType===Node.TEXT_NODE){buffer+=currentNode.nodeValue;}else if(currentNode.nodeName==='LI'||currentNode.nodeName==='TR'){if(!ignoreFirst){buffer+='\n'+padding(currentNode);}else{ignoreFirst=false;}}else if(currentNode.nodeName==='STYLE'){currentNode=currentNode.traverseNextNode(node);continue;}else if(currentNode.classList&¤tNode.classList.contains('object-properties-section')){ignoreFirst=true;}} return buffer;};TestRunner.textContentWithoutStyles=function(node){let buffer='';let currentNode=node;while(currentNode.traverseNextNode(node)){currentNode=currentNode.traverseNextNode(node);if(currentNode.nodeType===Node.TEXT_NODE){buffer+=currentNode.nodeValue;}else if(currentNode.nodeName==='STYLE'){currentNode=currentNode.traverseNextNode(node);}} return buffer;};TestRunner._setupTestHelpers=function(target){TestRunner.BrowserAgent=target.browserAgent();TestRunner.CSSAgent=target.cssAgent();TestRunner.DeviceOrientationAgent=target.deviceOrientationAgent();TestRunner.DOMAgent=target.domAgent();TestRunner.DOMDebuggerAgent=target.domdebuggerAgent();TestRunner.DebuggerAgent=target.debuggerAgent();TestRunner.EmulationAgent=target.emulationAgent();TestRunner.HeapProfilerAgent=target.heapProfilerAgent();TestRunner.InspectorAgent=target.inspectorAgent();TestRunner.NetworkAgent=target.networkAgent();TestRunner.OverlayAgent=target.overlayAgent();TestRunner.PageAgent=target.pageAgent();TestRunner.ProfilerAgent=target.profilerAgent();TestRunner.RuntimeAgent=target.runtimeAgent();TestRunner.TargetAgent=target.targetAgent();TestRunner.networkManager=target.model(SDK.NetworkManager);TestRunner.securityOriginManager=target.model(SDK.SecurityOriginManager);TestRunner.resourceTreeModel=target.model(SDK.ResourceTreeModel);TestRunner.debuggerModel=target.model(SDK.DebuggerModel);TestRunner.runtimeModel=target.model(SDK.RuntimeModel);TestRunner.domModel=target.model(SDK.DOMModel);TestRunner.domDebuggerModel=target.model(SDK.DOMDebuggerModel);TestRunner.cssModel=target.model(SDK.CSSModel);TestRunner.cpuProfilerModel=target.model(SDK.CPUProfilerModel);TestRunner.overlayModel=target.model(SDK.OverlayModel);TestRunner.serviceWorkerManager=target.model(SDK.ServiceWorkerManager);TestRunner.tracingManager=target.model(SDK.TracingManager);TestRunner.mainTarget=target;};TestRunner.evaluateInPageRemoteObject=async function(code){const response=await TestRunner._evaluateInPage(code);return TestRunner.runtimeModel.createRemoteObject(response.result);};TestRunner.evaluateInPage=async function(code,callback){const response=await TestRunner._evaluateInPage(code);TestRunner.safeWrap(callback)(response.result.value,response.exceptionDetails);};TestRunner._evaluateInPageCounter=0;TestRunner._evaluateInPage=async function(code){const lines=new Error().stack.split('at ');const testScriptURL=(Root.Runtime.queryParam('test'));const functionLine=lines.reduce((acc,line)=>line.includes(testScriptURL)?line:acc,lines[lines.length-2]);const components=functionLine.trim().split('/');const source=components[components.length-1].slice(0,-1).split(':');const fileName=source[0];const sourceURL=`test://evaluations/${TestRunner._evaluateInPageCounter++}/`+fileName;const lineOffset=parseInt(source[1],10);code='\n'.repeat(lineOffset-1)+code;if(code.indexOf('sourceURL=')===-1){code+=`//# sourceURL=${sourceURL}`;} const response=await TestRunner.RuntimeAgent.invoke_evaluate({expression:code,objectGroup:'console'});const error=response[Protocol.Error];if(error){TestRunner.addResult('Error: '+error);TestRunner.completeTest();return;} return response;};TestRunner.evaluateInPageAnonymously=async function(code,userGesture){const response=await TestRunner.RuntimeAgent.invoke_evaluate({expression:code,objectGroup:'console',userGesture});if(!response[Protocol.Error]){return response.result.value;} TestRunner.addResult('Error: '+ (response.exceptionDetails&&response.exceptionDetails.text||'exception from evaluateInPageAnonymously.'));TestRunner.completeTest();};TestRunner.evaluateInPagePromise=function(code){return new Promise(success=>TestRunner.evaluateInPage(code,success));};TestRunner.evaluateInPageAsync=async function(code){const response=await TestRunner.RuntimeAgent.invoke_evaluate({expression:code,objectGroup:'console',includeCommandLineAPI:false,awaitPromise:true});const error=response[Protocol.Error];if(!error&&!response.exceptionDetails){return response.result.value;} TestRunner.addResult('Error: '+ (error||response.exceptionDetails&&response.exceptionDetails.text||'exception while evaluation in page.'));TestRunner.completeTest();};TestRunner.callFunctionInPageAsync=function(name,args){args=args||[];return TestRunner.evaluateInPageAsync(name+'('+args.map(a=>JSON.stringify(a)).join(',')+')');};TestRunner.evaluateInPageWithTimeout=function(code,userGesture){TestRunner.evaluateInPageAnonymously('setTimeout(unescape(\''+escape(code)+'\'), 1)',userGesture);};TestRunner.evaluateFunctionInOverlay=function(func,callback){const expression='internals.evaluateInInspectorOverlay("(" + '+func+' + ")()")';const mainContext=TestRunner.runtimeModel.executionContexts()[0];mainContext.evaluate({expression:expression,objectGroup:'',includeCommandLineAPI:false,silent:false,returnByValue:true,generatePreview:false},false,false).then(result=>void callback(result.object.value));};TestRunner.check=function(passCondition,failureText){if(!passCondition){TestRunner.addResult('FAIL: '+failureText);}};TestRunner.deprecatedRunAfterPendingDispatches=function(callback){Protocol.test.deprecatedRunAfterPendingDispatches(callback);};TestRunner.loadHTML=function(html){if(!html.includes(')/i;const baseTag=``;if(html.match(doctypeRegex)){html=html.replace(doctypeRegex,'$1'+baseTag);}else{html=baseTag+html;}} html=html.replace(/'/g,'\\\'').replace(/\n/g,'\\n');return TestRunner.evaluateInPageAnonymously(`document.write(\`${html}\`);document.close();`);};TestRunner.addScriptTag=function(path){return TestRunner.evaluateInPageAsync(` (function(){ let script = document.createElement('script'); script.src = '${path}'; document.head.append(script); return new Promise(f => script.onload = f); })(); `);};TestRunner.addStylesheetTag=function(path){return TestRunner.evaluateInPageAsync(` (function(){ const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = '${path}'; link.onload = onload; document.head.append(link); let resolve; const promise = new Promise(r => resolve = r); function onload() { // TODO(chenwilliam): It shouldn't be necessary to force // style recalc here but some tests rely on it. window.getComputedStyle(document.body).color; resolve(); } return promise; })(); `);};TestRunner.addHTMLImport=function(path){return TestRunner.evaluateInPageAsync(` (function(){ const link = document.createElement('link'); link.rel = 'import'; link.href = '${path}'; const promise = new Promise(r => link.onload = r); document.body.append(link); return promise; })(); `);};TestRunner.addIframe=function(path,options={}){options.id=options.id||'';options.name=options.name||'';return TestRunner.evaluateInPageAsync(` (function(){ const iframe = document.createElement('iframe'); iframe.src = '${path}'; iframe.id = '${options.id}'; iframe.name = '${options.name}'; document.body.appendChild(iframe); return new Promise(f => iframe.onload = f); })(); `);};TestRunner._pendingInits=0;TestRunner.deprecatedInitAsync=async function(code){TestRunner._pendingInits++;await TestRunner.RuntimeAgent.invoke_evaluate({expression:code,objectGroup:'console'});TestRunner._pendingInits--;if(!TestRunner._pendingInits){TestRunner._resolveOnFinishInits();}};TestRunner.markStep=function(title){TestRunner.addResult('\nRunning: '+title);};TestRunner.startDumpingProtocolMessages=function(){Protocol.test.dumpProtocol=self.testRunner.logToStderr.bind(self.testRunner);};TestRunner.addScriptForFrame=function(url,content,frame){content+='\n//# sourceURL='+url;const executionContext=TestRunner.runtimeModel.executionContexts().find(context=>context.frameId===frame.id);TestRunner.RuntimeAgent.evaluate(content,'console',false,false,executionContext.id);};TestRunner.formatters={};TestRunner.formatters.formatAsTypeName=function(value){return'<'+typeof value+'>';};TestRunner.formatters.formatAsTypeNameOrNull=function(value){if(value===null){return'null';} return TestRunner.formatters.formatAsTypeName(value);};TestRunner.formatters.formatAsRecentTime=function(value){if(typeof value!=='object'||!(value instanceof Date)){return TestRunner.formatters.formatAsTypeName(value);} const delta=Date.now()-value;return 0<=delta&&delta<30*60*1000?'':value;};TestRunner.formatters.formatAsURL=function(value){if(!value){return value;} const lastIndex=value.lastIndexOf('devtools/');if(lastIndex<0){return value;} return'.../'+value.substr(lastIndex);};TestRunner.formatters.formatAsDescription=function(value){if(!value){return value;} return'"'+value.replace(/^function [gs]et /,'function ')+'"';};TestRunner.CustomFormatters;TestRunner.addObject=function(object,customFormatters,prefix,firstLinePrefix){prefix=prefix||'';firstLinePrefix=firstLinePrefix||prefix;TestRunner.addResult(firstLinePrefix+'{');const propertyNames=Object.keys(object);propertyNames.sort();for(let i=0;i');TestRunner.addResult(prefix+openTag.join(' '));for(let child=node.firstChild;child;child=child.nextSibling){innerHTML(prefix+' ',child);} if(node.shadowRoot){innerHTML(prefix+' ',node.shadowRoot);} TestRunner.addResult(prefix+'');} innerHTML('',node);};TestRunner.deepTextContent=function(node){if(!node){return'';} if(node.nodeType===Node.TEXT_NODE&&node.nodeValue){return!node.parentElement||node.parentElement.nodeName!=='STYLE'?node.nodeValue:'';} let res='';const children=node.childNodes;for(let i=0;i80){TestRunner.addResult(prefixWithName+'was skipped due to prefix length limit');return;} if(value===null){TestRunner.addResult(prefixWithName+'null');}else if(value&&value.constructor&&value.constructor.name==='Array'){TestRunner.addArray((value),customFormatters,prefix,prefixWithName);}else if(typeof value==='object'){TestRunner.addObject((value),customFormatters,prefix,prefixWithName);}else if(typeof value==='string'){TestRunner.addResult(prefixWithName+'"'+value+'"');}else{TestRunner.addResult(prefixWithName+value);}};TestRunner.dumpObjectPropertyTreeElement=function(treeElement){const expandedSubstring=treeElement.expanded?'[expanded]':'[collapsed]';TestRunner.addResult(expandedSubstring+' '+treeElement.listItemElement.deepTextContent());for(let i=0;i{obj.addEventListener(eventName,onEventFired);function onEventFired(event){if(!condition(event.data)){return;} obj.removeEventListener(eventName,onEventFired);resolve(event.data);}});};TestRunner.waitForTarget=function(filter){filter=filter||(target=>true);for(const target of SDK.targetManager.targets()){if(filter(target)){return Promise.resolve(target);}} return new Promise(fulfill=>{const observer=({targetAdded:function(target){if(filter(target)){SDK.targetManager.unobserveTargets(observer);fulfill(target);}},targetRemoved:function(){},});SDK.targetManager.observeTargets(observer);});};TestRunner.waitForTargetRemoved=function(targetToRemove){return new Promise(fulfill=>{const observer=({targetRemoved:function(target){if(target===targetToRemove){SDK.targetManager.unobserveTargets(observer);fulfill(target);}},targetAdded:function(){},});SDK.targetManager.observeTargets(observer);});};TestRunner.waitForExecutionContext=function(runtimeModel){if(runtimeModel.executionContexts().length){return Promise.resolve(runtimeModel.executionContexts()[0]);} return runtimeModel.once(SDK.RuntimeModel.Events.ExecutionContextCreated);};TestRunner.waitForExecutionContextDestroyed=function(context){const runtimeModel=context.runtimeModel;if(runtimeModel.executionContexts().indexOf(context)===-1){return Promise.resolve();} return TestRunner.waitForEvent(SDK.RuntimeModel.Events.ExecutionContextDestroyed,runtimeModel,destroyedContext=>destroyedContext===context);};TestRunner.assertGreaterOrEqual=function(a,b,message){if(aTestRunner.navigate(url,fulfill));};TestRunner._pageNavigated=function(){TestRunner.resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.Load,TestRunner._pageNavigated);TestRunner._handlePageLoaded();};TestRunner.hardReloadPage=function(callback){TestRunner._innerReloadPage(true,undefined,callback);};TestRunner.reloadPage=function(callback){TestRunner._innerReloadPage(false,undefined,callback);};TestRunner.reloadPageWithInjectedScript=function(injectedScript,callback){TestRunner._innerReloadPage(false,injectedScript,callback);};TestRunner.reloadPagePromise=function(){return new Promise(fulfill=>TestRunner.reloadPage(fulfill));};TestRunner._innerReloadPage=function(hardReload,injectedScript,callback){TestRunner._pageLoadedCallback=TestRunner.safeWrap(callback);TestRunner.resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.Load,TestRunner.pageLoaded);TestRunner.resourceTreeModel.reloadPage(hardReload,injectedScript);};TestRunner.pageLoaded=function(){TestRunner.resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.Load,TestRunner.pageLoaded);TestRunner.addResult('Page reloaded.');TestRunner._handlePageLoaded();};TestRunner._handlePageLoaded=async function(){await TestRunner.waitForExecutionContext((TestRunner.runtimeModel));if(TestRunner._pageLoadedCallback){const callback=TestRunner._pageLoadedCallback;delete TestRunner._pageLoadedCallback;callback();}};TestRunner.waitForPageLoad=function(callback){TestRunner.resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.Load,onLoaded);function onLoaded(){TestRunner.resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.Load,onLoaded);callback();}};TestRunner.runWhenPageLoads=function(callback){const oldCallback=TestRunner._pageLoadedCallback;function chainedCallback(){if(oldCallback){oldCallback();} callback();} TestRunner._pageLoadedCallback=TestRunner.safeWrap(chainedCallback);};TestRunner.runTestSuite=function(testSuite){const testSuiteTests=testSuite.slice();function runner(){if(!testSuiteTests.length){TestRunner.completeTest();return;} const nextTest=testSuiteTests.shift();TestRunner.addResult('');TestRunner.addResult('Running: '+/function\s([^(]*)/.exec(nextTest)[1]);TestRunner.safeWrap(nextTest)(runner);} runner();};TestRunner.runAsyncTestSuite=async function(testSuite){for(const nextTest of testSuite){TestRunner.addResult('');TestRunner.addResult('Running: '+/function\s([^(]*)/.exec(nextTest)[1]);await TestRunner.safeAsyncWrap(nextTest)();} TestRunner.completeTest();};TestRunner.assertEquals=function(expected,found,message){if(expected===found){return;} let error;if(message){error='Failure ('+message+'):';}else{error='Failure:';} throw new Error(error+' expected <'+expected+'> found <'+found+'>');};TestRunner.assertTrue=function(found,message){TestRunner.assertEquals(true,!!found,message);};TestRunner.override=function(receiver,methodName,override,opt_sticky){override=TestRunner.safeWrap(override);const original=receiver[methodName];if(typeof original!=='function'){throw new Error('Cannot find method to override: '+methodName);} receiver[methodName]=function(var_args){try{return override.apply(this,arguments);}catch(e){throw new Error('Exception in overriden method \''+methodName+'\': '+e);}finally{if(!opt_sticky){receiver[methodName]=original;}}};return original;};TestRunner.clearSpecificInfoFromStackFrames=function(text){let buffer=text.replace(/\(file:\/\/\/(?:[^)]+\)|[\w\/:-]+)/g,'(...)');buffer=buffer.replace(/\(http:\/\/(?:[^)]+\)|[\w\/:-]+)/g,'(...)');buffer=buffer.replace(/\(test:\/\/(?:[^)]+\)|[\w\/:-]+)/g,'(...)');buffer=buffer.replace(/\(:[^)]+\)/g,'(...)');buffer=buffer.replace(/VM\d+/g,'VM');return buffer.replace(/\s*at[^()]+\(native\)/g,'');};TestRunner.hideInspectorView=function(){UI.inspectorView.element.setAttribute('style','display:none !important');};TestRunner.mainFrame=function(){return TestRunner.resourceTreeModel.mainFrame;};TestRunner.StringOutputStream=class{constructor(callback){this._callback=callback;this._buffer='';} async open(fileName){return true;} async write(chunk){this._buffer+=chunk;} async close(){this._callback(this._buffer);}};TestRunner.MockSetting=class{constructor(value){this._value=value;} get(){return this._value;} set(value){this._value=value;}};TestRunner.loadedModules=function(){return self.runtime._modules.filter(module=>module._loadedForTest).filter(module=>module.name()!=='help').filter(module=>module.name().indexOf('test_runner')===-1);};TestRunner.dumpLoadedModules=function(relativeTo){const previous=new Set(relativeTo||[]);function moduleSorter(left,right){return String.naturalOrderComparator(left._descriptor.name,right._descriptor.name);} TestRunner.addResult('Loaded modules:');const loadedModules=TestRunner.loadedModules().sort(moduleSorter);for(const module of loadedModules){if(previous.has(module)){continue;} TestRunner.addResult(' '+module._descriptor.name);} return loadedModules;};TestRunner.waitForUISourceCode=function(urlSuffix,projectType){function matches(uiSourceCode){if(projectType&&uiSourceCode.project().type()!==projectType){return false;} if(!projectType&&uiSourceCode.project().type()===Workspace.projectTypes.Service){return false;} if(urlSuffix&&!uiSourceCode.url().endsWith(urlSuffix)){return false;} return true;} for(const uiSourceCode of Workspace.workspace.uiSourceCodes()){if(urlSuffix&&matches(uiSourceCode)){return Promise.resolve(uiSourceCode);}} return TestRunner.waitForEvent(Workspace.Workspace.Events.UISourceCodeAdded,Workspace.workspace,matches);};TestRunner.waitForUISourceCodeRemoved=function(callback){Workspace.workspace.once(Workspace.Workspace.Events.UISourceCodeRemoved).then(callback);};TestRunner.url=function(url=''){const testScriptURL=(Root.Runtime.queryParam('test'));return new URL(url,testScriptURL+'/../').href;};TestRunner.dumpSyntaxHighlight=function(str,mimeType){const node=document.createElement('span');node.textContent=str;const javascriptSyntaxHighlighter=new UI.SyntaxHighlighter(mimeType,false);return javascriptSyntaxHighlighter.syntaxHighlightNode(node).then(dumpSyntax);function dumpSyntax(){const node_parts=[];for(let i=0;i `).then(()=>TestRunner._executeTestScript());} targetRemoved(target){}};TestRunner._isDebugTest=function(){return!self.testRunner||!!Root.Runtime.queryParam('debugFrontend');};TestRunner._isStartupTest=function(){return Root.Runtime.queryParam('test').includes('/startup/');};(async function(){function completeTestOnError(message,source,lineno,colno,error){TestRunner.addResult('TEST ENDED IN ERROR: '+error.stack);TestRunner.completeTest();} self['onerror']=completeTestOnError;TestRunner._printDevToolsConsole();SDK.targetManager.observeTargets(new TestRunner._TestObserver());if(!TestRunner._isStartupTest()){return;} TestRunner._initializeTargetForStartupTest=TestRunner.override(Main.Main._instanceForTest,'_initializeTarget',()=>undefined).bind(Main.Main._instanceForTest);await TestRunner.addSnifferPromise(Main.Main._instanceForTest,'_showAppUI');TestRunner._executeTestScript();})();;;