| OLD | NEW |
| 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 Loading... |
| 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 | |
| 1274 void WebTestProxyBase::didCreateDataSource(WebFrame*, WebDataSource* ds) | 1255 void WebTestProxyBase::didCreateDataSource(WebFrame*, WebDataSource* ds) |
| 1275 { | 1256 { |
| 1276 if (!m_testInterfaces->testRunner()->deferMainResourceDataLoad()) | 1257 if (!m_testInterfaces->testRunner()->deferMainResourceDataLoad()) |
| 1277 ds->setDeferMainResourceDataLoad(false); | 1258 ds->setDeferMainResourceDataLoad(false); |
| 1278 } | 1259 } |
| 1279 | 1260 |
| 1280 void WebTestProxyBase::willSendRequest(WebFrame*, unsigned identifier, WebKit::W
ebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) | 1261 void WebTestProxyBase::willSendRequest(WebFrame*, unsigned identifier, WebKit::W
ebURLRequest& request, const WebKit::WebURLResponse& redirectResponse) |
| 1281 { | 1262 { |
| 1282 // Need to use GURL for host() and SchemeIs() | 1263 // Need to use GURL for host() and SchemeIs() |
| 1283 GURL url = request.url(); | 1264 GURL url = request.url(); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 m_delegate->printMessage("<unknown>"); | 1375 m_delegate->printMessage("<unknown>"); |
| 1395 else | 1376 else |
| 1396 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); | 1377 m_delegate->printMessage(m_resourceIdentifierMap[identifier]); |
| 1397 m_delegate->printMessage(" - didFailLoadingWithError: "); | 1378 m_delegate->printMessage(" - didFailLoadingWithError: "); |
| 1398 m_delegate->printMessage(m_delegate->makeURLErrorDescription(error)); | 1379 m_delegate->printMessage(m_delegate->makeURLErrorDescription(error)); |
| 1399 m_delegate->printMessage("\n"); | 1380 m_delegate->printMessage("\n"); |
| 1400 } | 1381 } |
| 1401 m_resourceIdentifierMap.erase(identifier); | 1382 m_resourceIdentifierMap.erase(identifier); |
| 1402 } | 1383 } |
| 1403 | 1384 |
| 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 | |
| 1413 void WebTestProxyBase::didAddMessageToConsole(const WebConsoleMessage& message,
const WebString& sourceName, unsigned sourceLine) | 1385 void WebTestProxyBase::didAddMessageToConsole(const WebConsoleMessage& message,
const WebString& sourceName, unsigned sourceLine) |
| 1414 { | 1386 { |
| 1415 // This matches win DumpRenderTree's UIDelegate.cpp. | 1387 // This matches win DumpRenderTree's UIDelegate.cpp. |
| 1416 if (!m_logConsoleOutput) | 1388 if (!m_logConsoleOutput) |
| 1417 return; | 1389 return; |
| 1418 m_delegate->printMessage(string("CONSOLE MESSAGE: ")); | 1390 m_delegate->printMessage(string("CONSOLE MESSAGE: ")); |
| 1419 if (sourceLine) { | 1391 if (sourceLine) { |
| 1420 char buffer[40]; | 1392 char buffer[40]; |
| 1421 snprintf(buffer, sizeof(buffer), "line %d: ", sourceLine); | 1393 snprintf(buffer, sizeof(buffer), "line %d: ", sourceLine); |
| 1422 m_delegate->printMessage(buffer); | 1394 m_delegate->printMessage(buffer); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1490 { | 1462 { |
| 1491 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) { | 1463 if (m_testInterfaces->testRunner()->shouldInterceptPostMessage()) { |
| 1492 m_delegate->printMessage("intercepted postMessage\n"); | 1464 m_delegate->printMessage("intercepted postMessage\n"); |
| 1493 return true; | 1465 return true; |
| 1494 } | 1466 } |
| 1495 | 1467 |
| 1496 return false; | 1468 return false; |
| 1497 } | 1469 } |
| 1498 | 1470 |
| 1499 } | 1471 } |
| OLD | NEW |