/*-----------------------------------------------------------------------main-+ | | +----------------------------------------------------------------------------*/ int main(int argc, char ** argv) { if (argc > 1) { switch (*argv[1]) { case 'F': case 'f': testFileStream(); break; case 'K': case 'k': testLinkedList(); break; case 'L': case 'l': testList(); break; case 'M': case 'm': testMemStream(); break; case 'N': case 'n': testTransition(); break; case 'T': case 't': testTransient(); break; case 'U': case 'u': testURI(0); break; case 'W': case 'w': testReaderWriter(); break; } }else { testFileStream(); testMemStream(); testTransient(); testTransition(); testList(); testLinkedList(); testReaderWriter(); testURI("../tests/data/rfc2396.in"); } return 0; }
JSStringRef LayoutTestController::pathToLocalResource(JSContextRef context, JSStringRef url) { GOwnPtr<char> urlCString(JSStringCopyUTF8CString(url)); if (!g_str_has_prefix(urlCString.get(), "file:///tmp/LayoutTests/")) return JSStringRetain(url); const char* layoutTestsSuffix = urlCString.get() + strlen("file:///tmp/"); GOwnPtr<char> testPath(g_build_filename(getTopLevelPath().data(), layoutTestsSuffix, NULL)); GOwnPtr<char> testURI(g_filename_to_uri(testPath.get(), 0, 0)); return JSStringCreateWithUTF8CString(testURI.get()); }
JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url) { size_t urlSize = JSStringGetMaximumUTF8CStringSize(url); GOwnPtr<gchar> urlString(static_cast<gchar*>(g_malloc(urlSize))); JSStringGetUTF8CString(url, urlString.get(), urlSize); if (!g_str_has_prefix(urlString.get(), "file:///tmp/LayoutTests/")) return JSStringRetain(url); const gchar* layoutTestsSuffix = urlString.get() + strlen("file:///tmp/"); GOwnPtr<gchar> testPath(g_build_filename(WTR::topLevelPath().data(), layoutTestsSuffix, NULL)); GOwnPtr<gchar> testURI(g_filename_to_uri(testPath.get(), 0, 0)); return JSStringCreateWithUTF8CString(testURI.get()); }