self.ApplicationTestRunner=self.ApplicationTestRunner||{},ApplicationTestRunner.resetState=async function(){const e=self.SDK.targetManager.targets();for(const n of e){const e=new Common.ParsedURL(n.inspectedURL()).securityOrigin();await n.storageAgent().clearDataForOrigin(e,Resources.StorageView.AllStorageTypes.join(","))}},ApplicationTestRunner.createWebSQLDatabase=function(e){return TestRunner.evaluateInPageAsync(`_openWebSQLDatabase("${e}")`)},ApplicationTestRunner.requestURLComparer=function(e,n){return e.request.url.localeCompare(n.request.url)},ApplicationTestRunner.runAfterCachedResourcesProcessed=function(e){TestRunner.resourceTreeModel._cachedResourcesProcessed?e():TestRunner.resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.CachedResourcesLoaded,e)},ApplicationTestRunner.runAfterResourcesAreFinished=function(e,n){const r=new Set(e);function o(){for(const e of r){ApplicationTestRunner.resourceMatchingURL(e)&&r.delete(e)}r.size||(TestRunner.resourceTreeModel.removeEventListener(SDK.ResourceTreeModel.Events.ResourceAdded,o),n())}o(),r.size&&TestRunner.resourceTreeModel.addEventListener(SDK.ResourceTreeModel.Events.ResourceAdded,o)},ApplicationTestRunner.showResource=function(e,n){let r=!1;function o(e){r||(n(e),r=!0)}ApplicationTestRunner.runAfterResourcesAreFinished([e],(function(){const n=ApplicationTestRunner.resourceMatchingURL(e);if(!n)return;UI.panels.resources.showResource(n,1);const r=UI.panels.resources._resourceViewForResource(n);r.loaded?o(r):TestRunner.addSniffer(r,"setContent",o.bind(null,r))}))},ApplicationTestRunner.resourceMatchingURL=function(e){let n=null;return TestRunner.resourceTreeModel.forAllResources((function(r){if(-1!==r.url.indexOf(e))return n=r,!0})),n},ApplicationTestRunner.findTreeElement=function(e,n){if(0===n.length)return e;const r=e.children().find((e=>e.title===n[0]));return r?(r.expand(),ApplicationTestRunner.findTreeElement(r,n.slice(1))):null},ApplicationTestRunner.waitForCookies=function(){return new Promise((e=>{TestRunner.addSniffer(CookieTable.CookiesTable.prototype,"_rebuildTable",e)}))},ApplicationTestRunner.dumpCookieDomains=function(){const e=UI.panels.resources._sidebar.cookieListTreeElement.children();TestRunner.addResult("Available cookie domains:");for(const n of e)TestRunner.addResult(n._cookieDomain)},ApplicationTestRunner.dumpCookies=function(){if(UI.panels.resources._cookieView&&UI.panels.resources._cookieView.isShowing()){TestRunner.addResult("Visible cookies");for(const e of UI.panels.resources._cookieView._cookiesTable._data){const n=e.cookies||[];for(const e of n)TestRunner.addResult(`${e.name()}=${e.value()}`)}}else TestRunner.addResult("No cookies visible")},ApplicationTestRunner.databaseModel=function(){return TestRunner.mainTarget.model(Resources.DatabaseModel)},ApplicationTestRunner.domStorageModel=function(){return TestRunner.mainTarget.model(Resources.DOMStorageModel)},ApplicationTestRunner.indexedDBModel=function(){return TestRunner.mainTarget.model(Resources.IndexedDBModel)},TestRunner.deprecatedInitAsync("\n  function _openWebSQLDatabase(name) {\n    return new Promise(resolve => openDatabase(name, '1.0', '', 1024 * 1024, resolve));\n  }\n");