Ejemplo n.º 1
0
/**
* Draw the checklist image
*
* @param TestStepResult $testStepResult Step results to draw the waterfall for
* @param resource $img
*/
function tbnDrawChecklist($testStepResult, &$img)
{
    global $url;
    require_once __DIR__ . '/optimizationChecklist.inc';
    $requests = $testStepResult->getRequests();
    $img = drawChecklist($testStepResult->readableIdentifier($url), $requests, $testStepResult->getRawResults());
}
Ejemplo n.º 2
0
 /**
  * @param TestStepResult $testStepResult The test results of this step
  * @param UrlGenerator $urlGenerator For video frame URL generation for this tep
  * @param TestPaths $nameOnlyPaths To get the name of the video dir for this step
  * @return array Array with the additional information about this step
  */
 private function getAdditionalInfoArray($testStepResult, $urlGenerator, $nameOnlyPaths)
 {
     $ret = array();
     $progress = $testStepResult->getVisualProgress();
     if (array_key_exists('frames', $progress) && is_array($progress['frames']) && count($progress['frames'])) {
         $ret['videoFrames'] = array();
         foreach ($progress['frames'] as $ms => $frame) {
             $videoFrame = array('time' => $ms);
             $videoFrame['image'] = $urlGenerator->getFile($frame['file'], $nameOnlyPaths->videoDir());
             $videoFrame['VisuallyComplete'] = $frame['progress'];
             $ret['videoFrames'][] = $videoFrame;
         }
     }
     $requests = $testStepResult->getRequests();
     $ret['domains'] = $testStepResult->getDomainBreakdown();
     $ret['breakdown'] = $testStepResult->getMimeTypeBreakdown();
     // add requests
     if (!$this->hasInfoFlag(self::WITHOUT_REQUESTS)) {
         $ret['requests'] = $requests;
     }
     // Check to see if we're adding the console log
     if (!$this->hasInfoFlag(self::WITHOUT_CONSOLE)) {
         $console_log = $testStepResult->getConsoleLog();
         if (isset($console_log)) {
             $ret['consoleLog'] = $console_log;
         }
     }
     $statusMessages = $testStepResult->getStatusMessages();
     if ($statusMessages) {
         $ret['status'] = $statusMessages;
         return $ret;
     }
     return $ret;
 }
Ejemplo n.º 3
0
 /**
  * Print information about all of the requests
  * @param TestStepResult $testResult Result Data for affected run
  * @param $forMedian True if the output is for median, false otherwise
  */
 private function printRequests($testResult, $forMedian)
 {
     if (!$this->shouldPrintInfo(self::INFO_REQUESTS) && !($forMedian && $this->shouldPrintInfo(self::INFO_MEDIAN_REQUESTS))) {
         return;
     }
     echo "<requests>\n";
     $requests = $testResult->getRequests();
     foreach ($requests as &$request) {
         echo "<request number=\"{$request['number']}\">\n";
         foreach ($request as $field => $value) {
             if (!is_array($value)) {
                 echo "<{$field}>" . xml_entities($value) . "</{$field}>\n";
             }
         }
         if (array_key_exists('headers', $request) && is_array($request['headers'])) {
             echo "<headers>\n";
             if (array_key_exists('request', $request['headers']) && is_array($request['headers']['request'])) {
                 echo "<request>\n";
                 foreach ($request['headers']['request'] as $value) {
                     echo "<header>" . xml_entities($value) . "</header>\n";
                 }
                 echo "</request>\n";
             }
             if (array_key_exists('response', $request['headers']) && is_array($request['headers']['response'])) {
                 echo "<response>\n";
                 foreach ($request['headers']['response'] as $value) {
                     echo "<header>" . xml_entities($value) . "</header>\n";
                 }
                 echo "</response>\n";
             }
             echo "</headers>\n";
         }
         echo "</request>\n";
     }
     echo "</requests>\n";
 }