/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void HtmlCollector::CollectResult(const std::string& id,
const FailStatus status,
const std::string& reason,
- const bool& isPerformanceTest,
- const std::chrono::system_clock::duration& performanceTime,
- const std::chrono::system_clock::duration& performanceMaxTime)
+ const ConstPerformanceResultPtr &performanceResult)
{
using namespace DPL::Colors::Html;
std::string tmp = "'" + id + "' ...";
fprintf(m_fp.Get(), "Running test case %-100s", tmp.c_str());
switch (status) {
case FailStatus::NONE:
- if (isPerformanceTest) {
- if (performanceMaxTime <= std::chrono::microseconds::zero()) {
- fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME,
- get_milliseconds(performanceTime));
- break;
- } else {
- if (performanceTime > performanceMaxTime)
- fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_TOO_LONG(
- get_milliseconds(performanceTime),
- get_milliseconds(performanceMaxTime)));
- else
- fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_MAX(
- get_milliseconds(performanceTime),
- get_milliseconds(performanceMaxTime)));
- break;
- }
+ if (!performanceResult) {
+ fprintf(m_fp.Get(), GREEN_RESULT_OK);
+ break;
}
- fprintf(m_fp.Get(), GREEN_RESULT_OK);
+ if (!performanceResult->IsMaxDuration()) {
+ fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME,
+ get_milliseconds(performanceResult->GetDuration()));
+ break;
+ }
+ if (!performanceResult->IsDurationOk()) {
+ fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_TOO_LONG(
+ get_milliseconds(performanceResult->GetDuration()),
+ get_milliseconds(performanceResult->GetMaxDuration())));
+ break;
+ }
+ fprintf(m_fp.Get(), GREEN_RESULT_OK_TIME_MAX(
+ get_milliseconds(performanceResult->GetDuration()),
+ get_milliseconds(performanceResult->GetMaxDuration())));
break;
case FailStatus::FAILED:
PrintfErrorMessage(" FAILED ", reason);