Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1544)

Unified Diff: content/shell/renderer/test_runner/TestCommon.cpp

Issue 110533009: Import TestRunner library into chromium. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/shell/renderer/test_runner/TestCommon.cpp
diff --git a/content/shell/renderer/test_runner/TestCommon.cpp b/content/shell/renderer/test_runner/TestCommon.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..691ecddd8b36c4db7cdbfacac07eedd38c2519da
--- /dev/null
+++ b/content/shell/renderer/test_runner/TestCommon.cpp
@@ -0,0 +1,37 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#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)) {
+ // adjust file URLs to match upstream results.
+ result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
+ } else if (!url.find(dataUrlPattern)) {
+ // URL-escape data URLs to match results upstream.
+ string path = url.substr(dataUrlPatternSize);
+ result.replace(dataUrlPatternSize, url.length(), path);
+ }
+ return result;
+}
+
+}
« no previous file with comments | « content/shell/renderer/test_runner/TestCommon.h ('k') | content/shell/renderer/test_runner/TestInterfaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698