| 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/test_runner_for_specific_view.h" | 5 #include "components/test_runner/test_runner_for_specific_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <limits> | 8 #include <limits> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 570 | 570 |
| 571 void TestRunnerForSpecificView::DidLosePointerLockInternal() { | 571 void TestRunnerForSpecificView::DidLosePointerLockInternal() { |
| 572 bool was_locked = pointer_locked_; | 572 bool was_locked = pointer_locked_; |
| 573 pointer_locked_ = false; | 573 pointer_locked_ = false; |
| 574 if (was_locked) | 574 if (was_locked) |
| 575 web_view()->didLosePointerLock(); | 575 web_view()->didLosePointerLock(); |
| 576 } | 576 } |
| 577 | 577 |
| 578 bool TestRunnerForSpecificView::CallShouldCloseOnWebView() { | 578 bool TestRunnerForSpecificView::CallShouldCloseOnWebView() { |
| 579 if (!web_view()->mainFrame()->toWebLocalFrame()) { | 579 if (!web_view()->mainFrame()->toWebLocalFrame()) { |
| 580 CHECK(false) << "This function cannot be called if the main frame is not a " | 580 // This function cannot be called if the main frame is not a local frame. |
| 581 "local frame."; | 581 CHECK(false); |
| 582 } | 582 } |
| 583 | 583 |
| 584 return web_view()->mainFrame()->toWebLocalFrame()->dispatchBeforeUnloadEvent( | 584 return web_view()->mainFrame()->toWebLocalFrame()->dispatchBeforeUnloadEvent( |
| 585 false); | 585 false); |
| 586 } | 586 } |
| 587 | 587 |
| 588 void TestRunnerForSpecificView::SetDomainRelaxationForbiddenForURLScheme( | 588 void TestRunnerForSpecificView::SetDomainRelaxationForbiddenForURLScheme( |
| 589 bool forbidden, | 589 bool forbidden, |
| 590 const std::string& scheme) { | 590 const std::string& scheme) { |
| 591 web_view()->setDomainRelaxationForbidden(forbidden, | 591 web_view()->setDomainRelaxationForbidden(forbidden, |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 | 668 |
| 669 WebLocalFrame* frame = web_view()->mainFrame()->toWebLocalFrame(); | 669 WebLocalFrame* frame = web_view()->mainFrame()->toWebLocalFrame(); |
| 670 const bool find_result = frame->find(0, WebString::fromUTF8(search_text), | 670 const bool find_result = frame->find(0, WebString::fromUTF8(search_text), |
| 671 find_options, wrap_around, 0); | 671 find_options, wrap_around, 0); |
| 672 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); | 672 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 673 return find_result; | 673 return find_result; |
| 674 } | 674 } |
| 675 | 675 |
| 676 std::string TestRunnerForSpecificView::SelectionAsMarkup() { | 676 std::string TestRunnerForSpecificView::SelectionAsMarkup() { |
| 677 if (!web_view()->mainFrame()->toWebLocalFrame()) { | 677 if (!web_view()->mainFrame()->toWebLocalFrame()) { |
| 678 CHECK(false) << "This function cannot be called if the main frame is not a " | 678 // This function cannot be called if the main frame is not a local frame. |
| 679 "local frame."; | 679 CHECK(false); |
| 680 } | 680 } |
| 681 return web_view()->mainFrame()->toWebLocalFrame()->selectionAsMarkup().utf8(); | 681 return web_view()->mainFrame()->toWebLocalFrame()->selectionAsMarkup().utf8(); |
| 682 } | 682 } |
| 683 | 683 |
| 684 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, | 684 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, |
| 685 bool enabled) { | 685 bool enabled) { |
| 686 WebFrame* target_frame = | 686 WebFrame* target_frame = |
| 687 web_view()->findFrameByName(WebString::fromUTF8(name)); | 687 web_view()->findFrameByName(WebString::fromUTF8(name)); |
| 688 if (target_frame) | 688 if (target_frame) |
| 689 target_frame->enableViewSourceMode(enabled); | 689 target_frame->enableViewSourceMode(enabled); |
| 690 } | 690 } |
| 691 | 691 |
| 692 blink::WebView* TestRunnerForSpecificView::web_view() { | 692 blink::WebView* TestRunnerForSpecificView::web_view() { |
| 693 return web_view_test_proxy_base_->web_view(); | 693 return web_view_test_proxy_base_->web_view(); |
| 694 } | 694 } |
| 695 | 695 |
| 696 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 696 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
| 697 return web_view_test_proxy_base_->delegate(); | 697 return web_view_test_proxy_base_->delegate(); |
| 698 } | 698 } |
| 699 | 699 |
| 700 } // namespace test_runner | 700 } // namespace test_runner |
| OLD | NEW |