| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 } | 666 } |
| 667 | 667 |
| 668 WebLocalFrame* frame = web_view()->mainFrame()->toWebLocalFrame(); | 668 WebLocalFrame* frame = web_view()->mainFrame()->toWebLocalFrame(); |
| 669 const bool find_result = frame->find(0, WebString::fromUTF8(search_text), | 669 const bool find_result = frame->find(0, WebString::fromUTF8(search_text), |
| 670 find_options, wrap_around, 0); | 670 find_options, wrap_around, 0); |
| 671 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); | 671 frame->stopFinding(WebLocalFrame::StopFindActionKeepSelection); |
| 672 return find_result; | 672 return find_result; |
| 673 } | 673 } |
| 674 | 674 |
| 675 std::string TestRunnerForSpecificView::SelectionAsMarkup() { | 675 std::string TestRunnerForSpecificView::SelectionAsMarkup() { |
| 676 return web_view()->mainFrame()->selectionAsMarkup().utf8(); | 676 if (!web_view()->mainFrame()->toWebLocalFrame()) { |
| 677 CHECK(false) << "This function cannot be called if the main frame is not a " |
| 678 "local frame."; |
| 679 } |
| 680 return web_view()->mainFrame()->toWebLocalFrame()->selectionAsMarkup().utf8(); |
| 677 } | 681 } |
| 678 | 682 |
| 679 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, | 683 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, |
| 680 bool enabled) { | 684 bool enabled) { |
| 681 WebFrame* target_frame = | 685 WebFrame* target_frame = |
| 682 web_view()->findFrameByName(WebString::fromUTF8(name)); | 686 web_view()->findFrameByName(WebString::fromUTF8(name)); |
| 683 if (target_frame) | 687 if (target_frame) |
| 684 target_frame->enableViewSourceMode(enabled); | 688 target_frame->enableViewSourceMode(enabled); |
| 685 } | 689 } |
| 686 | 690 |
| 687 blink::WebView* TestRunnerForSpecificView::web_view() { | 691 blink::WebView* TestRunnerForSpecificView::web_view() { |
| 688 return web_test_proxy_base_->web_view(); | 692 return web_test_proxy_base_->web_view(); |
| 689 } | 693 } |
| 690 | 694 |
| 691 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 695 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
| 692 return web_test_proxy_base_->delegate(); | 696 return web_test_proxy_base_->delegate(); |
| 693 } | 697 } |
| 694 | 698 |
| 695 } // namespace test_runner | 699 } // namespace test_runner |
| OLD | NEW |