| 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 |
| (...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1485 } | 1485 } |
| 1486 | 1486 |
| 1487 int TestRunnerBindings::WebHistoryItemCount() { | 1487 int TestRunnerBindings::WebHistoryItemCount() { |
| 1488 if (runner_) | 1488 if (runner_) |
| 1489 return runner_->web_history_item_count_; | 1489 return runner_->web_history_item_count_; |
| 1490 return false; | 1490 return false; |
| 1491 } | 1491 } |
| 1492 | 1492 |
| 1493 bool TestRunnerBindings::InterceptPostMessage() { | 1493 bool TestRunnerBindings::InterceptPostMessage() { |
| 1494 if (runner_) | 1494 if (runner_) |
| 1495 return runner_->intercept_post_message_; | 1495 return runner_->shouldInterceptPostMessage(); |
| 1496 return false; | 1496 return false; |
| 1497 } | 1497 } |
| 1498 | 1498 |
| 1499 void TestRunnerBindings::SetInterceptPostMessage(bool value) { | 1499 void TestRunnerBindings::SetInterceptPostMessage(bool value) { |
| 1500 if (runner_) | 1500 if (runner_) { |
| 1501 runner_->intercept_post_message_ = value; | 1501 runner_->layout_test_runtime_flags_.set_intercept_post_message(value); |
| 1502 runner_->OnLayoutTestRuntimeFlagsChanged(); |
| 1503 } |
| 1502 } | 1504 } |
| 1503 | 1505 |
| 1504 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { | 1506 void TestRunnerBindings::ForceNextWebGLContextCreationToFail() { |
| 1505 if (runner_) | 1507 if (runner_) |
| 1506 runner_->ForceNextWebGLContextCreationToFail(); | 1508 runner_->ForceNextWebGLContextCreationToFail(); |
| 1507 } | 1509 } |
| 1508 | 1510 |
| 1509 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { | 1511 void TestRunnerBindings::ForceNextDrawingBufferCreationToFail() { |
| 1510 if (runner_) | 1512 if (runner_) |
| 1511 runner_->ForceNextDrawingBufferCreationToFail(); | 1513 runner_->ForceNextDrawingBufferCreationToFail(); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 if (!controller_->layout_test_runtime_flags_.wait_until_done() && | 1566 if (!controller_->layout_test_runtime_flags_.wait_until_done() && |
| 1565 !controller_->topLoadingFrame()) | 1567 !controller_->topLoadingFrame()) |
| 1566 controller_->delegate_->TestFinished(); | 1568 controller_->delegate_->TestFinished(); |
| 1567 } | 1569 } |
| 1568 | 1570 |
| 1569 TestRunner::TestRunner(TestInterfaces* interfaces) | 1571 TestRunner::TestRunner(TestInterfaces* interfaces) |
| 1570 : test_is_running_(false), | 1572 : test_is_running_(false), |
| 1571 close_remaining_windows_(false), | 1573 close_remaining_windows_(false), |
| 1572 work_queue_(this), | 1574 work_queue_(this), |
| 1573 web_history_item_count_(0), | 1575 web_history_item_count_(0), |
| 1574 intercept_post_message_(false), | |
| 1575 test_interfaces_(interfaces), | 1576 test_interfaces_(interfaces), |
| 1576 delegate_(nullptr), | 1577 delegate_(nullptr), |
| 1577 web_view_(nullptr), | 1578 web_view_(nullptr), |
| 1578 mock_content_settings_client_( | 1579 mock_content_settings_client_( |
| 1579 new MockContentSettingsClient(&layout_test_runtime_flags_)), | 1580 new MockContentSettingsClient(&layout_test_runtime_flags_)), |
| 1580 credential_manager_client_(new MockCredentialManagerClient), | 1581 credential_manager_client_(new MockCredentialManagerClient), |
| 1581 mock_screen_orientation_client_(new MockScreenOrientationClient), | 1582 mock_screen_orientation_client_(new MockScreenOrientationClient), |
| 1582 spellcheck_(new SpellCheckClient(this)), | 1583 spellcheck_(new SpellCheckClient(this)), |
| 1583 chooser_count_(0), | 1584 chooser_count_(0), |
| 1584 previously_focused_view_(nullptr), | 1585 previously_focused_view_(nullptr), |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1617 web_view_->mainFrame()->enableViewSourceMode(false); | 1618 web_view_->mainFrame()->enableViewSourceMode(false); |
| 1618 | 1619 |
| 1619 web_view_->setPageOverlayColor(SK_ColorTRANSPARENT); | 1620 web_view_->setPageOverlayColor(SK_ColorTRANSPARENT); |
| 1620 } | 1621 } |
| 1621 | 1622 |
| 1622 top_loading_frame_ = nullptr; | 1623 top_loading_frame_ = nullptr; |
| 1623 layout_test_runtime_flags_.Reset(); | 1624 layout_test_runtime_flags_.Reset(); |
| 1624 mock_screen_orientation_client_->ResetData(); | 1625 mock_screen_orientation_client_->ResetData(); |
| 1625 drag_image_.reset(); | 1626 drag_image_.reset(); |
| 1626 views_with_scheduled_animations_.clear(); | 1627 views_with_scheduled_animations_.clear(); |
| 1627 wait_until_external_url_load_ = false; | |
| 1628 | 1628 |
| 1629 WebSecurityPolicy::resetOriginAccessWhitelists(); | 1629 WebSecurityPolicy::resetOriginAccessWhitelists(); |
| 1630 #if defined(__linux__) || defined(ANDROID) | 1630 #if defined(__linux__) || defined(ANDROID) |
| 1631 WebFontRendering::setSubpixelPositioning(false); | 1631 WebFontRendering::setSubpixelPositioning(false); |
| 1632 #endif | 1632 #endif |
| 1633 | 1633 |
| 1634 if (delegate_) { | 1634 if (delegate_) { |
| 1635 // Reset the default quota for each origin to 5MB | 1635 // Reset the default quota for each origin to 5MB |
| 1636 delegate_->SetDatabaseQuota(5 * 1024 * 1024); | 1636 delegate_->SetDatabaseQuota(5 * 1024 * 1024); |
| 1637 delegate_->SetDeviceColorProfile("reset"); | 1637 delegate_->SetDeviceColorProfile("reset"); |
| 1638 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); | 1638 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); |
| 1639 delegate_->SetAcceptAllCookies(false); | 1639 delegate_->SetAcceptAllCookies(false); |
| 1640 delegate_->SetLocale(""); | 1640 delegate_->SetLocale(""); |
| 1641 delegate_->UseUnfortunateSynchronousResizeMode(false); | 1641 delegate_->UseUnfortunateSynchronousResizeMode(false); |
| 1642 delegate_->DisableAutoResizeMode(WebSize()); | 1642 delegate_->DisableAutoResizeMode(WebSize()); |
| 1643 delegate_->DeleteAllCookies(); | 1643 delegate_->DeleteAllCookies(); |
| 1644 delegate_->SetBluetoothManualChooser(false); | 1644 delegate_->SetBluetoothManualChooser(false); |
| 1645 delegate_->ClearGeofencingMockProvider(); | 1645 delegate_->ClearGeofencingMockProvider(); |
| 1646 delegate_->ResetPermissions(); | 1646 delegate_->ResetPermissions(); |
| 1647 ResetDeviceLight(); | 1647 ResetDeviceLight(); |
| 1648 } | 1648 } |
| 1649 | 1649 |
| 1650 dump_editting_callbacks_ = false; | |
| 1651 dump_icon_changes_ = false; | |
| 1652 dump_as_audio_ = false; | 1650 dump_as_audio_ = false; |
| 1653 dump_frame_load_callbacks_ = false; | |
| 1654 dump_ping_loader_callbacks_ = false; | |
| 1655 dump_user_gesture_in_frame_load_callbacks_ = false; | |
| 1656 dump_title_changes_ = false; | |
| 1657 dump_create_view_ = false; | 1651 dump_create_view_ = false; |
| 1658 can_open_windows_ = false; | 1652 can_open_windows_ = false; |
| 1659 dump_resource_load_callbacks_ = false; | |
| 1660 dump_resource_response_mime_types_ = false; | |
| 1661 dump_window_status_changes_ = false; | 1653 dump_window_status_changes_ = false; |
| 1662 dump_spell_check_callbacks_ = false; | 1654 dump_spell_check_callbacks_ = false; |
| 1663 dump_back_forward_list_ = false; | 1655 dump_back_forward_list_ = false; |
| 1664 dump_navigation_policy_ = false; | |
| 1665 test_repaint_ = false; | 1656 test_repaint_ = false; |
| 1666 sweep_horizontally_ = false; | 1657 sweep_horizontally_ = false; |
| 1667 midi_accessor_result_ = true; | 1658 midi_accessor_result_ = true; |
| 1668 should_stay_on_page_after_handling_before_unload_ = false; | |
| 1669 should_dump_resource_priorities_ = false; | |
| 1670 has_custom_text_output_ = false; | 1659 has_custom_text_output_ = false; |
| 1671 custom_text_output_.clear(); | 1660 custom_text_output_.clear(); |
| 1672 | 1661 |
| 1673 http_headers_to_clear_.clear(); | 1662 http_headers_to_clear_.clear(); |
| 1674 | 1663 |
| 1675 platform_name_ = "chromium"; | 1664 platform_name_ = "chromium"; |
| 1676 tooltip_text_ = std::string(); | 1665 tooltip_text_ = std::string(); |
| 1677 web_history_item_count_ = 0; | 1666 web_history_item_count_ = 0; |
| 1678 intercept_post_message_ = false; | |
| 1679 | 1667 |
| 1680 SetUseMockTheme(true); | 1668 SetUseMockTheme(true); |
| 1681 | 1669 |
| 1682 pointer_locked_ = false; | 1670 pointer_locked_ = false; |
| 1683 pointer_lock_planned_result_ = PointerLockWillSucceed; | 1671 pointer_lock_planned_result_ = PointerLockWillSucceed; |
| 1684 | 1672 |
| 1685 weak_factory_.InvalidateWeakPtrs(); | 1673 weak_factory_.InvalidateWeakPtrs(); |
| 1686 work_queue_.Reset(); | 1674 work_queue_.Reset(); |
| 1687 | 1675 |
| 1688 if (close_remaining_windows_ && delegate_) | 1676 if (close_remaining_windows_ && delegate_) |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1758 base::Closure TestRunner::CreateClosureThatPostsV8Callback( | 1746 base::Closure TestRunner::CreateClosureThatPostsV8Callback( |
| 1759 const v8::Local<v8::Function>& callback) { | 1747 const v8::Local<v8::Function>& callback) { |
| 1760 return base::Bind( | 1748 return base::Bind( |
| 1761 &TestRunner::PostTask, weak_factory_.GetWeakPtr(), | 1749 &TestRunner::PostTask, weak_factory_.GetWeakPtr(), |
| 1762 base::Bind(&TestRunner::InvokeV8Callback, weak_factory_.GetWeakPtr(), | 1750 base::Bind(&TestRunner::InvokeV8Callback, weak_factory_.GetWeakPtr(), |
| 1763 v8::UniquePersistent<v8::Function>(blink::mainThreadIsolate(), | 1751 v8::UniquePersistent<v8::Function>(blink::mainThreadIsolate(), |
| 1764 callback))); | 1752 callback))); |
| 1765 } | 1753 } |
| 1766 | 1754 |
| 1767 bool TestRunner::shouldDumpEditingCallbacks() const { | 1755 bool TestRunner::shouldDumpEditingCallbacks() const { |
| 1768 return dump_editting_callbacks_; | 1756 return layout_test_runtime_flags_.dump_editting_callbacks(); |
| 1769 } | 1757 } |
| 1770 | 1758 |
| 1771 void TestRunner::setShouldDumpAsText(bool value) { | 1759 void TestRunner::setShouldDumpAsText(bool value) { |
| 1772 layout_test_runtime_flags_.set_dump_as_text(value); | 1760 layout_test_runtime_flags_.set_dump_as_text(value); |
| 1773 OnLayoutTestRuntimeFlagsChanged(); | 1761 OnLayoutTestRuntimeFlagsChanged(); |
| 1774 } | 1762 } |
| 1775 | 1763 |
| 1776 void TestRunner::setShouldDumpAsMarkup(bool value) { | 1764 void TestRunner::setShouldDumpAsMarkup(bool value) { |
| 1777 layout_test_runtime_flags_.set_dump_as_markup(value); | 1765 layout_test_runtime_flags_.set_dump_as_markup(value); |
| 1778 OnLayoutTestRuntimeFlagsChanged(); | 1766 OnLayoutTestRuntimeFlagsChanged(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1790 custom_text_output_ = text; | 1778 custom_text_output_ = text; |
| 1791 has_custom_text_output_ = true; | 1779 has_custom_text_output_ = true; |
| 1792 } | 1780 } |
| 1793 | 1781 |
| 1794 bool TestRunner::ShouldGeneratePixelResults() { | 1782 bool TestRunner::ShouldGeneratePixelResults() { |
| 1795 CheckResponseMimeType(); | 1783 CheckResponseMimeType(); |
| 1796 return layout_test_runtime_flags_.generate_pixel_results(); | 1784 return layout_test_runtime_flags_.generate_pixel_results(); |
| 1797 } | 1785 } |
| 1798 | 1786 |
| 1799 bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { | 1787 bool TestRunner::shouldStayOnPageAfterHandlingBeforeUnload() const { |
| 1800 return should_stay_on_page_after_handling_before_unload_; | 1788 return layout_test_runtime_flags_.stay_on_page_after_handling_before_unload(); |
| 1801 } | 1789 } |
| 1802 | 1790 |
| 1803 | 1791 |
| 1804 void TestRunner::setShouldGeneratePixelResults(bool value) { | 1792 void TestRunner::setShouldGeneratePixelResults(bool value) { |
| 1805 layout_test_runtime_flags_.set_generate_pixel_results(value); | 1793 layout_test_runtime_flags_.set_generate_pixel_results(value); |
| 1806 OnLayoutTestRuntimeFlagsChanged(); | 1794 OnLayoutTestRuntimeFlagsChanged(); |
| 1807 } | 1795 } |
| 1808 | 1796 |
| 1809 bool TestRunner::ShouldDumpAsAudio() const { | 1797 bool TestRunner::ShouldDumpAsAudio() const { |
| 1810 return dump_as_audio_; | 1798 return dump_as_audio_; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const { | 1847 bool TestRunner::HasCustomTextDump(std::string* custom_text_dump) const { |
| 1860 if (shouldDumpAsCustomText()) { | 1848 if (shouldDumpAsCustomText()) { |
| 1861 *custom_text_dump = customDumpText(); | 1849 *custom_text_dump = customDumpText(); |
| 1862 return true; | 1850 return true; |
| 1863 } | 1851 } |
| 1864 | 1852 |
| 1865 return false; | 1853 return false; |
| 1866 } | 1854 } |
| 1867 | 1855 |
| 1868 bool TestRunner::shouldDumpFrameLoadCallbacks() const { | 1856 bool TestRunner::shouldDumpFrameLoadCallbacks() const { |
| 1869 return test_is_running_ && dump_frame_load_callbacks_; | 1857 return test_is_running_ && |
| 1858 layout_test_runtime_flags_.dump_frame_load_callbacks(); |
| 1870 } | 1859 } |
| 1871 | 1860 |
| 1872 void TestRunner::setShouldDumpFrameLoadCallbacks(bool value) { | 1861 void TestRunner::setShouldDumpFrameLoadCallbacks(bool value) { |
| 1873 dump_frame_load_callbacks_ = value; | 1862 layout_test_runtime_flags_.set_dump_frame_load_callbacks(value); |
| 1863 OnLayoutTestRuntimeFlagsChanged(); |
| 1874 } | 1864 } |
| 1875 | 1865 |
| 1876 bool TestRunner::shouldDumpPingLoaderCallbacks() const { | 1866 bool TestRunner::shouldDumpPingLoaderCallbacks() const { |
| 1877 return test_is_running_ && dump_ping_loader_callbacks_; | 1867 return test_is_running_ && |
| 1868 layout_test_runtime_flags_.dump_ping_loader_callbacks(); |
| 1878 } | 1869 } |
| 1879 | 1870 |
| 1880 void TestRunner::setShouldEnableViewSource(bool value) { | 1871 void TestRunner::setShouldEnableViewSource(bool value) { |
| 1881 web_view_->mainFrame()->enableViewSourceMode(value); | 1872 web_view_->mainFrame()->enableViewSourceMode(value); |
| 1882 } | 1873 } |
| 1883 | 1874 |
| 1884 bool TestRunner::shouldDumpUserGestureInFrameLoadCallbacks() const { | 1875 bool TestRunner::shouldDumpUserGestureInFrameLoadCallbacks() const { |
| 1885 return test_is_running_ && dump_user_gesture_in_frame_load_callbacks_; | 1876 return test_is_running_ && |
| 1877 layout_test_runtime_flags_.dump_user_gesture_in_frame_load_callbacks(); |
| 1886 } | 1878 } |
| 1887 | 1879 |
| 1888 bool TestRunner::shouldDumpTitleChanges() const { | 1880 bool TestRunner::shouldDumpTitleChanges() const { |
| 1889 return dump_title_changes_; | 1881 return layout_test_runtime_flags_.dump_title_changes(); |
| 1890 } | 1882 } |
| 1891 | 1883 |
| 1892 bool TestRunner::shouldDumpIconChanges() const { | 1884 bool TestRunner::shouldDumpIconChanges() const { |
| 1893 return dump_icon_changes_; | 1885 return layout_test_runtime_flags_.dump_icon_changes(); |
| 1894 } | 1886 } |
| 1895 | 1887 |
| 1896 bool TestRunner::shouldDumpCreateView() const { | 1888 bool TestRunner::shouldDumpCreateView() const { |
| 1897 return dump_create_view_; | 1889 return dump_create_view_; |
| 1898 } | 1890 } |
| 1899 | 1891 |
| 1900 bool TestRunner::canOpenWindows() const { | 1892 bool TestRunner::canOpenWindows() const { |
| 1901 return can_open_windows_; | 1893 return can_open_windows_; |
| 1902 } | 1894 } |
| 1903 | 1895 |
| 1904 bool TestRunner::shouldDumpResourceLoadCallbacks() const { | 1896 bool TestRunner::shouldDumpResourceLoadCallbacks() const { |
| 1905 return test_is_running_ && dump_resource_load_callbacks_; | 1897 return test_is_running_ && |
| 1898 layout_test_runtime_flags_.dump_resource_load_callbacks(); |
| 1906 } | 1899 } |
| 1907 | 1900 |
| 1908 bool TestRunner::shouldDumpResourceResponseMIMETypes() const { | 1901 bool TestRunner::shouldDumpResourceResponseMIMETypes() const { |
| 1909 return test_is_running_ && dump_resource_response_mime_types_; | 1902 return test_is_running_ && |
| 1903 layout_test_runtime_flags_.dump_resource_response_mime_types(); |
| 1910 } | 1904 } |
| 1911 | 1905 |
| 1912 WebContentSettingsClient* TestRunner::GetWebContentSettings() const { | 1906 WebContentSettingsClient* TestRunner::GetWebContentSettings() const { |
| 1913 return mock_content_settings_client_.get(); | 1907 return mock_content_settings_client_.get(); |
| 1914 } | 1908 } |
| 1915 | 1909 |
| 1916 void TestRunner::InitializeWebViewWithMocks(blink::WebView* web_view) { | 1910 void TestRunner::InitializeWebViewWithMocks(blink::WebView* web_view) { |
| 1917 web_view->setSpellCheckClient(spellcheck_.get()); | 1911 web_view->setSpellCheckClient(spellcheck_.get()); |
| 1918 web_view->setCredentialManagerClient(credential_manager_client_.get()); | 1912 web_view->setCredentialManagerClient(credential_manager_client_.get()); |
| 1919 } | 1913 } |
| 1920 | 1914 |
| 1921 bool TestRunner::shouldDumpStatusCallbacks() const { | 1915 bool TestRunner::shouldDumpStatusCallbacks() const { |
| 1922 return dump_window_status_changes_; | 1916 return dump_window_status_changes_; |
| 1923 } | 1917 } |
| 1924 | 1918 |
| 1925 bool TestRunner::shouldDumpSpellCheckCallbacks() const { | 1919 bool TestRunner::shouldDumpSpellCheckCallbacks() const { |
| 1926 return dump_spell_check_callbacks_; | 1920 return dump_spell_check_callbacks_; |
| 1927 } | 1921 } |
| 1928 | 1922 |
| 1929 bool TestRunner::ShouldDumpBackForwardList() const { | 1923 bool TestRunner::ShouldDumpBackForwardList() const { |
| 1930 return dump_back_forward_list_; | 1924 return dump_back_forward_list_; |
| 1931 } | 1925 } |
| 1932 | 1926 |
| 1933 bool TestRunner::isPrinting() const { | 1927 bool TestRunner::isPrinting() const { |
| 1934 return layout_test_runtime_flags_.is_printing(); | 1928 return layout_test_runtime_flags_.is_printing(); |
| 1935 } | 1929 } |
| 1936 | 1930 |
| 1937 bool TestRunner::shouldWaitUntilExternalURLLoad() const { | 1931 bool TestRunner::shouldWaitUntilExternalURLLoad() const { |
| 1938 return wait_until_external_url_load_; | 1932 return layout_test_runtime_flags_.wait_until_external_url_load(); |
| 1939 } | 1933 } |
| 1940 | 1934 |
| 1941 const std::set<std::string>* TestRunner::httpHeadersToClear() const { | 1935 const std::set<std::string>* TestRunner::httpHeadersToClear() const { |
| 1942 return &http_headers_to_clear_; | 1936 return &http_headers_to_clear_; |
| 1943 } | 1937 } |
| 1944 | 1938 |
| 1945 void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear) { | 1939 void TestRunner::setTopLoadingFrame(WebFrame* frame, bool clear) { |
| 1946 if (frame->top()->view() != web_view_) | 1940 if (frame->top()->view() != web_view_) |
| 1947 return; | 1941 return; |
| 1948 if (!test_is_running_) | 1942 if (!test_is_running_) |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1972 | 1966 |
| 1973 bool TestRunner::policyDelegateIsPermissive() const { | 1967 bool TestRunner::policyDelegateIsPermissive() const { |
| 1974 return layout_test_runtime_flags_.policy_delegate_is_permissive(); | 1968 return layout_test_runtime_flags_.policy_delegate_is_permissive(); |
| 1975 } | 1969 } |
| 1976 | 1970 |
| 1977 bool TestRunner::policyDelegateShouldNotifyDone() const { | 1971 bool TestRunner::policyDelegateShouldNotifyDone() const { |
| 1978 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); | 1972 return layout_test_runtime_flags_.policy_delegate_should_notify_done(); |
| 1979 } | 1973 } |
| 1980 | 1974 |
| 1981 bool TestRunner::shouldInterceptPostMessage() const { | 1975 bool TestRunner::shouldInterceptPostMessage() const { |
| 1982 return intercept_post_message_; | 1976 return layout_test_runtime_flags_.intercept_post_message(); |
| 1983 } | 1977 } |
| 1984 | 1978 |
| 1985 bool TestRunner::shouldDumpResourcePriorities() const { | 1979 bool TestRunner::shouldDumpResourcePriorities() const { |
| 1986 return should_dump_resource_priorities_; | 1980 return layout_test_runtime_flags_.dump_resource_priorities(); |
| 1987 } | 1981 } |
| 1988 | 1982 |
| 1989 bool TestRunner::RequestPointerLock() { | 1983 bool TestRunner::RequestPointerLock() { |
| 1990 switch (pointer_lock_planned_result_) { | 1984 switch (pointer_lock_planned_result_) { |
| 1991 case PointerLockWillSucceed: | 1985 case PointerLockWillSucceed: |
| 1992 PostDelayedTask(0, base::Bind(&TestRunner::DidAcquirePointerLockInternal, | 1986 PostDelayedTask(0, base::Bind(&TestRunner::DidAcquirePointerLockInternal, |
| 1993 weak_factory_.GetWeakPtr())); | 1987 weak_factory_.GetWeakPtr())); |
| 1994 return true; | 1988 return true; |
| 1995 case PointerLockWillRespondAsync: | 1989 case PointerLockWillRespondAsync: |
| 1996 DCHECK(!pointer_locked_); | 1990 DCHECK(!pointer_locked_); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2019 | 2013 |
| 2020 void TestRunner::setDragImage( | 2014 void TestRunner::setDragImage( |
| 2021 const blink::WebImage& drag_image) { | 2015 const blink::WebImage& drag_image) { |
| 2022 if (layout_test_runtime_flags_.dump_drag_image()) { | 2016 if (layout_test_runtime_flags_.dump_drag_image()) { |
| 2023 if (drag_image_.isNull()) | 2017 if (drag_image_.isNull()) |
| 2024 drag_image_ = drag_image; | 2018 drag_image_ = drag_image; |
| 2025 } | 2019 } |
| 2026 } | 2020 } |
| 2027 | 2021 |
| 2028 bool TestRunner::shouldDumpNavigationPolicy() const { | 2022 bool TestRunner::shouldDumpNavigationPolicy() const { |
| 2029 return dump_navigation_policy_; | 2023 return layout_test_runtime_flags_.dump_navigation_policy(); |
| 2030 } | 2024 } |
| 2031 | 2025 |
| 2032 bool TestRunner::midiAccessorResult() { | 2026 bool TestRunner::midiAccessorResult() { |
| 2033 return midi_accessor_result_; | 2027 return midi_accessor_result_; |
| 2034 } | 2028 } |
| 2035 | 2029 |
| 2036 void TestRunner::ClearDevToolsLocalStorage() { | 2030 void TestRunner::ClearDevToolsLocalStorage() { |
| 2037 delegate_->ClearDevToolsLocalStorage(); | 2031 delegate_->ClearDevToolsLocalStorage(); |
| 2038 } | 2032 } |
| 2039 | 2033 |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2647 | 2641 |
| 2648 void TestRunner::OnAnimationScheduled(blink::WebView* view) { | 2642 void TestRunner::OnAnimationScheduled(blink::WebView* view) { |
| 2649 views_with_scheduled_animations_.insert(view); | 2643 views_with_scheduled_animations_.insert(view); |
| 2650 } | 2644 } |
| 2651 | 2645 |
| 2652 void TestRunner::OnAnimationBegun(blink::WebView* view) { | 2646 void TestRunner::OnAnimationBegun(blink::WebView* view) { |
| 2653 views_with_scheduled_animations_.erase(view); | 2647 views_with_scheduled_animations_.erase(view); |
| 2654 } | 2648 } |
| 2655 | 2649 |
| 2656 void TestRunner::DumpEditingCallbacks() { | 2650 void TestRunner::DumpEditingCallbacks() { |
| 2657 dump_editting_callbacks_ = true; | 2651 layout_test_runtime_flags_.set_dump_editting_callbacks(true); |
| 2652 OnLayoutTestRuntimeFlagsChanged(); |
| 2658 } | 2653 } |
| 2659 | 2654 |
| 2660 void TestRunner::DumpAsMarkup() { | 2655 void TestRunner::DumpAsMarkup() { |
| 2661 layout_test_runtime_flags_.set_dump_as_markup(true); | 2656 layout_test_runtime_flags_.set_dump_as_markup(true); |
| 2662 layout_test_runtime_flags_.set_generate_pixel_results(false); | 2657 layout_test_runtime_flags_.set_generate_pixel_results(false); |
| 2663 OnLayoutTestRuntimeFlagsChanged(); | 2658 OnLayoutTestRuntimeFlagsChanged(); |
| 2664 } | 2659 } |
| 2665 | 2660 |
| 2666 void TestRunner::DumpAsText() { | 2661 void TestRunner::DumpAsText() { |
| 2667 layout_test_runtime_flags_.set_dump_as_text(true); | 2662 layout_test_runtime_flags_.set_dump_as_text(true); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2684 layout_test_runtime_flags_.set_dump_child_frames_as_markup(true); | 2679 layout_test_runtime_flags_.set_dump_child_frames_as_markup(true); |
| 2685 OnLayoutTestRuntimeFlagsChanged(); | 2680 OnLayoutTestRuntimeFlagsChanged(); |
| 2686 } | 2681 } |
| 2687 | 2682 |
| 2688 void TestRunner::DumpChildFramesAsText() { | 2683 void TestRunner::DumpChildFramesAsText() { |
| 2689 layout_test_runtime_flags_.set_dump_child_frames_as_text(true); | 2684 layout_test_runtime_flags_.set_dump_child_frames_as_text(true); |
| 2690 OnLayoutTestRuntimeFlagsChanged(); | 2685 OnLayoutTestRuntimeFlagsChanged(); |
| 2691 } | 2686 } |
| 2692 | 2687 |
| 2693 void TestRunner::DumpIconChanges() { | 2688 void TestRunner::DumpIconChanges() { |
| 2694 dump_icon_changes_ = true; | 2689 layout_test_runtime_flags_.set_dump_icon_changes(true); |
| 2690 OnLayoutTestRuntimeFlagsChanged(); |
| 2695 } | 2691 } |
| 2696 | 2692 |
| 2697 void TestRunner::SetAudioData(const gin::ArrayBufferView& view) { | 2693 void TestRunner::SetAudioData(const gin::ArrayBufferView& view) { |
| 2698 unsigned char* bytes = static_cast<unsigned char*>(view.bytes()); | 2694 unsigned char* bytes = static_cast<unsigned char*>(view.bytes()); |
| 2699 audio_data_.resize(view.num_bytes()); | 2695 audio_data_.resize(view.num_bytes()); |
| 2700 std::copy(bytes, bytes + view.num_bytes(), audio_data_.begin()); | 2696 std::copy(bytes, bytes + view.num_bytes(), audio_data_.begin()); |
| 2701 dump_as_audio_ = true; | 2697 dump_as_audio_ = true; |
| 2702 } | 2698 } |
| 2703 | 2699 |
| 2704 void TestRunner::DumpFrameLoadCallbacks() { | 2700 void TestRunner::DumpFrameLoadCallbacks() { |
| 2705 dump_frame_load_callbacks_ = true; | 2701 layout_test_runtime_flags_.set_dump_frame_load_callbacks(true); |
| 2702 OnLayoutTestRuntimeFlagsChanged(); |
| 2706 } | 2703 } |
| 2707 | 2704 |
| 2708 void TestRunner::DumpPingLoaderCallbacks() { | 2705 void TestRunner::DumpPingLoaderCallbacks() { |
| 2709 dump_ping_loader_callbacks_ = true; | 2706 layout_test_runtime_flags_.set_dump_ping_loader_callbacks(true); |
| 2707 OnLayoutTestRuntimeFlagsChanged(); |
| 2710 } | 2708 } |
| 2711 | 2709 |
| 2712 void TestRunner::DumpUserGestureInFrameLoadCallbacks() { | 2710 void TestRunner::DumpUserGestureInFrameLoadCallbacks() { |
| 2713 dump_user_gesture_in_frame_load_callbacks_ = true; | 2711 layout_test_runtime_flags_.set_dump_user_gesture_in_frame_load_callbacks( |
| 2712 true); |
| 2713 OnLayoutTestRuntimeFlagsChanged(); |
| 2714 } | 2714 } |
| 2715 | 2715 |
| 2716 void TestRunner::DumpTitleChanges() { | 2716 void TestRunner::DumpTitleChanges() { |
| 2717 dump_title_changes_ = true; | 2717 layout_test_runtime_flags_.set_dump_title_changes(true); |
| 2718 OnLayoutTestRuntimeFlagsChanged(); |
| 2718 } | 2719 } |
| 2719 | 2720 |
| 2720 void TestRunner::DumpCreateView() { | 2721 void TestRunner::DumpCreateView() { |
| 2721 dump_create_view_ = true; | 2722 dump_create_view_ = true; |
| 2722 } | 2723 } |
| 2723 | 2724 |
| 2724 void TestRunner::SetCanOpenWindows() { | 2725 void TestRunner::SetCanOpenWindows() { |
| 2725 can_open_windows_ = true; | 2726 can_open_windows_ = true; |
| 2726 } | 2727 } |
| 2727 | 2728 |
| 2728 void TestRunner::DumpResourceLoadCallbacks() { | 2729 void TestRunner::DumpResourceLoadCallbacks() { |
| 2729 dump_resource_load_callbacks_ = true; | 2730 layout_test_runtime_flags_.set_dump_resource_load_callbacks(true); |
| 2731 OnLayoutTestRuntimeFlagsChanged(); |
| 2730 } | 2732 } |
| 2731 | 2733 |
| 2732 void TestRunner::DumpResourceResponseMIMETypes() { | 2734 void TestRunner::DumpResourceResponseMIMETypes() { |
| 2733 dump_resource_response_mime_types_ = true; | 2735 layout_test_runtime_flags_.set_dump_resource_response_mime_types(true); |
| 2736 OnLayoutTestRuntimeFlagsChanged(); |
| 2734 } | 2737 } |
| 2735 | 2738 |
| 2736 void TestRunner::SetImagesAllowed(bool allowed) { | 2739 void TestRunner::SetImagesAllowed(bool allowed) { |
| 2737 layout_test_runtime_flags_.set_images_allowed(allowed); | 2740 layout_test_runtime_flags_.set_images_allowed(allowed); |
| 2738 OnLayoutTestRuntimeFlagsChanged(); | 2741 OnLayoutTestRuntimeFlagsChanged(); |
| 2739 } | 2742 } |
| 2740 | 2743 |
| 2741 void TestRunner::SetMediaAllowed(bool allowed) { | 2744 void TestRunner::SetMediaAllowed(bool allowed) { |
| 2742 layout_test_runtime_flags_.set_media_allowed(allowed); | 2745 layout_test_runtime_flags_.set_media_allowed(allowed); |
| 2743 OnLayoutTestRuntimeFlagsChanged(); | 2746 OnLayoutTestRuntimeFlagsChanged(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2795 layout_test_runtime_flags_.set_is_printing(true); | 2798 layout_test_runtime_flags_.set_is_printing(true); |
| 2796 OnLayoutTestRuntimeFlagsChanged(); | 2799 OnLayoutTestRuntimeFlagsChanged(); |
| 2797 } | 2800 } |
| 2798 | 2801 |
| 2799 void TestRunner::ClearPrinting() { | 2802 void TestRunner::ClearPrinting() { |
| 2800 layout_test_runtime_flags_.set_is_printing(false); | 2803 layout_test_runtime_flags_.set_is_printing(false); |
| 2801 OnLayoutTestRuntimeFlagsChanged(); | 2804 OnLayoutTestRuntimeFlagsChanged(); |
| 2802 } | 2805 } |
| 2803 | 2806 |
| 2804 void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) { | 2807 void TestRunner::SetShouldStayOnPageAfterHandlingBeforeUnload(bool value) { |
| 2805 should_stay_on_page_after_handling_before_unload_ = value; | 2808 layout_test_runtime_flags_.set_stay_on_page_after_handling_before_unload( |
| 2809 value); |
| 2810 OnLayoutTestRuntimeFlagsChanged(); |
| 2806 } | 2811 } |
| 2807 | 2812 |
| 2808 void TestRunner::SetWillSendRequestClearHeader(const std::string& header) { | 2813 void TestRunner::SetWillSendRequestClearHeader(const std::string& header) { |
| 2809 if (!header.empty()) | 2814 if (!header.empty()) |
| 2810 http_headers_to_clear_.insert(header); | 2815 http_headers_to_clear_.insert(header); |
| 2811 } | 2816 } |
| 2812 | 2817 |
| 2813 void TestRunner::DumpResourceRequestPriorities() { | 2818 void TestRunner::DumpResourceRequestPriorities() { |
| 2814 should_dump_resource_priorities_ = true; | 2819 layout_test_runtime_flags_.set_dump_resource_priorities(true); |
| 2820 OnLayoutTestRuntimeFlagsChanged(); |
| 2815 } | 2821 } |
| 2816 | 2822 |
| 2817 void TestRunner::SetUseMockTheme(bool use) { | 2823 void TestRunner::SetUseMockTheme(bool use) { |
| 2818 use_mock_theme_ = use; | 2824 use_mock_theme_ = use; |
| 2819 blink::setMockThemeEnabledForTest(use); | 2825 blink::setMockThemeEnabledForTest(use); |
| 2820 } | 2826 } |
| 2821 | 2827 |
| 2822 void TestRunner::ShowWebInspector(const std::string& str, | 2828 void TestRunner::ShowWebInspector(const std::string& str, |
| 2823 const std::string& frontend_url) { | 2829 const std::string& frontend_url) { |
| 2824 ShowDevTools(str, frontend_url); | 2830 ShowDevTools(str, frontend_url); |
| 2825 } | 2831 } |
| 2826 | 2832 |
| 2827 void TestRunner::WaitUntilExternalURLLoad() { | 2833 void TestRunner::WaitUntilExternalURLLoad() { |
| 2828 wait_until_external_url_load_ = true; | 2834 layout_test_runtime_flags_.set_wait_until_external_url_load(true); |
| 2835 OnLayoutTestRuntimeFlagsChanged(); |
| 2829 } | 2836 } |
| 2830 | 2837 |
| 2831 void TestRunner::DumpDragImage() { | 2838 void TestRunner::DumpDragImage() { |
| 2832 layout_test_runtime_flags_.set_dump_drag_image(true); | 2839 layout_test_runtime_flags_.set_dump_drag_image(true); |
| 2833 DumpAsTextWithPixelResults(); | 2840 DumpAsTextWithPixelResults(); |
| 2834 OnLayoutTestRuntimeFlagsChanged(); | 2841 OnLayoutTestRuntimeFlagsChanged(); |
| 2835 } | 2842 } |
| 2836 | 2843 |
| 2837 void TestRunner::DumpNavigationPolicy() { | 2844 void TestRunner::DumpNavigationPolicy() { |
| 2838 dump_navigation_policy_ = true; | 2845 layout_test_runtime_flags_.set_dump_navigation_policy(true); |
| 2846 OnLayoutTestRuntimeFlagsChanged(); |
| 2839 } | 2847 } |
| 2840 | 2848 |
| 2841 void TestRunner::DumpPageImportanceSignals() { | 2849 void TestRunner::DumpPageImportanceSignals() { |
| 2842 blink::WebPageImportanceSignals* signals = | 2850 blink::WebPageImportanceSignals* signals = |
| 2843 web_view_->pageImportanceSignals(); | 2851 web_view_->pageImportanceSignals(); |
| 2844 if (!signals) | 2852 if (!signals) |
| 2845 return; | 2853 return; |
| 2846 | 2854 |
| 2847 std::string message = base::StringPrintf( | 2855 std::string message = base::StringPrintf( |
| 2848 "WebPageImportanceSignals:\n" | 2856 "WebPageImportanceSignals:\n" |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3276 } | 3284 } |
| 3277 | 3285 |
| 3278 void TestRunner::DidLosePointerLockInternal() { | 3286 void TestRunner::DidLosePointerLockInternal() { |
| 3279 bool was_locked = pointer_locked_; | 3287 bool was_locked = pointer_locked_; |
| 3280 pointer_locked_ = false; | 3288 pointer_locked_ = false; |
| 3281 if (was_locked) | 3289 if (was_locked) |
| 3282 web_view_->didLosePointerLock(); | 3290 web_view_->didLosePointerLock(); |
| 3283 } | 3291 } |
| 3284 | 3292 |
| 3285 } // namespace test_runner | 3293 } // namespace test_runner |
| OLD | NEW |