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

Side by Side Diff: Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp

Issue 14495011: Revert "Create errors (especially cancellation errors) internally to WebCore, rather" (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 if (element.hasAttribute("id")) 1245 if (element.hasAttribute("id"))
1246 m_delegate->printMessage(string("id '") + element.getAttribute(" id").utf8().data() + "'"); 1246 m_delegate->printMessage(string("id '") + element.getAttribute(" id").utf8().data() + "'");
1247 else 1247 else
1248 m_delegate->printMessage("no id"); 1248 m_delegate->printMessage("no id");
1249 } else 1249 } else
1250 m_delegate->printMessage(string(" - ") + request.initiatorName().utf 8().data()); 1250 m_delegate->printMessage(string(" - ") + request.initiatorName().utf 8().data());
1251 m_delegate->printMessage(string(" requested '") + URLDescription(request .urlRequest().url()).c_str() + "'\n"); 1251 m_delegate->printMessage(string(" requested '") + URLDescription(request .urlRequest().url()).c_str() + "'\n");
1252 } 1252 }
1253 } 1253 }
1254 1254
1255 bool WebTestProxyBase::canHandleRequest(WebFrame*, const WebURLRequest& request)
1256 {
1257 GURL url = request.url();
1258 // Just reject the scheme used in
1259 // LayoutTests/http/tests/misc/redirect-to-external-url.html
1260 return !url.SchemeIs("spaceballs");
1261 }
1262
1263 WebURLError WebTestProxyBase::cannotHandleRequestError(WebFrame*, const WebURLRe quest& request)
1264 {
1265 WebURLError error;
1266 // A WebKit layout test expects the following values.
1267 // unableToImplementPolicyWithError() below prints them.
1268 error.domain = WebString::fromUTF8("WebKitErrorDomain");
1269 error.reason = 101;
1270 error.unreachableURL = request.url();
1271 return error;
1272 }
1273
1255 void WebTestProxyBase::didCreateDataSource(WebFrame*, WebDataSource* ds) 1274 void WebTestProxyBase::didCreateDataSource(WebFrame*, WebDataSource* ds)
1256 { 1275 {
1257 if (!m_testInterfaces->testRunner()->deferMainResourceDataLoad()) 1276 if (!m_testInterfaces->testRunner()->deferMainResourceDataLoad())
1258 ds->setDeferMainResourceDataLoad(false); 1277 ds->setDeferMainResourceDataLoad(false);
1259 } 1278 }
1260 1279
1261 void WebTestProxyBase::willSendRequest(WebFrame*, unsigned identifier, WebKit::W ebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) 1280 void WebTestProxyBase::willSendRequest(WebFrame*, unsigned identifier, WebKit::W ebURLRequest& request, const WebKit::WebURLResponse& redirectResponse)
1262 { 1281 {
1263 // Need to use GURL for host() and SchemeIs() 1282 // Need to use GURL for host() and SchemeIs()
1264 GURL url = request.url(); 1283 GURL url = request.url();
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1375 m_delegate->printMessage("<unknown>"); 1394 m_delegate->printMessage("<unknown>");
1376 else 1395 else
1377 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); 1396 m_delegate->printMessage(m_resourceIdentifierMap[identifier]);
1378 m_delegate->printMessage(" - didFailLoadingWithError: "); 1397 m_delegate->printMessage(" - didFailLoadingWithError: ");
1379 m_delegate->printMessage(m_delegate->makeURLErrorDescription(error)); 1398 m_delegate->printMessage(m_delegate->makeURLErrorDescription(error));
1380 m_delegate->printMessage("\n"); 1399 m_delegate->printMessage("\n");
1381 } 1400 }
1382 m_resourceIdentifierMap.erase(identifier); 1401 m_resourceIdentifierMap.erase(identifier);
1383 } 1402 }
1384 1403
1404 void WebTestProxyBase::unableToImplementPolicyWithError(WebKit::WebFrame* frame, const WebKit::WebURLError& error)
1405 {
1406 char errorBuffer[40];
1407 snprintf(errorBuffer, sizeof(errorBuffer), "%d", error.reason);
1408 m_delegate->printMessage(string("Policy delegate: unable to implement policy with error domain '") + error.domain.utf8().data() +
1409 "', error code " + errorBuffer +
1410 ", in frame '" + frame->uniqueName().utf8().data() + "'\n");
1411 }
1412
1385 void WebTestProxyBase::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine) 1413 void WebTestProxyBase::didAddMessageToConsole(const WebConsoleMessage& message, const WebString& sourceName, unsigned sourceLine)
1386 { 1414 {
1387 // This matches win DumpRenderTree's UIDelegate.cpp. 1415 // This matches win DumpRenderTree's UIDelegate.cpp.
1388 if (!m_logConsoleOutput) 1416 if (!m_logConsoleOutput)
1389 return; 1417 return;
1390 m_delegate->printMessage(string("CONSOLE MESSAGE: ")); 1418 m_delegate->printMessage(string("CONSOLE MESSAGE: "));
1391 if (sourceLine) { 1419 if (sourceLine) {
1392 char buffer[40]; 1420 char buffer[40];
1393 snprintf(buffer, sizeof(buffer), "line %d: ", sourceLine); 1421 snprintf(buffer, sizeof(buffer), "line %d: ", sourceLine);
1394 m_delegate->printMessage(buffer); 1422 m_delegate->printMessage(buffer);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 { 1485 {
1458 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) { 1486 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) {
1459 m_delegate->printMessage("intercepted postMessage\n"); 1487 m_delegate->printMessage("intercepted postMessage\n");
1460 return true; 1488 return true;
1461 } 1489 }
1462 1490
1463 return false; 1491 return false;
1464 } 1492 }
1465 1493
1466 } 1494 }
OLDNEW
« no previous file with comments | « Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h ('k') | Tools/DumpRenderTree/chromium/WebViewHost.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698