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

Unified Diff: content/shell/renderer/test_runner/web_test_proxy.cc

Issue 995773002: Add testRunner.dumpNavigationPolicy() to be able to the the navigation policy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: updates Created 5 years, 9 months 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
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/renderer/test_runner/web_test_proxy.cc
diff --git a/content/shell/renderer/test_runner/web_test_proxy.cc b/content/shell/renderer/test_runner/web_test_proxy.cc
index 37aa1f7bfaf859ddb2a809c3fcb91fe071f6d810..658d9fba639323b512ffacaf61e0f0db18a7d7f1 100644
--- a/content/shell/renderer/test_runner/web_test_proxy.cc
+++ b/content/shell/renderer/test_runner/web_test_proxy.cc
@@ -238,6 +238,34 @@ const char* WebNavigationTypeToString(blink::WebNavigationType type) {
return kIllegalString;
}
+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";
+
+const char* WebNavigationPolicyToString(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;
+ }
+ return kIllegalString;
+}
+
std::string DumpFrameHeaderIfNeeded(blink::WebFrame* frame) {
std::string result;
@@ -1293,6 +1321,13 @@ void WebTestProxyBase::CheckDone(blink::WebLocalFrame* frame,
blink::WebNavigationPolicy WebTestProxyBase::DecidePolicyForNavigation(
const blink::WebFrameClient::NavigationPolicyInfo& info) {
+ if (test_interfaces_->GetTestRunner()->shouldDumpNavigationPolicy()) {
+ delegate_->PrintMessage("Default policy for navigation to '" +
+ URLDescription(info.urlRequest.url()) + "' is '" +
+ WebNavigationPolicyToString(info.defaultPolicy) +
+ "'\n");
+ }
+
blink::WebNavigationPolicy result;
if (!test_interfaces_->GetTestRunner()->policyDelegateEnabled())
return info.defaultPolicy;
« no previous file with comments | « content/shell/renderer/test_runner/test_runner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698