| 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/test_runner_for_specific_view.h" | 5 #include "content/shell/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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 std::string TestRunnerForSpecificView::SelectionAsMarkup() { | 672 std::string TestRunnerForSpecificView::SelectionAsMarkup() { |
| 673 if (!web_view()->MainFrame()->ToWebLocalFrame()) { | 673 if (!web_view()->MainFrame()->ToWebLocalFrame()) { |
| 674 CHECK(false) << "This function cannot be called if the main frame is not a " | 674 CHECK(false) << "This function cannot be called if the main frame is not a " |
| 675 "local frame."; | 675 "local frame."; |
| 676 } | 676 } |
| 677 return web_view()->MainFrame()->ToWebLocalFrame()->SelectionAsMarkup().Utf8(); | 677 return web_view()->MainFrame()->ToWebLocalFrame()->SelectionAsMarkup().Utf8(); |
| 678 } | 678 } |
| 679 | 679 |
| 680 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, | 680 void TestRunnerForSpecificView::SetViewSourceForFrame(const std::string& name, |
| 681 bool enabled) { | 681 bool enabled) { |
| 682 if (!web_view()->MainFrame()->IsWebLocalFrame()) { |
| 683 CHECK(false) << "This function cannot be called if the main frame is not a " |
| 684 "local frame."; |
| 685 } |
| 686 |
| 682 WebFrame* target_frame = | 687 WebFrame* target_frame = |
| 683 web_view()->FindFrameByName(WebString::FromUTF8(name)); | 688 web_view()->MainFrame()->ToWebLocalFrame()->FindFrameByName( |
| 689 WebString::FromUTF8(name)); |
| 684 if (target_frame) | 690 if (target_frame) |
| 685 target_frame->EnableViewSourceMode(enabled); | 691 target_frame->EnableViewSourceMode(enabled); |
| 686 } | 692 } |
| 687 | 693 |
| 688 blink::WebView* TestRunnerForSpecificView::web_view() { | 694 blink::WebView* TestRunnerForSpecificView::web_view() { |
| 689 return web_view_test_proxy_base_->web_view(); | 695 return web_view_test_proxy_base_->web_view(); |
| 690 } | 696 } |
| 691 | 697 |
| 692 WebTestDelegate* TestRunnerForSpecificView::delegate() { | 698 WebTestDelegate* TestRunnerForSpecificView::delegate() { |
| 693 return web_view_test_proxy_base_->delegate(); | 699 return web_view_test_proxy_base_->delegate(); |
| 694 } | 700 } |
| 695 | 701 |
| 696 } // namespace test_runner | 702 } // namespace test_runner |
| OLD | NEW |