| Index: components/test_runner/test_common.cc
|
| diff --git a/components/test_runner/test_common.cc b/components/test_runner/test_common.cc
|
| index c488b1111f7e7933b7f3c8f41d6faf579b524ba6..ecd58ea301b9ca2b70c86a72ea6c7e2c92a2efd7 100644
|
| --- a/components/test_runner/test_common.cc
|
| +++ b/components/test_runner/test_common.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/rand_util.h"
|
| #include "third_party/WebKit/public/platform/Platform.h"
|
| #include "third_party/WebKit/public/web/WebKit.h"
|
| +#include "third_party/WebKit/public/web/WebNavigationPolicy.h"
|
|
|
| namespace test_runner {
|
|
|
| @@ -44,6 +45,15 @@ class MockBlinkPlatform : NON_EXPORTED_BASE(public blink::Platform) {
|
| base::LazyInstance<MockBlinkPlatform>::Leaky g_mock_blink_platform =
|
| LAZY_INSTANCE_INITIALIZER;
|
|
|
| +const char* kIllegalString = "illegal value";
|
| +const char* kPolicyIgnore = "Ignore";
|
| +const char* kPolicyDownload = "download";
|
| +const char* kPolicyCurrentTab = "current tab";
|
| +const char* kPolicyNewBackgroundTab = "new background tab";
|
| +const char* kPolicyNewForegroundTab = "new foreground tab";
|
| +const char* kPolicyNewWindow = "new window";
|
| +const char* kPolicyNewPopup = "new popup";
|
| +
|
| } // namespace
|
|
|
| std::string NormalizeLayoutTestURL(const std::string& url) {
|
| @@ -61,6 +71,34 @@ std::string NormalizeLayoutTestURL(const std::string& url) {
|
| return result;
|
| }
|
|
|
| +std::string URLDescription(const GURL& url) {
|
| + if (url.SchemeIs(url::kFileScheme))
|
| + return url.ExtractFileName();
|
| + return url.possibly_invalid_spec();
|
| +}
|
| +
|
| +const char* WebNavigationPolicyToString(
|
| + const blink::WebNavigationPolicy& policy) {
|
| + switch (policy) {
|
| + case blink::WebNavigationPolicyIgnore:
|
| + return kPolicyIgnore;
|
| + case blink::WebNavigationPolicyDownload:
|
| + return kPolicyDownload;
|
| + case blink::WebNavigationPolicyCurrentTab:
|
| + return kPolicyCurrentTab;
|
| + case blink::WebNavigationPolicyNewBackgroundTab:
|
| + return kPolicyNewBackgroundTab;
|
| + case blink::WebNavigationPolicyNewForegroundTab:
|
| + return kPolicyNewForegroundTab;
|
| + case blink::WebNavigationPolicyNewWindow:
|
| + return kPolicyNewWindow;
|
| + case blink::WebNavigationPolicyNewPopup:
|
| + return kPolicyNewPopup;
|
| + default:
|
| + return kIllegalString;
|
| + }
|
| +}
|
| +
|
| void EnsureBlinkInitialized() {
|
| g_mock_blink_platform.Get();
|
| }
|
|
|