function MediaTest::getLastPreviewRequestTransferSize

Same name in this branch
  1. 9 core/modules/ckeditor/tests/src/FunctionalJavascript/MediaTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\MediaTest::getLastPreviewRequestTransferSize()

Gets the transfer size of the last preview request.

Return value

int The size of the bytes transferred.

1 call to MediaTest::getLastPreviewRequestTransferSize()
MediaTest::testPreviewUsesDefaultThemeAndIsClientCacheable in core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php
The CKEditor Widget must load a preview generated using the default theme.

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/MediaTest.php, line 1658

Class

MediaTest
@coversDefaultClass \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Media @group ckeditor5 @internal

Namespace

Drupal\Tests\ckeditor5\FunctionalJavascript

Code

protected function getLastPreviewRequestTransferSize() {
    $javascript = <<<JS
(function(){
  return window.performance
    .getEntries()
    .filter(function (entry) {
      return entry.initiatorType == 'fetch' && entry.name.indexOf('/media/test_format/preview') !== -1;
    })
    .pop()
    .transferSize;
})()
JS;
    return $this->getSession()
        ->evaluateScript($javascript);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.