protected function MediaImageTest::getLastPreviewRequestTransferSize in Entity Embed 8
Gets the transfer size of the last preview request.
Return value
int The transfer size in octets.
1 call to MediaImageTest::getLastPreviewRequestTransferSize()
- MediaImageTest::testPreviewUsesDefaultThemeAndIsClientCacheable in tests/
src/ FunctionalJavascript/ MediaImageTest.php - The CKEditor Widget must load a preview generated using the default theme.
File
- tests/
src/ FunctionalJavascript/ MediaImageTest.php, line 757
Class
- MediaImageTest
- Test Media Image specific functionality.
Namespace
Drupal\Tests\entity_embed\FunctionalJavascriptCode
protected function getLastPreviewRequestTransferSize() {
$this
->getSession()
->switchToIFrame();
$javascript = <<<JS
(function(){
return window.performance
.getEntries()
.filter(function (entry) {
return entry.initiatorType == 'xmlhttprequest' && entry.name.indexOf('/entity-embed/preview/') !== -1;
})
.pop()
.transferSize;
})()
JS;
return $this
->getSession()
->evaluateScript($javascript);
}