| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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.h" | 5 #include "components/test_runner/test_runner.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 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "components/test_runner/layout_dump_flags.h" |
| 17 #include "components/test_runner/mock_credential_manager_client.h" | 18 #include "components/test_runner/mock_credential_manager_client.h" |
| 18 #include "components/test_runner/mock_web_speech_recognizer.h" | 19 #include "components/test_runner/mock_web_speech_recognizer.h" |
| 19 #include "components/test_runner/test_interfaces.h" | 20 #include "components/test_runner/test_interfaces.h" |
| 20 #include "components/test_runner/test_preferences.h" | 21 #include "components/test_runner/test_preferences.h" |
| 21 #include "components/test_runner/web_content_settings.h" | 22 #include "components/test_runner/web_content_settings.h" |
| 22 #include "components/test_runner/web_test_delegate.h" | 23 #include "components/test_runner/web_test_delegate.h" |
| 23 #include "components/test_runner/web_test_proxy.h" | 24 #include "components/test_runner/web_test_proxy.h" |
| 24 #include "gin/arguments.h" | 25 #include "gin/arguments.h" |
| 25 #include "gin/array_buffer.h" | 26 #include "gin/array_buffer.h" |
| 26 #include "gin/handle.h" | 27 #include "gin/handle.h" |
| (...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 Reset(); | 1604 Reset(); |
| 1604 } | 1605 } |
| 1605 | 1606 |
| 1606 void TestRunner::WorkQueue::ProcessWorkSoon() { | 1607 void TestRunner::WorkQueue::ProcessWorkSoon() { |
| 1607 if (controller_->topLoadingFrame()) | 1608 if (controller_->topLoadingFrame()) |
| 1608 return; | 1609 return; |
| 1609 | 1610 |
| 1610 if (!queue_.empty()) { | 1611 if (!queue_.empty()) { |
| 1611 // We delay processing queued work to avoid recursion problems. | 1612 // We delay processing queued work to avoid recursion problems. |
| 1612 controller_->delegate_->PostTask(new WorkQueueTask(this)); | 1613 controller_->delegate_->PostTask(new WorkQueueTask(this)); |
| 1613 } else if (!controller_->wait_until_done_) { | 1614 } else if (!controller_->layout_dump_flags()->wait_until_done) { |
| 1614 controller_->delegate_->TestFinished(); | 1615 controller_->delegate_->TestFinished(); |
| 1615 } | 1616 } |
| 1616 } | 1617 } |
| 1617 | 1618 |
| 1618 void TestRunner::WorkQueue::Reset() { | 1619 void TestRunner::WorkQueue::Reset() { |
| 1619 frozen_ = false; | 1620 frozen_ = false; |
| 1620 while (!queue_.empty()) { | 1621 while (!queue_.empty()) { |
| 1621 delete queue_.front(); | 1622 delete queue_.front(); |
| 1622 queue_.pop_front(); | 1623 queue_.pop_front(); |
| 1623 } | 1624 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1635 // Quit doing work once a load is in progress. | 1636 // Quit doing work once a load is in progress. |
| 1636 while (!queue_.empty()) { | 1637 while (!queue_.empty()) { |
| 1637 bool startedLoad = queue_.front()->Run(controller_->delegate_, | 1638 bool startedLoad = queue_.front()->Run(controller_->delegate_, |
| 1638 controller_->web_view_); | 1639 controller_->web_view_); |
| 1639 delete queue_.front(); | 1640 delete queue_.front(); |
| 1640 queue_.pop_front(); | 1641 queue_.pop_front(); |
| 1641 if (startedLoad) | 1642 if (startedLoad) |
| 1642 return; | 1643 return; |
| 1643 } | 1644 } |
| 1644 | 1645 |
| 1645 if (!controller_->wait_until_done_ && !controller_->topLoadingFrame()) | 1646 if (!controller_->layout_dump_flags()->wait_until_done && |
| 1647 !controller_->topLoadingFrame()) |
| 1646 controller_->delegate_->TestFinished(); | 1648 controller_->delegate_->TestFinished(); |
| 1647 } | 1649 } |
| 1648 | 1650 |
| 1649 void TestRunner::WorkQueue::WorkQueueTask::RunIfValid() { | 1651 void TestRunner::WorkQueue::WorkQueueTask::RunIfValid() { |
| 1650 object_->ProcessWork(); | 1652 object_->ProcessWork(); |
| 1651 } | 1653 } |
| 1652 | 1654 |
| 1653 TestRunner::TestRunner(TestInterfaces* interfaces) | 1655 TestRunner::TestRunner(TestInterfaces* interfaces) |
| 1654 : test_is_running_(false), | 1656 : test_is_running_(false), |
| 1655 close_remaining_windows_(false), | 1657 close_remaining_windows_(false), |
| 1656 work_queue_(this), | 1658 work_queue_(this), |
| 1657 disable_notify_done_(false), | 1659 disable_notify_done_(false), |
| 1658 web_history_item_count_(0), | 1660 web_history_item_count_(0), |
| 1659 intercept_post_message_(false), | 1661 intercept_post_message_(false), |
| 1660 layout_dump_flags_( | 1662 layout_dump_flags_(nullptr), |
| 1661 false, // dump_as_text | |
| 1662 false, // dump_child_frames_as_text | |
| 1663 false, // dump_as_markup | |
| 1664 false, // dump_child_frames_as_markup | |
| 1665 false, // dump_child_frame_scroll_positions | |
| 1666 false), // is_printing | |
| 1667 test_interfaces_(interfaces), | 1663 test_interfaces_(interfaces), |
| 1668 delegate_(nullptr), | 1664 delegate_(nullptr), |
| 1669 web_view_(nullptr), | 1665 web_view_(nullptr), |
| 1670 web_content_settings_(new WebContentSettings()), | 1666 web_content_settings_(new WebContentSettings()), |
| 1671 weak_factory_(this) {} | 1667 weak_factory_(this) {} |
| 1672 | 1668 |
| 1673 TestRunner::~TestRunner() {} | 1669 TestRunner::~TestRunner() {} |
| 1674 | 1670 |
| 1675 void TestRunner::Install(WebFrame* frame) { | 1671 void TestRunner::Install(WebFrame* frame) { |
| 1676 TestRunnerBindings::Install(weak_factory_.GetWeakPtr(), frame); | 1672 TestRunnerBindings::Install(weak_factory_.GetWeakPtr(), frame); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1697 web_view_->setSelectionColors( | 1693 web_view_->setSelectionColors( |
| 1698 0xff1e90ff, 0xff000000, 0xffc8c8c8, 0xff323232); | 1694 0xff1e90ff, 0xff000000, 0xffc8c8c8, 0xff323232); |
| 1699 #endif | 1695 #endif |
| 1700 web_view_->setVisibilityState(WebPageVisibilityStateVisible, true); | 1696 web_view_->setVisibilityState(WebPageVisibilityStateVisible, true); |
| 1701 web_view_->mainFrame()->enableViewSourceMode(false); | 1697 web_view_->mainFrame()->enableViewSourceMode(false); |
| 1702 | 1698 |
| 1703 web_view_->setPageOverlayColor(SK_ColorTRANSPARENT); | 1699 web_view_->setPageOverlayColor(SK_ColorTRANSPARENT); |
| 1704 } | 1700 } |
| 1705 | 1701 |
| 1706 top_loading_frame_ = nullptr; | 1702 top_loading_frame_ = nullptr; |
| 1707 wait_until_done_ = false; | 1703 // TODO / DO NOT SUBMIT - memory fence needed here and in other places :-/. |
| 1704 layout_dump_flags()->wait_until_done = false; |
| 1705 // TODO / DO NOT SUBMIT - memory fence needed here and in other places :-/. |
| 1708 wait_until_external_url_load_ = false; | 1706 wait_until_external_url_load_ = false; |
| 1709 policy_delegate_enabled_ = false; | 1707 policy_delegate_enabled_ = false; |
| 1710 policy_delegate_is_permissive_ = false; | 1708 policy_delegate_is_permissive_ = false; |
| 1711 policy_delegate_should_notify_done_ = false; | 1709 policy_delegate_should_notify_done_ = false; |
| 1712 | 1710 |
| 1713 WebSecurityPolicy::resetOriginAccessWhitelists(); | 1711 WebSecurityPolicy::resetOriginAccessWhitelists(); |
| 1714 #if defined(__linux__) || defined(ANDROID) | 1712 #if defined(__linux__) || defined(ANDROID) |
| 1715 WebFontRendering::setSubpixelPositioning(false); | 1713 WebFontRendering::setSubpixelPositioning(false); |
| 1716 #endif | 1714 #endif |
| 1717 | 1715 |
| 1718 if (delegate_) { | 1716 if (delegate_) { |
| 1719 // Reset the default quota for each origin to 5MB | 1717 // Reset the default quota for each origin to 5MB |
| 1720 delegate_->SetDatabaseQuota(5 * 1024 * 1024); | 1718 delegate_->SetDatabaseQuota(5 * 1024 * 1024); |
| 1721 delegate_->SetDeviceColorProfile("reset"); | 1719 delegate_->SetDeviceColorProfile("reset"); |
| 1722 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); | 1720 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); |
| 1723 delegate_->SetAcceptAllCookies(false); | 1721 delegate_->SetAcceptAllCookies(false); |
| 1724 delegate_->SetLocale(""); | 1722 delegate_->SetLocale(""); |
| 1725 delegate_->UseUnfortunateSynchronousResizeMode(false); | 1723 delegate_->UseUnfortunateSynchronousResizeMode(false); |
| 1726 delegate_->DisableAutoResizeMode(WebSize()); | 1724 delegate_->DisableAutoResizeMode(WebSize()); |
| 1727 delegate_->DeleteAllCookies(); | 1725 delegate_->DeleteAllCookies(); |
| 1728 delegate_->ResetScreenOrientation(); | 1726 delegate_->ResetScreenOrientation(); |
| 1729 delegate_->SetBluetoothMockDataSet(""); | 1727 delegate_->SetBluetoothMockDataSet(""); |
| 1730 delegate_->ClearGeofencingMockProvider(); | 1728 delegate_->ClearGeofencingMockProvider(); |
| 1731 delegate_->ResetPermissions(); | 1729 delegate_->ResetPermissions(); |
| 1732 ResetDeviceLight(); | 1730 ResetDeviceLight(); |
| 1733 } | 1731 } |
| 1734 | 1732 |
| 1735 dump_editting_callbacks_ = false; | 1733 dump_editting_callbacks_ = false; |
| 1736 layout_dump_flags_.dump_as_text = false; | 1734 layout_dump_flags()->dump_as_text = false; |
| 1737 layout_dump_flags_.dump_as_markup = false; | 1735 layout_dump_flags()->dump_as_markup = false; |
| 1738 generate_pixel_results_ = true; | 1736 layout_dump_flags()->generate_pixel_results = true; |
| 1739 layout_dump_flags_.dump_child_frame_scroll_positions = false; | 1737 layout_dump_flags()->dump_child_frame_scroll_positions = false; |
| 1740 layout_dump_flags_.dump_child_frames_as_text = false; | 1738 layout_dump_flags()->dump_child_frames_as_text = false; |
| 1741 layout_dump_flags_.dump_child_frames_as_markup = false; | 1739 layout_dump_flags()->dump_child_frames_as_markup = false; |
| 1742 dump_icon_changes_ = false; | 1740 dump_icon_changes_ = false; |
| 1743 dump_as_audio_ = false; | 1741 dump_as_audio_ = false; |
| 1744 dump_frame_load_callbacks_ = false; | 1742 dump_frame_load_callbacks_ = false; |
| 1745 dump_ping_loader_callbacks_ = false; | 1743 dump_ping_loader_callbacks_ = false; |
| 1746 dump_user_gesture_in_frame_load_callbacks_ = false; | 1744 dump_user_gesture_in_frame_load_callbacks_ = false; |
| 1747 dump_title_changes_ = false; | 1745 dump_title_changes_ = false; |
| 1748 dump_create_view_ = false; | 1746 dump_create_view_ = false; |
| 1749 can_open_windows_ = false; | 1747 can_open_windows_ = false; |
| 1750 dump_resource_load_callbacks_ = false; | 1748 dump_resource_load_callbacks_ = false; |
| 1751 dump_resource_request_callbacks_ = false; | 1749 dump_resource_request_callbacks_ = false; |
| 1752 dump_resource_response_mime_types_ = false; | 1750 dump_resource_response_mime_types_ = false; |
| 1753 dump_window_status_changes_ = false; | 1751 dump_window_status_changes_ = false; |
| 1754 dump_spell_check_callbacks_ = false; | 1752 dump_spell_check_callbacks_ = false; |
| 1755 dump_back_forward_list_ = false; | 1753 dump_back_forward_list_ = false; |
| 1756 dump_selection_rect_ = false; | 1754 dump_selection_rect_ = false; |
| 1757 dump_drag_image_ = false; | 1755 dump_drag_image_ = false; |
| 1758 dump_navigation_policy_ = false; | 1756 dump_navigation_policy_ = false; |
| 1759 test_repaint_ = false; | 1757 test_repaint_ = false; |
| 1760 sweep_horizontally_ = false; | 1758 sweep_horizontally_ = false; |
| 1761 layout_dump_flags_.is_printing = false; | 1759 layout_dump_flags()->is_printing = false; |
| 1762 midi_accessor_result_ = true; | 1760 midi_accessor_result_ = true; |
| 1763 should_stay_on_page_after_handling_before_unload_ = false; | 1761 should_stay_on_page_after_handling_before_unload_ = false; |
| 1764 should_dump_resource_priorities_ = false; | 1762 should_dump_resource_priorities_ = false; |
| 1765 has_custom_text_output_ = false; | 1763 has_custom_text_output_ = false; |
| 1766 custom_text_output_.clear(); | 1764 custom_text_output_.clear(); |
| 1767 | 1765 |
| 1768 http_headers_to_clear_.clear(); | 1766 http_headers_to_clear_.clear(); |
| 1769 | 1767 |
| 1770 platform_name_ = "chromium"; | 1768 platform_name_ = "chromium"; |
| 1771 tooltip_text_ = std::string(); | 1769 tooltip_text_ = std::string(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1786 if (close_remaining_windows_ && delegate_) | 1784 if (close_remaining_windows_ && delegate_) |
| 1787 delegate_->CloseRemainingWindows(); | 1785 delegate_->CloseRemainingWindows(); |
| 1788 else | 1786 else |
| 1789 close_remaining_windows_ = true; | 1787 close_remaining_windows_ = true; |
| 1790 } | 1788 } |
| 1791 | 1789 |
| 1792 void TestRunner::SetTestIsRunning(bool running) { | 1790 void TestRunner::SetTestIsRunning(bool running) { |
| 1793 test_is_running_ = running; | 1791 test_is_running_ = running; |
| 1794 } | 1792 } |
| 1795 | 1793 |
| 1794 void TestRunner::SetSharedLayoutDumpFlags( |
| 1795 LayoutDumpFlags* shared_layout_dump_flags) { |
| 1796 DCHECK(shared_layout_dump_flags); |
| 1797 layout_dump_flags_ = shared_layout_dump_flags; |
| 1798 } |
| 1799 |
| 1796 void TestRunner::InvokeCallback(scoped_ptr<InvokeCallbackTask> task) { | 1800 void TestRunner::InvokeCallback(scoped_ptr<InvokeCallbackTask> task) { |
| 1797 delegate_->PostTask(task.release()); | 1801 delegate_->PostTask(task.release()); |
| 1798 } | 1802 } |
| 1799 | 1803 |
| 1800 bool TestRunner::shouldDumpEditingCallbacks() const { | 1804 bool TestRunner::shouldDumpEditingCallbacks() const { |
| 1801 return dump_editting_callbacks_; | 1805 return dump_editting_callbacks_; |
| 1802 } | 1806 } |
| 1803 | 1807 |
| 1804 void TestRunner::setShouldDumpAsText(bool value) { | 1808 void TestRunner::setShouldDumpAsText(bool value) { |
| 1805 layout_dump_flags_.dump_as_text = value; | 1809 layout_dump_flags()->dump_as_text = value; |
| 1806 } | 1810 } |
| 1807 | 1811 |
| 1808 void TestRunner::setShouldDumpAsMarkup(bool value) { | 1812 void TestRunner::setShouldDumpAsMarkup(bool value) { |
| 1809 layout_dump_flags_.dump_as_markup = value; | 1813 layout_dump_flags()->dump_as_markup = value; |
| 1810 } | 1814 } |
| 1811 | 1815 |
| 1812 bool TestRunner::shouldDumpAsCustomText() const { | 1816 bool TestRunner::shouldDumpAsCustomText() const { |
| 1813 return has_custom_text_output_; | 1817 return has_custom_text_output_; |
| 1814 } | 1818 } |
| 1815 | 1819 |
| 1816 std::string TestRunner::customDumpText() const { | 1820 std::string TestRunner::customDumpText() const { |
| 1817 return custom_text_output_; | 1821 return custom_text_output_; |
| 1818 } | 1822 } |
| 1819 | 1823 |
| 1820 void TestRunner::setCustomTextOutput(const std::string& text) { | 1824 void TestRunner::setCustomTextOutput(const std::string& text) { |
| 1821 custom_text_output_ = text; | 1825 custom_text_output_ = text; |
| 1822 has_custom_text_output_ = true; | 1826 has_custom_text_output_ = true; |
| 1823 } | 1827 } |
| 1824 | 1828 |
| 1825 bool TestRunner::ShouldGeneratePixelResults() { | 1829 bool TestRunner::ShouldGeneratePixelResults() { |
| 1826 CheckResponseMimeType(); | 1830 CheckResponseMimeType(); |
| 1827 return generate_pixel_results_; | 1831 return layout_dump_flags()->generate_pixel_results; |
| 1828 } | 1832 } |
| 1829 | 1833 |
| 1830 bool TestRunner::ShouldStayOnPageAfterHandlingBeforeUnload() const { | 1834 bool TestRunner::ShouldStayOnPageAfterHandlingBeforeUnload() const { |
| 1831 return should_stay_on_page_after_handling_before_unload_; | 1835 return should_stay_on_page_after_handling_before_unload_; |
| 1832 } | 1836 } |
| 1833 | 1837 |
| 1834 | 1838 |
| 1835 void TestRunner::setShouldGeneratePixelResults(bool value) { | 1839 void TestRunner::setShouldGeneratePixelResults(bool value) { |
| 1836 generate_pixel_results_ = value; | 1840 layout_dump_flags()->generate_pixel_results = value; |
| 1837 } | 1841 } |
| 1838 | 1842 |
| 1839 bool TestRunner::ShouldDumpAsAudio() const { | 1843 bool TestRunner::ShouldDumpAsAudio() const { |
| 1840 return dump_as_audio_; | 1844 return dump_as_audio_; |
| 1841 } | 1845 } |
| 1842 | 1846 |
| 1843 void TestRunner::GetAudioData(std::vector<unsigned char>* buffer_view) const { | 1847 void TestRunner::GetAudioData(std::vector<unsigned char>* buffer_view) const { |
| 1844 *buffer_view = audio_data_; | 1848 *buffer_view = audio_data_; |
| 1845 } | 1849 } |
| 1846 | 1850 |
| 1847 const LayoutDumpFlags& TestRunner::GetLayoutDumpFlags() { | 1851 const LayoutDumpFlags& TestRunner::GetLayoutDumpFlags() { |
| 1848 CheckResponseMimeType(); | 1852 CheckResponseMimeType(); |
| 1849 return layout_dump_flags_; | 1853 return *layout_dump_flags_; |
| 1850 } | 1854 } |
| 1851 | 1855 |
| 1852 bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const { | 1856 bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const { |
| 1853 if (shouldDumpAsCustomText()) { | 1857 if (shouldDumpAsCustomText()) { |
| 1854 *custom_text_dump = customDumpText(); | 1858 *custom_text_dump = customDumpText(); |
| 1855 return true; | 1859 return true; |
| 1856 } | 1860 } |
| 1857 | 1861 |
| 1858 return false; | 1862 return false; |
| 1859 } | 1863 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1924 | 1928 |
| 1925 bool TestRunner::ShouldDumpBackForwardList() const { | 1929 bool TestRunner::ShouldDumpBackForwardList() const { |
| 1926 return dump_back_forward_list_; | 1930 return dump_back_forward_list_; |
| 1927 } | 1931 } |
| 1928 | 1932 |
| 1929 bool TestRunner::shouldDumpSelectionRect() const { | 1933 bool TestRunner::shouldDumpSelectionRect() const { |
| 1930 return dump_selection_rect_; | 1934 return dump_selection_rect_; |
| 1931 } | 1935 } |
| 1932 | 1936 |
| 1933 bool TestRunner::isPrinting() const { | 1937 bool TestRunner::isPrinting() const { |
| 1934 return layout_dump_flags_.is_printing; | 1938 return layout_dump_flags()->is_printing; |
| 1935 } | 1939 } |
| 1936 | 1940 |
| 1937 bool TestRunner::shouldWaitUntilExternalURLLoad() const { | 1941 bool TestRunner::shouldWaitUntilExternalURLLoad() const { |
| 1938 return wait_until_external_url_load_; | 1942 return wait_until_external_url_load_; |
| 1939 } | 1943 } |
| 1940 | 1944 |
| 1941 const std::set<std::string>* TestRunner::httpHeadersToClear() const { | 1945 const std::set<std::string>* TestRunner::httpHeadersToClear() const { |
| 1942 return &http_headers_to_clear_; | 1946 return &http_headers_to_clear_; |
| 1943 } | 1947 } |
| 1944 | 1948 |
| 1945 void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear) { | 1949 void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear) { |
| 1946 if (frame->top()->view() != web_view_) | 1950 if (frame->top()->view() != web_view_) |
| 1947 return; | 1951 return; |
| 1948 if (!test_is_running_) | 1952 if (!test_is_running_) |
| 1949 return; | 1953 return; |
| 1950 if (clear) { | 1954 if (clear) { |
| 1951 top_loading_frame_ = nullptr; | 1955 top_loading_frame_ = nullptr; |
| 1952 LocationChangeDone(); | 1956 LocationChangeDone(); |
| 1953 } else if (!top_loading_frame_) { | 1957 } else if (!top_loading_frame_) { |
| 1954 top_loading_frame_ = frame; | 1958 top_loading_frame_ = frame; |
| 1955 } | 1959 } |
| 1956 } | 1960 } |
| 1957 | 1961 |
| 1958 WebFrame* TestRunner::topLoadingFrame() const { | 1962 WebFrame* TestRunner::topLoadingFrame() const { |
| 1959 return top_loading_frame_; | 1963 return top_loading_frame_; |
| 1960 } | 1964 } |
| 1961 | 1965 |
| 1962 void TestRunner::policyDelegateDone() { | 1966 void TestRunner::policyDelegateDone() { |
| 1963 DCHECK(wait_until_done_); | 1967 DCHECK(layout_dump_flags()->wait_until_done); |
| 1964 delegate_->TestFinished(); | 1968 delegate_->TestFinished(); |
| 1965 wait_until_done_ = false; | 1969 layout_dump_flags()->wait_until_done = false; |
| 1966 } | 1970 } |
| 1967 | 1971 |
| 1968 bool TestRunner::policyDelegateEnabled() const { | 1972 bool TestRunner::policyDelegateEnabled() const { |
| 1969 return policy_delegate_enabled_; | 1973 return policy_delegate_enabled_; |
| 1970 } | 1974 } |
| 1971 | 1975 |
| 1972 bool TestRunner::policyDelegateIsPermissive() const { | 1976 bool TestRunner::policyDelegateIsPermissive() const { |
| 1973 return policy_delegate_is_permissive_; | 1977 return policy_delegate_is_permissive_; |
| 1974 } | 1978 } |
| 1975 | 1979 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 if (disable_notify_done_) | 2059 if (disable_notify_done_) |
| 2056 return; | 2060 return; |
| 2057 | 2061 |
| 2058 // Test didn't timeout. Kill the timeout timer. | 2062 // Test didn't timeout. Kill the timeout timer. |
| 2059 task_list_.RevokeAll(); | 2063 task_list_.RevokeAll(); |
| 2060 | 2064 |
| 2061 CompleteNotifyDone(); | 2065 CompleteNotifyDone(); |
| 2062 } | 2066 } |
| 2063 | 2067 |
| 2064 void TestRunner::WaitUntilDone() { | 2068 void TestRunner::WaitUntilDone() { |
| 2065 wait_until_done_ = true; | 2069 layout_dump_flags()->wait_until_done = true; |
| 2066 } | 2070 } |
| 2067 | 2071 |
| 2068 void TestRunner::QueueBackNavigation(int how_far_back) { | 2072 void TestRunner::QueueBackNavigation(int how_far_back) { |
| 2069 work_queue_.AddWork(new WorkItemBackForward(-how_far_back)); | 2073 work_queue_.AddWork(new WorkItemBackForward(-how_far_back)); |
| 2070 } | 2074 } |
| 2071 | 2075 |
| 2072 void TestRunner::QueueForwardNavigation(int how_far_forward) { | 2076 void TestRunner::QueueForwardNavigation(int how_far_forward) { |
| 2073 work_queue_.AddWork(new WorkItemBackForward(how_far_forward)); | 2077 work_queue_.AddWork(new WorkItemBackForward(how_far_forward)); |
| 2074 } | 2078 } |
| 2075 | 2079 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 | 2192 |
| 2189 void TestRunner::SetCustomPolicyDelegate(gin::Arguments* args) { | 2193 void TestRunner::SetCustomPolicyDelegate(gin::Arguments* args) { |
| 2190 args->GetNext(&policy_delegate_enabled_); | 2194 args->GetNext(&policy_delegate_enabled_); |
| 2191 if (!args->PeekNext().IsEmpty() && args->PeekNext()->IsBoolean()) | 2195 if (!args->PeekNext().IsEmpty() && args->PeekNext()->IsBoolean()) |
| 2192 args->GetNext(&policy_delegate_is_permissive_); | 2196 args->GetNext(&policy_delegate_is_permissive_); |
| 2193 } | 2197 } |
| 2194 | 2198 |
| 2195 void TestRunner::WaitForPolicyDelegate() { | 2199 void TestRunner::WaitForPolicyDelegate() { |
| 2196 policy_delegate_enabled_ = true; | 2200 policy_delegate_enabled_ = true; |
| 2197 policy_delegate_should_notify_done_ = true; | 2201 policy_delegate_should_notify_done_ = true; |
| 2198 wait_until_done_ = true; | 2202 layout_dump_flags()->wait_until_done = true; |
| 2199 } | 2203 } |
| 2200 | 2204 |
| 2201 int TestRunner::WindowCount() { | 2205 int TestRunner::WindowCount() { |
| 2202 return test_interfaces_->GetWindowList().size(); | 2206 return test_interfaces_->GetWindowList().size(); |
| 2203 } | 2207 } |
| 2204 | 2208 |
| 2205 void TestRunner::SetCloseRemainingWindowsWhenComplete( | 2209 void TestRunner::SetCloseRemainingWindowsWhenComplete( |
| 2206 bool close_remaining_windows) { | 2210 bool close_remaining_windows) { |
| 2207 close_remaining_windows_ = close_remaining_windows; | 2211 close_remaining_windows_ = close_remaining_windows; |
| 2208 } | 2212 } |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 | 2637 |
| 2634 bool TestRunner::AnimationScheduled() { | 2638 bool TestRunner::AnimationScheduled() { |
| 2635 return proxy_->AnimationScheduled(); | 2639 return proxy_->AnimationScheduled(); |
| 2636 } | 2640 } |
| 2637 | 2641 |
| 2638 void TestRunner::DumpEditingCallbacks() { | 2642 void TestRunner::DumpEditingCallbacks() { |
| 2639 dump_editting_callbacks_ = true; | 2643 dump_editting_callbacks_ = true; |
| 2640 } | 2644 } |
| 2641 | 2645 |
| 2642 void TestRunner::DumpAsMarkup() { | 2646 void TestRunner::DumpAsMarkup() { |
| 2643 layout_dump_flags_.dump_as_markup = true; | 2647 layout_dump_flags()->dump_as_markup = true; |
| 2644 generate_pixel_results_ = false; | 2648 layout_dump_flags()->generate_pixel_results = false; |
| 2645 } | 2649 } |
| 2646 | 2650 |
| 2647 void TestRunner::DumpAsText() { | 2651 void TestRunner::DumpAsText() { |
| 2648 layout_dump_flags_.dump_as_text = true; | 2652 layout_dump_flags()->dump_as_text = true; |
| 2649 generate_pixel_results_ = false; | 2653 layout_dump_flags()->generate_pixel_results = false; |
| 2650 } | 2654 } |
| 2651 | 2655 |
| 2652 void TestRunner::DumpAsTextWithPixelResults() { | 2656 void TestRunner::DumpAsTextWithPixelResults() { |
| 2653 layout_dump_flags_.dump_as_text = true; | 2657 layout_dump_flags()->dump_as_text = true; |
| 2654 generate_pixel_results_ = true; | 2658 layout_dump_flags()->generate_pixel_results = true; |
| 2655 } | 2659 } |
| 2656 | 2660 |
| 2657 void TestRunner::DumpChildFrameScrollPositions() { | 2661 void TestRunner::DumpChildFrameScrollPositions() { |
| 2658 layout_dump_flags_.dump_child_frame_scroll_positions = true; | 2662 layout_dump_flags()->dump_child_frame_scroll_positions = true; |
| 2659 } | 2663 } |
| 2660 | 2664 |
| 2661 void TestRunner::DumpChildFramesAsMarkup() { | 2665 void TestRunner::DumpChildFramesAsMarkup() { |
| 2662 layout_dump_flags_.dump_child_frames_as_markup = true; | 2666 layout_dump_flags()->dump_child_frames_as_markup = true; |
| 2663 } | 2667 } |
| 2664 | 2668 |
| 2665 void TestRunner::DumpChildFramesAsText() { | 2669 void TestRunner::DumpChildFramesAsText() { |
| 2666 layout_dump_flags_.dump_child_frames_as_text = true; | 2670 layout_dump_flags()->dump_child_frames_as_text = true; |
| 2667 } | 2671 } |
| 2668 | 2672 |
| 2669 void TestRunner::DumpIconChanges() { | 2673 void TestRunner::DumpIconChanges() { |
| 2670 dump_icon_changes_ = true; | 2674 dump_icon_changes_ = true; |
| 2671 } | 2675 } |
| 2672 | 2676 |
| 2673 void TestRunner::SetAudioData(const gin::ArrayBufferView& view) { | 2677 void TestRunner::SetAudioData(const gin::ArrayBufferView& view) { |
| 2674 unsigned char* bytes = static_cast<unsigned char*>(view.bytes()); | 2678 unsigned char* bytes = static_cast<unsigned char*>(view.bytes()); |
| 2675 audio_data_.resize(view.num_bytes()); | 2679 audio_data_.resize(view.num_bytes()); |
| 2676 std::copy(bytes, bytes + view.num_bytes(), audio_data_.begin()); | 2680 std::copy(bytes, bytes + view.num_bytes(), audio_data_.begin()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2755 | 2759 |
| 2756 void TestRunner::DumpBackForwardList() { | 2760 void TestRunner::DumpBackForwardList() { |
| 2757 dump_back_forward_list_ = true; | 2761 dump_back_forward_list_ = true; |
| 2758 } | 2762 } |
| 2759 | 2763 |
| 2760 void TestRunner::DumpSelectionRect() { | 2764 void TestRunner::DumpSelectionRect() { |
| 2761 dump_selection_rect_ = true; | 2765 dump_selection_rect_ = true; |
| 2762 } | 2766 } |
| 2763 | 2767 |
| 2764 void TestRunner::SetPrinting() { | 2768 void TestRunner::SetPrinting() { |
| 2765 layout_dump_flags_.is_printing = true; | 2769 layout_dump_flags()->is_printing = true; |
| 2766 } | 2770 } |
| 2767 | 2771 |
| 2768 void TestRunner::ClearPrinting() { | 2772 void TestRunner::ClearPrinting() { |
| 2769 layout_dump_flags_.is_printing = false; | 2773 layout_dump_flags()->is_printing = false; |
| 2770 } | 2774 } |
| 2771 | 2775 |
| 2772 void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) { | 2776 void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) { |
| 2773 should_stay_on_page_after_handling_before_unload_ = value; | 2777 should_stay_on_page_after_handling_before_unload_ = value; |
| 2774 } | 2778 } |
| 2775 | 2779 |
| 2776 void TestRunner::SetWillSendRequestClearHeader(const std::string& header) { | 2780 void TestRunner::SetWillSendRequestClearHeader(const std::string& header) { |
| 2777 if (!header.empty()) | 2781 if (!header.empty()) |
| 2778 http_headers_to_clear_.insert(header); | 2782 http_headers_to_clear_.insert(header); |
| 2779 } | 2783 } |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3130 task->SetArguments(1, arg); | 3134 task->SetArguments(1, arg); |
| 3131 InvokeCallback(std::move(task)); | 3135 InvokeCallback(std::move(task)); |
| 3132 } | 3136 } |
| 3133 | 3137 |
| 3134 void TestRunner::LocationChangeDone() { | 3138 void TestRunner::LocationChangeDone() { |
| 3135 web_history_item_count_ = delegate_->NavigationEntryCount(); | 3139 web_history_item_count_ = delegate_->NavigationEntryCount(); |
| 3136 | 3140 |
| 3137 // No more new work after the first complete load. | 3141 // No more new work after the first complete load. |
| 3138 work_queue_.set_frozen(true); | 3142 work_queue_.set_frozen(true); |
| 3139 | 3143 |
| 3140 if (!wait_until_done_) | 3144 if (!layout_dump_flags()->wait_until_done) |
| 3141 work_queue_.ProcessWorkSoon(); | 3145 work_queue_.ProcessWorkSoon(); |
| 3142 } | 3146 } |
| 3143 | 3147 |
| 3144 void TestRunner::CheckResponseMimeType() { | 3148 void TestRunner::CheckResponseMimeType() { |
| 3145 // Text output: the test page can request different types of output which we | 3149 // Text output: the test page can request different types of output which we |
| 3146 // handle here. | 3150 // handle here. |
| 3147 if (!layout_dump_flags_.dump_as_text) { | 3151 if (!layout_dump_flags()->dump_as_text) { |
| 3148 std::string mimeType = | 3152 std::string mimeType = |
| 3149 web_view_->mainFrame()->dataSource()->response().mimeType().utf8(); | 3153 web_view_->mainFrame()->dataSource()->response().mimeType().utf8(); |
| 3150 if (mimeType == "text/plain") { | 3154 if (mimeType == "text/plain") { |
| 3151 layout_dump_flags_.dump_as_text = true; | 3155 layout_dump_flags()->dump_as_text = true; |
| 3152 generate_pixel_results_ = false; | 3156 layout_dump_flags()->generate_pixel_results = false; |
| 3153 } | 3157 } |
| 3154 } | 3158 } |
| 3155 } | 3159 } |
| 3156 | 3160 |
| 3157 void TestRunner::CompleteNotifyDone() { | 3161 void TestRunner::CompleteNotifyDone() { |
| 3158 if (wait_until_done_ && !topLoadingFrame() && work_queue_.is_empty()) | 3162 if (layout_dump_flags()->wait_until_done && !topLoadingFrame() && |
| 3163 work_queue_.is_empty()) |
| 3159 delegate_->TestFinished(); | 3164 delegate_->TestFinished(); |
| 3160 wait_until_done_ = false; | 3165 layout_dump_flags()->wait_until_done = false; |
| 3161 } | 3166 } |
| 3162 | 3167 |
| 3163 void TestRunner::DidAcquirePointerLockInternal() { | 3168 void TestRunner::DidAcquirePointerLockInternal() { |
| 3164 pointer_locked_ = true; | 3169 pointer_locked_ = true; |
| 3165 web_view_->didAcquirePointerLock(); | 3170 web_view_->didAcquirePointerLock(); |
| 3166 | 3171 |
| 3167 // Reset planned result to default. | 3172 // Reset planned result to default. |
| 3168 pointer_lock_planned_result_ = PointerLockWillSucceed; | 3173 pointer_lock_planned_result_ = PointerLockWillSucceed; |
| 3169 } | 3174 } |
| 3170 | 3175 |
| 3171 void TestRunner::DidNotAcquirePointerLockInternal() { | 3176 void TestRunner::DidNotAcquirePointerLockInternal() { |
| 3172 DCHECK(!pointer_locked_); | 3177 DCHECK(!pointer_locked_); |
| 3173 pointer_locked_ = false; | 3178 pointer_locked_ = false; |
| 3174 web_view_->didNotAcquirePointerLock(); | 3179 web_view_->didNotAcquirePointerLock(); |
| 3175 | 3180 |
| 3176 // Reset planned result to default. | 3181 // Reset planned result to default. |
| 3177 pointer_lock_planned_result_ = PointerLockWillSucceed; | 3182 pointer_lock_planned_result_ = PointerLockWillSucceed; |
| 3178 } | 3183 } |
| 3179 | 3184 |
| 3180 void TestRunner::DidLosePointerLockInternal() { | 3185 void TestRunner::DidLosePointerLockInternal() { |
| 3181 bool was_locked = pointer_locked_; | 3186 bool was_locked = pointer_locked_; |
| 3182 pointer_locked_ = false; | 3187 pointer_locked_ = false; |
| 3183 if (was_locked) | 3188 if (was_locked) |
| 3184 web_view_->didLosePointerLock(); | 3189 web_view_->didLosePointerLock(); |
| 3185 } | 3190 } |
| 3186 | 3191 |
| 3187 } // namespace test_runner | 3192 } // namespace test_runner |
| OLD | NEW |