This source file includes following definitions.
- normalizeLayoutTestURL
#include "content/shell/renderer/test_runner/TestCommon.h"
using namespace std;
namespace WebTestRunner {
namespace {
const char layoutTestsPattern[] = "/LayoutTests/";
const string::size_type layoutTestsPatternSize = sizeof(layoutTestsPattern) - 1;
const char fileUrlPattern[] = "file:/";
const char fileTestPrefix[] = "(file test):";
const char dataUrlPattern[] = "data:";
const string::size_type dataUrlPatternSize = sizeof(dataUrlPattern) - 1;
}
string normalizeLayoutTestURL(const string& url)
{
string result = url;
size_t pos;
if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != string::npos)) {
result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
} else if (!url.find(dataUrlPattern)) {
string path = url.substr(dataUrlPatternSize);
result.replace(dataUrlPatternSize, url.length(), path);
}
return result;
}
}