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 "components/test_runner/web_frame_test_client.h" | 5 #include "components/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 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 result = blink::WebNavigationPolicyIgnore; | 723 result = blink::WebNavigationPolicyIgnore; |
724 | 724 |
725 if (test_runner_->policyDelegateShouldNotifyDone()) { | 725 if (test_runner_->policyDelegateShouldNotifyDone()) { |
726 test_runner_->policyDelegateDone(); | 726 test_runner_->policyDelegateDone(); |
727 result = blink::WebNavigationPolicyIgnore; | 727 result = blink::WebNavigationPolicyIgnore; |
728 } | 728 } |
729 | 729 |
730 return result; | 730 return result; |
731 } | 731 } |
732 | 732 |
733 bool WebFrameTestClient::willCheckAndDispatchMessageEvent( | |
734 blink::WebLocalFrame* source_frame, | |
735 blink::WebFrame* target_frame, | |
736 blink::WebSecurityOrigin target, | |
737 blink::WebDOMMessageEvent event) { | |
738 if (test_runner_->shouldInterceptPostMessage()) { | |
739 delegate_->PrintMessage("intercepted postMessage\n"); | |
740 return true; | |
741 } | |
742 | |
743 return false; | |
744 } | |
745 | |
746 void WebFrameTestClient::checkIfAudioSinkExistsAndIsAuthorized( | 733 void WebFrameTestClient::checkIfAudioSinkExistsAndIsAuthorized( |
747 const blink::WebString& sink_id, | 734 const blink::WebString& sink_id, |
748 const blink::WebSecurityOrigin& security_origin, | 735 const blink::WebSecurityOrigin& security_origin, |
749 blink::WebSetSinkIdCallbacks* web_callbacks) { | 736 blink::WebSetSinkIdCallbacks* web_callbacks) { |
750 std::unique_ptr<blink::WebSetSinkIdCallbacks> callback(web_callbacks); | 737 std::unique_ptr<blink::WebSetSinkIdCallbacks> callback(web_callbacks); |
751 std::string device_id = sink_id.utf8(); | 738 std::string device_id = sink_id.utf8(); |
752 if (device_id == "valid" || device_id.empty()) | 739 if (device_id == "valid" || device_id.empty()) |
753 callback->onSuccess(); | 740 callback->onSuccess(); |
754 else if (device_id == "unauthorized") | 741 else if (device_id == "unauthorized") |
755 callback->onError(blink::WebSetSinkIdError::NotAuthorized); | 742 callback->onError(blink::WebSetSinkIdError::NotAuthorized); |
756 else | 743 else |
757 callback->onError(blink::WebSetSinkIdError::NotFound); | 744 callback->onError(blink::WebSetSinkIdError::NotFound); |
758 } | 745 } |
759 | 746 |
760 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { | 747 void WebFrameTestClient::didClearWindowObject(blink::WebLocalFrame* frame) { |
761 web_test_proxy_base_->test_interfaces()->BindTo(frame); | 748 web_test_proxy_base_->test_interfaces()->BindTo(frame); |
762 web_test_proxy_base_->BindTo(frame); | 749 web_test_proxy_base_->BindTo(frame); |
763 } | 750 } |
764 | 751 |
765 } // namespace test_runner | 752 } // namespace test_runner |
OLD | NEW |