| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test_runner/web_frame_test_client.h" | 5 #include "content/shell/test_runner/web_frame_test_client.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 | 431 |
| 432 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { | 432 if (test_runner()->shouldDumpUserGestureInFrameLoadCallbacks()) { |
| 433 PrintFrameuserGestureStatus(delegate_, | 433 PrintFrameuserGestureStatus(delegate_, |
| 434 web_frame_test_proxy_base_->web_frame(), | 434 web_frame_test_proxy_base_->web_frame(), |
| 435 " - in didStartProvisionalLoadForFrame\n"); | 435 " - in didStartProvisionalLoadForFrame\n"); |
| 436 } | 436 } |
| 437 } | 437 } |
| 438 | 438 |
| 439 void WebFrameTestClient::didReceiveServerRedirectForProvisionalLoad( | 439 void WebFrameTestClient::didReceiveServerRedirectForProvisionalLoad( |
| 440 blink::WebLocalFrame* frame) { | 440 blink::WebLocalFrame* frame) { |
| 441 DCHECK_EQ(frame, web_frame_test_proxy_base_->web_frame()); |
| 441 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 442 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 442 PrintFrameDescription(delegate_, frame); | 443 PrintFrameDescription(delegate_, frame); |
| 443 delegate_->PrintMessage( | 444 delegate_->PrintMessage( |
| 444 " - didReceiveServerRedirectForProvisionalLoadForFrame\n"); | 445 " - didReceiveServerRedirectForProvisionalLoadForFrame\n"); |
| 445 } | 446 } |
| 446 } | 447 } |
| 447 | 448 |
| 448 void WebFrameTestClient::didFailProvisionalLoad( | 449 void WebFrameTestClient::didFailProvisionalLoad( |
| 449 blink::WebLocalFrame* frame, | 450 blink::WebLocalFrame* frame, |
| 450 const blink::WebURLError& error, | 451 const blink::WebURLError& error, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 481 | 482 |
| 482 void WebFrameTestClient::didChangeIcon(blink::WebLocalFrame* frame, | 483 void WebFrameTestClient::didChangeIcon(blink::WebLocalFrame* frame, |
| 483 blink::WebIconURL::Type icon_type) { | 484 blink::WebIconURL::Type icon_type) { |
| 484 if (test_runner()->shouldDumpIconChanges()) { | 485 if (test_runner()->shouldDumpIconChanges()) { |
| 485 PrintFrameDescription(delegate_, frame); | 486 PrintFrameDescription(delegate_, frame); |
| 486 delegate_->PrintMessage(std::string(" - didChangeIcons\n")); | 487 delegate_->PrintMessage(std::string(" - didChangeIcons\n")); |
| 487 } | 488 } |
| 488 } | 489 } |
| 489 | 490 |
| 490 void WebFrameTestClient::didFinishDocumentLoad(blink::WebLocalFrame* frame) { | 491 void WebFrameTestClient::didFinishDocumentLoad(blink::WebLocalFrame* frame) { |
| 492 DCHECK_EQ(frame, web_frame_test_proxy_base_->web_frame()); |
| 491 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 493 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 492 PrintFrameDescription(delegate_, frame); | 494 PrintFrameDescription(delegate_, frame); |
| 493 delegate_->PrintMessage(" - didFinishDocumentLoadForFrame\n"); | 495 delegate_->PrintMessage(" - didFinishDocumentLoadForFrame\n"); |
| 494 } | 496 } |
| 495 } | 497 } |
| 496 | 498 |
| 497 void WebFrameTestClient::didHandleOnloadEvents(blink::WebLocalFrame* frame) { | 499 void WebFrameTestClient::didHandleOnloadEvents(blink::WebLocalFrame* frame) { |
| 500 DCHECK_EQ(frame, web_frame_test_proxy_base_->web_frame()); |
| 498 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 501 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 499 PrintFrameDescription(delegate_, frame); | 502 PrintFrameDescription(delegate_, frame); |
| 500 delegate_->PrintMessage(" - didHandleOnloadEventsForFrame\n"); | 503 delegate_->PrintMessage(" - didHandleOnloadEventsForFrame\n"); |
| 501 } | 504 } |
| 502 } | 505 } |
| 503 | 506 |
| 504 void WebFrameTestClient::didFailLoad(blink::WebLocalFrame* frame, | 507 void WebFrameTestClient::didFailLoad(blink::WebLocalFrame* frame, |
| 505 const blink::WebURLError& error, | 508 const blink::WebURLError& error, |
| 506 blink::WebHistoryCommitType commit_type) { | 509 blink::WebHistoryCommitType commit_type) { |
| 507 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 510 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 508 PrintFrameDescription(delegate_, frame); | 511 PrintFrameDescription(delegate_, frame); |
| 509 delegate_->PrintMessage(" - didFailLoadWithError\n"); | 512 delegate_->PrintMessage(" - didFailLoadWithError\n"); |
| 510 } | 513 } |
| 511 } | 514 } |
| 512 | 515 |
| 513 void WebFrameTestClient::didFinishLoad(blink::WebLocalFrame* frame) { | 516 void WebFrameTestClient::didFinishLoad(blink::WebLocalFrame* frame) { |
| 517 DCHECK_EQ(frame, web_frame_test_proxy_base_->web_frame()); |
| 514 if (test_runner()->shouldDumpFrameLoadCallbacks()) { | 518 if (test_runner()->shouldDumpFrameLoadCallbacks()) { |
| 515 PrintFrameDescription(delegate_, frame); | 519 PrintFrameDescription(delegate_, frame); |
| 516 delegate_->PrintMessage(" - didFinishLoadForFrame\n"); | 520 delegate_->PrintMessage(" - didFinishLoadForFrame\n"); |
| 517 } | 521 } |
| 518 } | 522 } |
| 519 | 523 |
| 520 void WebFrameTestClient::didNavigateWithinPage( | 524 void WebFrameTestClient::didNavigateWithinPage( |
| 521 blink::WebLocalFrame* frame, | 525 blink::WebLocalFrame* frame, |
| 522 const blink::WebHistoryItem& history_item, | 526 const blink::WebHistoryItem& history_item, |
| 523 blink::WebHistoryCommitType commit_type, | 527 blink::WebHistoryCommitType commit_type, |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 721 std::string device_id = sink_id.utf8(); | 725 std::string device_id = sink_id.utf8(); |
| 722 if (device_id == "valid" || device_id.empty()) | 726 if (device_id == "valid" || device_id.empty()) |
| 723 callback->onSuccess(); | 727 callback->onSuccess(); |
| 724 else if (device_id == "unauthorized") | 728 else if (device_id == "unauthorized") |
| 725 callback->onError(blink::WebSetSinkIdError::NotAuthorized); | 729 callback->onError(blink::WebSetSinkIdError::NotAuthorized); |
| 726 else | 730 else |
| 727 callback->onError(blink::WebSetSinkIdError::NotFound); | 731 callback->onError(blink::WebSetSinkIdError::NotFound); |
| 728 } | 732 } |
| 729 | 733 |
| 730 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { | 734 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { |
| 735 DCHECK_EQ(frame, web_frame_test_proxy_base_->web_frame()); |
| 731 web_view_test_proxy_base_->test_interfaces()->BindTo(frame); | 736 web_view_test_proxy_base_->test_interfaces()->BindTo(frame); |
| 732 web_view_test_proxy_base_->BindTo(frame); | 737 web_view_test_proxy_base_->BindTo(frame); |
| 733 delegate_->GetWebWidgetTestProxyBase(frame)->BindTo(frame); | 738 delegate_->GetWebWidgetTestProxyBase(frame)->BindTo(frame); |
| 734 } | 739 } |
| 735 | 740 |
| 736 bool WebFrameTestClient::runFileChooser( | 741 bool WebFrameTestClient::runFileChooser( |
| 737 const blink::WebFileChooserParams& params, | 742 const blink::WebFileChooserParams& params, |
| 738 blink::WebFileChooserCompletion* completion) { | 743 blink::WebFileChooserCompletion* completion) { |
| 739 delegate_->PrintMessage("Mock: Opening a file chooser.\n"); | 744 delegate_->PrintMessage("Mock: Opening a file chooser.\n"); |
| 740 // FIXME: Add ability to set file names to a file upload control. | 745 // FIXME: Add ability to set file names to a file upload control. |
| 741 return false; | 746 return false; |
| 742 } | 747 } |
| 743 | 748 |
| 744 blink::WebEffectiveConnectionType | 749 blink::WebEffectiveConnectionType |
| 745 WebFrameTestClient::getEffectiveConnectionType() { | 750 WebFrameTestClient::getEffectiveConnectionType() { |
| 746 return test_runner()->effective_connection_type(); | 751 return test_runner()->effective_connection_type(); |
| 747 } | 752 } |
| 748 | 753 |
| 749 TestRunner* WebFrameTestClient::test_runner() { | 754 TestRunner* WebFrameTestClient::test_runner() { |
| 750 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); | 755 return web_view_test_proxy_base_->test_interfaces()->GetTestRunner(); |
| 751 } | 756 } |
| 752 | 757 |
| 753 } // namespace test_runner | 758 } // namespace test_runner |
| OLD | NEW |