Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 5 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 6 | 6 |
| 7 #include <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1207 unsigned identifier) { | 1207 unsigned identifier) { |
| 1208 if (test_interfaces_->GetTestRunner()->shouldDumpResourceLoadCallbacks()) { | 1208 if (test_interfaces_->GetTestRunner()->shouldDumpResourceLoadCallbacks()) { |
| 1209 if (resource_identifier_map_.find(identifier) == | 1209 if (resource_identifier_map_.find(identifier) == |
| 1210 resource_identifier_map_.end()) | 1210 resource_identifier_map_.end()) |
| 1211 delegate_->PrintMessage("<unknown>"); | 1211 delegate_->PrintMessage("<unknown>"); |
| 1212 else | 1212 else |
| 1213 delegate_->PrintMessage(resource_identifier_map_[identifier]); | 1213 delegate_->PrintMessage(resource_identifier_map_[identifier]); |
| 1214 delegate_->PrintMessage(" - didFinishLoading\n"); | 1214 delegate_->PrintMessage(" - didFinishLoading\n"); |
| 1215 } | 1215 } |
| 1216 resource_identifier_map_.erase(identifier); | 1216 resource_identifier_map_.erase(identifier); |
| 1217 #if !defined(ENABLE_LOAD_COMPLETION_HACKS) | |
| 1218 CheckDone(frame, ResourceLoadCompleted); | 1217 CheckDone(frame, ResourceLoadCompleted); |
| 1219 #endif | |
| 1220 } | 1218 } |
| 1221 | 1219 |
| 1222 void WebTestProxyBase::DidAddMessageToConsole( | 1220 void WebTestProxyBase::DidAddMessageToConsole( |
| 1223 const blink::WebConsoleMessage& message, | 1221 const blink::WebConsoleMessage& message, |
| 1224 const blink::WebString& source_name, | 1222 const blink::WebString& source_name, |
| 1225 unsigned source_line) { | 1223 unsigned source_line) { |
| 1226 // This matches win DumpRenderTree's UIDelegate.cpp. | 1224 // This matches win DumpRenderTree's UIDelegate.cpp. |
| 1227 if (!log_console_output_) | 1225 if (!log_console_output_) |
| 1228 return; | 1226 return; |
| 1229 std::string level; | 1227 std::string level; |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1258 } | 1256 } |
| 1259 delegate_->PrintMessage(new_message); | 1257 delegate_->PrintMessage(new_message); |
| 1260 } | 1258 } |
| 1261 delegate_->PrintMessage(std::string("\n")); | 1259 delegate_->PrintMessage(std::string("\n")); |
| 1262 } | 1260 } |
| 1263 | 1261 |
| 1264 void WebTestProxyBase::CheckDone(blink::WebLocalFrame* frame, | 1262 void WebTestProxyBase::CheckDone(blink::WebLocalFrame* frame, |
| 1265 CheckDoneReason reason) { | 1263 CheckDoneReason reason) { |
| 1266 if (frame != test_interfaces_->GetTestRunner()->topLoadingFrame()) | 1264 if (frame != test_interfaces_->GetTestRunner()->topLoadingFrame()) |
| 1267 return; | 1265 return; |
| 1268 | |
| 1269 #if !defined(ENABLE_LOAD_COMPLETION_HACKS) | |
| 1270 // Quirk for MHTML prematurely completing on resource load completion. | |
|
Nate Chapin
2014/12/11 18:21:13
I found the bugs that required this quirk, the las
| |
| 1271 std::string mime_type = frame->dataSource()->response().mimeType().utf8(); | |
| 1272 if (reason == ResourceLoadCompleted && mime_type == "multipart/related") | |
| 1273 return; | |
| 1274 | |
| 1275 if (reason != MainResourceLoadFailed && | 1266 if (reason != MainResourceLoadFailed && |
| 1276 (frame->isResourceLoadInProgress() || frame->isLoading())) | 1267 (frame->isResourceLoadInProgress() || frame->isLoading())) |
| 1277 return; | 1268 return; |
| 1278 #endif | |
| 1279 test_interfaces_->GetTestRunner()->setTopLoadingFrame(frame, true); | 1269 test_interfaces_->GetTestRunner()->setTopLoadingFrame(frame, true); |
| 1280 } | 1270 } |
| 1281 | 1271 |
| 1282 blink::WebNavigationPolicy WebTestProxyBase::DecidePolicyForNavigation( | 1272 blink::WebNavigationPolicy WebTestProxyBase::DecidePolicyForNavigation( |
| 1283 const blink::WebFrameClient::NavigationPolicyInfo& info) { | 1273 const blink::WebFrameClient::NavigationPolicyInfo& info) { |
| 1284 blink::WebNavigationPolicy result; | 1274 blink::WebNavigationPolicy result; |
| 1285 if (!test_interfaces_->GetTestRunner()->policyDelegateEnabled()) | 1275 if (!test_interfaces_->GetTestRunner()->policyDelegateEnabled()) |
| 1286 return info.defaultPolicy; | 1276 return info.defaultPolicy; |
| 1287 | 1277 |
| 1288 delegate_->PrintMessage( | 1278 delegate_->PrintMessage( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1334 if (!push_client_.get()) | 1324 if (!push_client_.get()) |
| 1335 push_client_.reset(new MockWebPushClient); | 1325 push_client_.reset(new MockWebPushClient); |
| 1336 return push_client_.get(); | 1326 return push_client_.get(); |
| 1337 } | 1327 } |
| 1338 | 1328 |
| 1339 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { | 1329 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { |
| 1340 return GetPushClientMock(); | 1330 return GetPushClientMock(); |
| 1341 } | 1331 } |
| 1342 | 1332 |
| 1343 } // namespace content | 1333 } // namespace content |
| OLD | NEW |