| 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 "content/shell/renderer/test_runner/test_runner.h" | 5 #include "content/shell/renderer/test_runner/test_runner.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/shell/common/test_runner/test_preferences.h" | 10 #include "content/shell/common/test_runner/test_preferences.h" |
| 11 #include "content/shell/renderer/binding_helpers.h" | 11 #include "content/shell/renderer/binding_helpers.h" |
| 12 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | |
| 13 #include "content/shell/renderer/test_runner/mock_credential_manager_client.h" | 12 #include "content/shell/renderer/test_runner/mock_credential_manager_client.h" |
| 14 #include "content/shell/renderer/test_runner/mock_web_push_client.h" | 13 #include "content/shell/renderer/test_runner/mock_web_push_client.h" |
| 15 #include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h" | 14 #include "content/shell/renderer/test_runner/mock_web_speech_recognizer.h" |
| 16 #include "content/shell/renderer/test_runner/notification_presenter.h" | 15 #include "content/shell/renderer/test_runner/notification_presenter.h" |
| 17 #include "content/shell/renderer/test_runner/test_interfaces.h" | 16 #include "content/shell/renderer/test_runner/test_interfaces.h" |
| 18 #include "content/shell/renderer/test_runner/web_permissions.h" | 17 #include "content/shell/renderer/test_runner/web_permissions.h" |
| 18 #include "content/shell/renderer/test_runner/web_test_delegate.h" |
| 19 #include "content/shell/renderer/test_runner/web_test_proxy.h" | 19 #include "content/shell/renderer/test_runner/web_test_proxy.h" |
| 20 #include "gin/arguments.h" | 20 #include "gin/arguments.h" |
| 21 #include "gin/array_buffer.h" | 21 #include "gin/array_buffer.h" |
| 22 #include "gin/handle.h" | 22 #include "gin/handle.h" |
| 23 #include "gin/object_template_builder.h" | 23 #include "gin/object_template_builder.h" |
| 24 #include "gin/wrappable.h" | 24 #include "gin/wrappable.h" |
| 25 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" | 25 #include "third_party/WebKit/public/platform/WebArrayBuffer.h" |
| 26 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" | 26 #include "third_party/WebKit/public/platform/WebBatteryStatus.h" |
| 27 #include "third_party/WebKit/public/platform/WebCanvas.h" | 27 #include "third_party/WebKit/public/platform/WebCanvas.h" |
| 28 #include "third_party/WebKit/public/platform/WebData.h" | 28 #include "third_party/WebKit/public/platform/WebData.h" |
| (...skipping 1434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 TestRunner::WorkQueue::~WorkQueue() { | 1463 TestRunner::WorkQueue::~WorkQueue() { |
| 1464 Reset(); | 1464 Reset(); |
| 1465 } | 1465 } |
| 1466 | 1466 |
| 1467 void TestRunner::WorkQueue::ProcessWorkSoon() { | 1467 void TestRunner::WorkQueue::ProcessWorkSoon() { |
| 1468 if (controller_->topLoadingFrame()) | 1468 if (controller_->topLoadingFrame()) |
| 1469 return; | 1469 return; |
| 1470 | 1470 |
| 1471 if (!queue_.empty()) { | 1471 if (!queue_.empty()) { |
| 1472 // We delay processing queued work to avoid recursion problems. | 1472 // We delay processing queued work to avoid recursion problems. |
| 1473 controller_->delegate_->postTask(new WorkQueueTask(this)); | 1473 controller_->delegate_->PostTask(new WorkQueueTask(this)); |
| 1474 } else if (!controller_->wait_until_done_) { | 1474 } else if (!controller_->wait_until_done_) { |
| 1475 controller_->delegate_->testFinished(); | 1475 controller_->delegate_->TestFinished(); |
| 1476 } | 1476 } |
| 1477 } | 1477 } |
| 1478 | 1478 |
| 1479 void TestRunner::WorkQueue::Reset() { | 1479 void TestRunner::WorkQueue::Reset() { |
| 1480 frozen_ = false; | 1480 frozen_ = false; |
| 1481 while (!queue_.empty()) { | 1481 while (!queue_.empty()) { |
| 1482 delete queue_.front(); | 1482 delete queue_.front(); |
| 1483 queue_.pop_front(); | 1483 queue_.pop_front(); |
| 1484 } | 1484 } |
| 1485 } | 1485 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1497 while (!queue_.empty()) { | 1497 while (!queue_.empty()) { |
| 1498 bool startedLoad = queue_.front()->Run(controller_->delegate_, | 1498 bool startedLoad = queue_.front()->Run(controller_->delegate_, |
| 1499 controller_->web_view_); | 1499 controller_->web_view_); |
| 1500 delete queue_.front(); | 1500 delete queue_.front(); |
| 1501 queue_.pop_front(); | 1501 queue_.pop_front(); |
| 1502 if (startedLoad) | 1502 if (startedLoad) |
| 1503 return; | 1503 return; |
| 1504 } | 1504 } |
| 1505 | 1505 |
| 1506 if (!controller_->wait_until_done_ && !controller_->topLoadingFrame()) | 1506 if (!controller_->wait_until_done_ && !controller_->topLoadingFrame()) |
| 1507 controller_->delegate_->testFinished(); | 1507 controller_->delegate_->TestFinished(); |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 void TestRunner::WorkQueue::WorkQueueTask::RunIfValid() { | 1510 void TestRunner::WorkQueue::WorkQueueTask::RunIfValid() { |
| 1511 object_->ProcessWork(); | 1511 object_->ProcessWork(); |
| 1512 } | 1512 } |
| 1513 | 1513 |
| 1514 TestRunner::TestRunner(TestInterfaces* interfaces) | 1514 TestRunner::TestRunner(TestInterfaces* interfaces) |
| 1515 : test_is_running_(false), | 1515 : test_is_running_(false), |
| 1516 close_remaining_windows_(false), | 1516 close_remaining_windows_(false), |
| 1517 work_queue_(this), | 1517 work_queue_(this), |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 policy_delegate_is_permissive_ = false; | 1572 policy_delegate_is_permissive_ = false; |
| 1573 policy_delegate_should_notify_done_ = false; | 1573 policy_delegate_should_notify_done_ = false; |
| 1574 | 1574 |
| 1575 WebSecurityPolicy::resetOriginAccessWhitelists(); | 1575 WebSecurityPolicy::resetOriginAccessWhitelists(); |
| 1576 #if defined(__linux__) || defined(ANDROID) | 1576 #if defined(__linux__) || defined(ANDROID) |
| 1577 WebFontRendering::setSubpixelPositioning(false); | 1577 WebFontRendering::setSubpixelPositioning(false); |
| 1578 #endif | 1578 #endif |
| 1579 | 1579 |
| 1580 if (delegate_) { | 1580 if (delegate_) { |
| 1581 // Reset the default quota for each origin to 5MB | 1581 // Reset the default quota for each origin to 5MB |
| 1582 delegate_->setDatabaseQuota(5 * 1024 * 1024); | 1582 delegate_->SetDatabaseQuota(5 * 1024 * 1024); |
| 1583 delegate_->setDeviceColorProfile("reset"); | 1583 delegate_->SetDeviceColorProfile("reset"); |
| 1584 delegate_->setDeviceScaleFactor(1); | 1584 delegate_->SetDeviceScaleFactor(1); |
| 1585 delegate_->setAcceptAllCookies(false); | 1585 delegate_->SetAcceptAllCookies(false); |
| 1586 delegate_->setLocale(""); | 1586 delegate_->SetLocale(""); |
| 1587 delegate_->useUnfortunateSynchronousResizeMode(false); | 1587 delegate_->UseUnfortunateSynchronousResizeMode(false); |
| 1588 delegate_->disableAutoResizeMode(WebSize()); | 1588 delegate_->DisableAutoResizeMode(WebSize()); |
| 1589 delegate_->deleteAllCookies(); | 1589 delegate_->DeleteAllCookies(); |
| 1590 delegate_->resetScreenOrientation(); | 1590 delegate_->ResetScreenOrientation(); |
| 1591 ResetBatteryStatus(); | 1591 ResetBatteryStatus(); |
| 1592 ResetDeviceLight(); | 1592 ResetDeviceLight(); |
| 1593 } | 1593 } |
| 1594 | 1594 |
| 1595 dump_editting_callbacks_ = false; | 1595 dump_editting_callbacks_ = false; |
| 1596 dump_as_text_ = false; | 1596 dump_as_text_ = false; |
| 1597 dump_as_markup_ = false; | 1597 dump_as_markup_ = false; |
| 1598 generate_pixel_results_ = true; | 1598 generate_pixel_results_ = true; |
| 1599 dump_child_frame_scroll_positions_ = false; | 1599 dump_child_frame_scroll_positions_ = false; |
| 1600 dump_child_frames_as_markup_ = false; | 1600 dump_child_frames_as_markup_ = false; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 | 1636 |
| 1637 notification_presenter_->Reset(); | 1637 notification_presenter_->Reset(); |
| 1638 use_mock_theme_ = true; | 1638 use_mock_theme_ = true; |
| 1639 pointer_locked_ = false; | 1639 pointer_locked_ = false; |
| 1640 pointer_lock_planned_result_ = PointerLockWillSucceed; | 1640 pointer_lock_planned_result_ = PointerLockWillSucceed; |
| 1641 | 1641 |
| 1642 task_list_.RevokeAll(); | 1642 task_list_.RevokeAll(); |
| 1643 work_queue_.Reset(); | 1643 work_queue_.Reset(); |
| 1644 | 1644 |
| 1645 if (close_remaining_windows_ && delegate_) | 1645 if (close_remaining_windows_ && delegate_) |
| 1646 delegate_->closeRemainingWindows(); | 1646 delegate_->CloseRemainingWindows(); |
| 1647 else | 1647 else |
| 1648 close_remaining_windows_ = true; | 1648 close_remaining_windows_ = true; |
| 1649 } | 1649 } |
| 1650 | 1650 |
| 1651 void TestRunner::SetTestIsRunning(bool running) { | 1651 void TestRunner::SetTestIsRunning(bool running) { |
| 1652 test_is_running_ = running; | 1652 test_is_running_ = running; |
| 1653 } | 1653 } |
| 1654 | 1654 |
| 1655 void TestRunner::InvokeCallback(scoped_ptr<InvokeCallbackTask> task) { | 1655 void TestRunner::InvokeCallback(scoped_ptr<InvokeCallbackTask> task) { |
| 1656 delegate_->postTask(task.release()); | 1656 delegate_->PostTask(task.release()); |
| 1657 } | 1657 } |
| 1658 | 1658 |
| 1659 bool TestRunner::shouldDumpEditingCallbacks() const { | 1659 bool TestRunner::shouldDumpEditingCallbacks() const { |
| 1660 return dump_editting_callbacks_; | 1660 return dump_editting_callbacks_; |
| 1661 } | 1661 } |
| 1662 | 1662 |
| 1663 bool TestRunner::shouldDumpAsText() { | 1663 bool TestRunner::shouldDumpAsText() { |
| 1664 CheckResponseMimeType(); | 1664 CheckResponseMimeType(); |
| 1665 return dump_as_text_; | 1665 return dump_as_text_; |
| 1666 } | 1666 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 top_loading_frame_ = frame; | 1823 top_loading_frame_ = frame; |
| 1824 } | 1824 } |
| 1825 } | 1825 } |
| 1826 | 1826 |
| 1827 WebFrame* TestRunner::topLoadingFrame() const { | 1827 WebFrame* TestRunner::topLoadingFrame() const { |
| 1828 return top_loading_frame_; | 1828 return top_loading_frame_; |
| 1829 } | 1829 } |
| 1830 | 1830 |
| 1831 void TestRunner::policyDelegateDone() { | 1831 void TestRunner::policyDelegateDone() { |
| 1832 DCHECK(wait_until_done_); | 1832 DCHECK(wait_until_done_); |
| 1833 delegate_->testFinished(); | 1833 delegate_->TestFinished(); |
| 1834 wait_until_done_ = false; | 1834 wait_until_done_ = false; |
| 1835 } | 1835 } |
| 1836 | 1836 |
| 1837 bool TestRunner::policyDelegateEnabled() const { | 1837 bool TestRunner::policyDelegateEnabled() const { |
| 1838 return policy_delegate_enabled_; | 1838 return policy_delegate_enabled_; |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 bool TestRunner::policyDelegateIsPermissive() const { | 1841 bool TestRunner::policyDelegateIsPermissive() const { |
| 1842 return policy_delegate_is_permissive_; | 1842 return policy_delegate_is_permissive_; |
| 1843 } | 1843 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1854 return should_dump_resource_priorities_; | 1854 return should_dump_resource_priorities_; |
| 1855 } | 1855 } |
| 1856 | 1856 |
| 1857 WebNotificationPresenter* TestRunner::notification_presenter() const { | 1857 WebNotificationPresenter* TestRunner::notification_presenter() const { |
| 1858 return notification_presenter_.get(); | 1858 return notification_presenter_.get(); |
| 1859 } | 1859 } |
| 1860 | 1860 |
| 1861 bool TestRunner::RequestPointerLock() { | 1861 bool TestRunner::RequestPointerLock() { |
| 1862 switch (pointer_lock_planned_result_) { | 1862 switch (pointer_lock_planned_result_) { |
| 1863 case PointerLockWillSucceed: | 1863 case PointerLockWillSucceed: |
| 1864 delegate_->postDelayedTask( | 1864 delegate_->PostDelayedTask( |
| 1865 new HostMethodTask(this, &TestRunner::DidAcquirePointerLockInternal), | 1865 new HostMethodTask(this, &TestRunner::DidAcquirePointerLockInternal), |
| 1866 0); | 1866 0); |
| 1867 return true; | 1867 return true; |
| 1868 case PointerLockWillRespondAsync: | 1868 case PointerLockWillRespondAsync: |
| 1869 DCHECK(!pointer_locked_); | 1869 DCHECK(!pointer_locked_); |
| 1870 return true; | 1870 return true; |
| 1871 case PointerLockWillFailSync: | 1871 case PointerLockWillFailSync: |
| 1872 DCHECK(!pointer_locked_); | 1872 DCHECK(!pointer_locked_); |
| 1873 return false; | 1873 return false; |
| 1874 default: | 1874 default: |
| 1875 NOTREACHED(); | 1875 NOTREACHED(); |
| 1876 return false; | 1876 return false; |
| 1877 } | 1877 } |
| 1878 } | 1878 } |
| 1879 | 1879 |
| 1880 void TestRunner::RequestPointerUnlock() { | 1880 void TestRunner::RequestPointerUnlock() { |
| 1881 delegate_->postDelayedTask( | 1881 delegate_->PostDelayedTask( |
| 1882 new HostMethodTask(this, &TestRunner::DidLosePointerLockInternal), 0); | 1882 new HostMethodTask(this, &TestRunner::DidLosePointerLockInternal), 0); |
| 1883 } | 1883 } |
| 1884 | 1884 |
| 1885 bool TestRunner::isPointerLocked() { | 1885 bool TestRunner::isPointerLocked() { |
| 1886 return pointer_locked_; | 1886 return pointer_locked_; |
| 1887 } | 1887 } |
| 1888 | 1888 |
| 1889 void TestRunner::setToolTipText(const WebString& text) { | 1889 void TestRunner::setToolTipText(const WebString& text) { |
| 1890 tooltip_text_ = text.utf8(); | 1890 tooltip_text_ = text.utf8(); |
| 1891 } | 1891 } |
| 1892 | 1892 |
| 1893 bool TestRunner::midiAccessorResult() { | 1893 bool TestRunner::midiAccessorResult() { |
| 1894 return midi_accessor_result_; | 1894 return midi_accessor_result_; |
| 1895 } | 1895 } |
| 1896 | 1896 |
| 1897 void TestRunner::clearDevToolsLocalStorage() { | 1897 void TestRunner::ClearDevToolsLocalStorage() { |
| 1898 delegate_->clearDevToolsLocalStorage(); | 1898 delegate_->ClearDevToolsLocalStorage(); |
| 1899 } | 1899 } |
| 1900 | 1900 |
| 1901 void TestRunner::showDevTools(const std::string& settings, | 1901 void TestRunner::ShowDevTools(const std::string& settings, |
| 1902 const std::string& frontend_url) { | 1902 const std::string& frontend_url) { |
| 1903 delegate_->showDevTools(settings, frontend_url); | 1903 delegate_->ShowDevTools(settings, frontend_url); |
| 1904 } | 1904 } |
| 1905 | 1905 |
| 1906 class WorkItemBackForward : public TestRunner::WorkItem { | 1906 class WorkItemBackForward : public TestRunner::WorkItem { |
| 1907 public: | 1907 public: |
| 1908 WorkItemBackForward(int distance) : distance_(distance) {} | 1908 WorkItemBackForward(int distance) : distance_(distance) {} |
| 1909 | 1909 |
| 1910 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { | 1910 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { |
| 1911 delegate->goToOffset(distance_); | 1911 delegate->GoToOffset(distance_); |
| 1912 return true; // FIXME: Did it really start a navigation? | 1912 return true; // FIXME: Did it really start a navigation? |
| 1913 } | 1913 } |
| 1914 | 1914 |
| 1915 private: | 1915 private: |
| 1916 int distance_; | 1916 int distance_; |
| 1917 }; | 1917 }; |
| 1918 | 1918 |
| 1919 void TestRunner::NotifyDone() { | 1919 void TestRunner::NotifyDone() { |
| 1920 if (disable_notify_done_) | 1920 if (disable_notify_done_) |
| 1921 return; | 1921 return; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1934 work_queue_.AddWork(new WorkItemBackForward(-how_far_back)); | 1934 work_queue_.AddWork(new WorkItemBackForward(-how_far_back)); |
| 1935 } | 1935 } |
| 1936 | 1936 |
| 1937 void TestRunner::QueueForwardNavigation(int how_far_forward) { | 1937 void TestRunner::QueueForwardNavigation(int how_far_forward) { |
| 1938 work_queue_.AddWork(new WorkItemBackForward(how_far_forward)); | 1938 work_queue_.AddWork(new WorkItemBackForward(how_far_forward)); |
| 1939 } | 1939 } |
| 1940 | 1940 |
| 1941 class WorkItemReload : public TestRunner::WorkItem { | 1941 class WorkItemReload : public TestRunner::WorkItem { |
| 1942 public: | 1942 public: |
| 1943 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { | 1943 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { |
| 1944 delegate->reload(); | 1944 delegate->Reload(); |
| 1945 return true; | 1945 return true; |
| 1946 } | 1946 } |
| 1947 }; | 1947 }; |
| 1948 | 1948 |
| 1949 void TestRunner::QueueReload() { | 1949 void TestRunner::QueueReload() { |
| 1950 work_queue_.AddWork(new WorkItemReload()); | 1950 work_queue_.AddWork(new WorkItemReload()); |
| 1951 } | 1951 } |
| 1952 | 1952 |
| 1953 class WorkItemLoadingScript : public TestRunner::WorkItem { | 1953 class WorkItemLoadingScript : public TestRunner::WorkItem { |
| 1954 public: | 1954 public: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1987 void TestRunner::QueueNonLoadingScript(const std::string& script) { | 1987 void TestRunner::QueueNonLoadingScript(const std::string& script) { |
| 1988 work_queue_.AddWork(new WorkItemNonLoadingScript(script)); | 1988 work_queue_.AddWork(new WorkItemNonLoadingScript(script)); |
| 1989 } | 1989 } |
| 1990 | 1990 |
| 1991 class WorkItemLoad : public TestRunner::WorkItem { | 1991 class WorkItemLoad : public TestRunner::WorkItem { |
| 1992 public: | 1992 public: |
| 1993 WorkItemLoad(const WebURL& url, const std::string& target) | 1993 WorkItemLoad(const WebURL& url, const std::string& target) |
| 1994 : url_(url), target_(target) {} | 1994 : url_(url), target_(target) {} |
| 1995 | 1995 |
| 1996 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { | 1996 virtual bool Run(WebTestDelegate* delegate, WebView*) OVERRIDE { |
| 1997 delegate->loadURLForFrame(url_, target_); | 1997 delegate->LoadURLForFrame(url_, target_); |
| 1998 return true; // FIXME: Did it really start a navigation? | 1998 return true; // FIXME: Did it really start a navigation? |
| 1999 } | 1999 } |
| 2000 | 2000 |
| 2001 private: | 2001 private: |
| 2002 WebURL url_; | 2002 WebURL url_; |
| 2003 std::string target_; | 2003 std::string target_; |
| 2004 }; | 2004 }; |
| 2005 | 2005 |
| 2006 void TestRunner::QueueLoad(const std::string& url, const std::string& target) { | 2006 void TestRunner::QueueLoad(const std::string& url, const std::string& target) { |
| 2007 // FIXME: Implement WebURL::resolve() and avoid GURL. | 2007 // FIXME: Implement WebURL::resolve() and avoid GURL. |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2268 direction = WebTextDirectionRightToLeft; | 2268 direction = WebTextDirectionRightToLeft; |
| 2269 else if (direction_name == "ltr") | 2269 else if (direction_name == "ltr") |
| 2270 direction = WebTextDirectionLeftToRight; | 2270 direction = WebTextDirectionLeftToRight; |
| 2271 else | 2271 else |
| 2272 return; | 2272 return; |
| 2273 | 2273 |
| 2274 web_view_->setTextDirection(direction); | 2274 web_view_->setTextDirection(direction); |
| 2275 } | 2275 } |
| 2276 | 2276 |
| 2277 void TestRunner::UseUnfortunateSynchronousResizeMode() { | 2277 void TestRunner::UseUnfortunateSynchronousResizeMode() { |
| 2278 delegate_->useUnfortunateSynchronousResizeMode(true); | 2278 delegate_->UseUnfortunateSynchronousResizeMode(true); |
| 2279 } | 2279 } |
| 2280 | 2280 |
| 2281 bool TestRunner::EnableAutoResizeMode(int min_width, | 2281 bool TestRunner::EnableAutoResizeMode(int min_width, |
| 2282 int min_height, | 2282 int min_height, |
| 2283 int max_width, | 2283 int max_width, |
| 2284 int max_height) { | 2284 int max_height) { |
| 2285 WebSize min_size(min_width, min_height); | 2285 WebSize min_size(min_width, min_height); |
| 2286 WebSize max_size(max_width, max_height); | 2286 WebSize max_size(max_width, max_height); |
| 2287 delegate_->enableAutoResizeMode(min_size, max_size); | 2287 delegate_->EnableAutoResizeMode(min_size, max_size); |
| 2288 return true; | 2288 return true; |
| 2289 } | 2289 } |
| 2290 | 2290 |
| 2291 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { | 2291 bool TestRunner::DisableAutoResizeMode(int new_width, int new_height) { |
| 2292 WebSize new_size(new_width, new_height); | 2292 WebSize new_size(new_width, new_height); |
| 2293 delegate_->disableAutoResizeMode(new_size); | 2293 delegate_->DisableAutoResizeMode(new_size); |
| 2294 return true; | 2294 return true; |
| 2295 } | 2295 } |
| 2296 | 2296 |
| 2297 void TestRunner::SetMockDeviceLight(double value) { | 2297 void TestRunner::SetMockDeviceLight(double value) { |
| 2298 delegate_->setDeviceLightData(value); | 2298 delegate_->SetDeviceLightData(value); |
| 2299 } | 2299 } |
| 2300 | 2300 |
| 2301 void TestRunner::ResetDeviceLight() { | 2301 void TestRunner::ResetDeviceLight() { |
| 2302 delegate_->setDeviceLightData(-1); | 2302 delegate_->SetDeviceLightData(-1); |
| 2303 } | 2303 } |
| 2304 | 2304 |
| 2305 void TestRunner::SetMockDeviceMotion( | 2305 void TestRunner::SetMockDeviceMotion( |
| 2306 bool has_acceleration_x, double acceleration_x, | 2306 bool has_acceleration_x, double acceleration_x, |
| 2307 bool has_acceleration_y, double acceleration_y, | 2307 bool has_acceleration_y, double acceleration_y, |
| 2308 bool has_acceleration_z, double acceleration_z, | 2308 bool has_acceleration_z, double acceleration_z, |
| 2309 bool has_acceleration_including_gravity_x, | 2309 bool has_acceleration_including_gravity_x, |
| 2310 double acceleration_including_gravity_x, | 2310 double acceleration_including_gravity_x, |
| 2311 bool has_acceleration_including_gravity_y, | 2311 bool has_acceleration_including_gravity_y, |
| 2312 double acceleration_including_gravity_y, | 2312 double acceleration_including_gravity_y, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2341 motion.hasRotationRateAlpha = has_rotation_rate_alpha; | 2341 motion.hasRotationRateAlpha = has_rotation_rate_alpha; |
| 2342 motion.rotationRateAlpha = rotation_rate_alpha; | 2342 motion.rotationRateAlpha = rotation_rate_alpha; |
| 2343 motion.hasRotationRateBeta = has_rotation_rate_beta; | 2343 motion.hasRotationRateBeta = has_rotation_rate_beta; |
| 2344 motion.rotationRateBeta = rotation_rate_beta; | 2344 motion.rotationRateBeta = rotation_rate_beta; |
| 2345 motion.hasRotationRateGamma = has_rotation_rate_gamma; | 2345 motion.hasRotationRateGamma = has_rotation_rate_gamma; |
| 2346 motion.rotationRateGamma = rotation_rate_gamma; | 2346 motion.rotationRateGamma = rotation_rate_gamma; |
| 2347 | 2347 |
| 2348 // interval | 2348 // interval |
| 2349 motion.interval = interval; | 2349 motion.interval = interval; |
| 2350 | 2350 |
| 2351 delegate_->setDeviceMotionData(motion); | 2351 delegate_->SetDeviceMotionData(motion); |
| 2352 } | 2352 } |
| 2353 | 2353 |
| 2354 void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha, | 2354 void TestRunner::SetMockDeviceOrientation(bool has_alpha, double alpha, |
| 2355 bool has_beta, double beta, | 2355 bool has_beta, double beta, |
| 2356 bool has_gamma, double gamma, | 2356 bool has_gamma, double gamma, |
| 2357 bool has_absolute, bool absolute) { | 2357 bool has_absolute, bool absolute) { |
| 2358 WebDeviceOrientationData orientation; | 2358 WebDeviceOrientationData orientation; |
| 2359 | 2359 |
| 2360 // alpha | 2360 // alpha |
| 2361 orientation.hasAlpha = has_alpha; | 2361 orientation.hasAlpha = has_alpha; |
| 2362 orientation.alpha = alpha; | 2362 orientation.alpha = alpha; |
| 2363 | 2363 |
| 2364 // beta | 2364 // beta |
| 2365 orientation.hasBeta = has_beta; | 2365 orientation.hasBeta = has_beta; |
| 2366 orientation.beta = beta; | 2366 orientation.beta = beta; |
| 2367 | 2367 |
| 2368 // gamma | 2368 // gamma |
| 2369 orientation.hasGamma = has_gamma; | 2369 orientation.hasGamma = has_gamma; |
| 2370 orientation.gamma = gamma; | 2370 orientation.gamma = gamma; |
| 2371 | 2371 |
| 2372 // absolute | 2372 // absolute |
| 2373 orientation.hasAbsolute = has_absolute; | 2373 orientation.hasAbsolute = has_absolute; |
| 2374 orientation.absolute = absolute; | 2374 orientation.absolute = absolute; |
| 2375 | 2375 |
| 2376 delegate_->setDeviceOrientationData(orientation); | 2376 delegate_->SetDeviceOrientationData(orientation); |
| 2377 } | 2377 } |
| 2378 | 2378 |
| 2379 void TestRunner::SetMockScreenOrientation(const std::string& orientation_str) { | 2379 void TestRunner::SetMockScreenOrientation(const std::string& orientation_str) { |
| 2380 blink::WebScreenOrientationType orientation; | 2380 blink::WebScreenOrientationType orientation; |
| 2381 | 2381 |
| 2382 if (orientation_str == "portrait-primary") { | 2382 if (orientation_str == "portrait-primary") { |
| 2383 orientation = WebScreenOrientationPortraitPrimary; | 2383 orientation = WebScreenOrientationPortraitPrimary; |
| 2384 } else if (orientation_str == "portrait-secondary") { | 2384 } else if (orientation_str == "portrait-secondary") { |
| 2385 orientation = WebScreenOrientationPortraitSecondary; | 2385 orientation = WebScreenOrientationPortraitSecondary; |
| 2386 } else if (orientation_str == "landscape-primary") { | 2386 } else if (orientation_str == "landscape-primary") { |
| 2387 orientation = WebScreenOrientationLandscapePrimary; | 2387 orientation = WebScreenOrientationLandscapePrimary; |
| 2388 } else if (orientation_str == "landscape-secondary") { | 2388 } else if (orientation_str == "landscape-secondary") { |
| 2389 orientation = WebScreenOrientationLandscapeSecondary; | 2389 orientation = WebScreenOrientationLandscapeSecondary; |
| 2390 } | 2390 } |
| 2391 | 2391 |
| 2392 delegate_->setScreenOrientation(orientation); | 2392 delegate_->SetScreenOrientation(orientation); |
| 2393 } | 2393 } |
| 2394 | 2394 |
| 2395 void TestRunner::DidChangeBatteryStatus(bool charging, | 2395 void TestRunner::DidChangeBatteryStatus(bool charging, |
| 2396 double chargingTime, | 2396 double chargingTime, |
| 2397 double dischargingTime, | 2397 double dischargingTime, |
| 2398 double level) { | 2398 double level) { |
| 2399 blink::WebBatteryStatus status; | 2399 blink::WebBatteryStatus status; |
| 2400 status.charging = charging; | 2400 status.charging = charging; |
| 2401 status.chargingTime = chargingTime; | 2401 status.chargingTime = chargingTime; |
| 2402 status.dischargingTime = dischargingTime; | 2402 status.dischargingTime = dischargingTime; |
| 2403 status.level = level; | 2403 status.level = level; |
| 2404 delegate_->didChangeBatteryStatus(status); | 2404 delegate_->DidChangeBatteryStatus(status); |
| 2405 } | 2405 } |
| 2406 | 2406 |
| 2407 void TestRunner::ResetBatteryStatus() { | 2407 void TestRunner::ResetBatteryStatus() { |
| 2408 blink::WebBatteryStatus status; | 2408 blink::WebBatteryStatus status; |
| 2409 delegate_->didChangeBatteryStatus(status); | 2409 delegate_->DidChangeBatteryStatus(status); |
| 2410 } | 2410 } |
| 2411 | 2411 |
| 2412 void TestRunner::DidAcquirePointerLock() { | 2412 void TestRunner::DidAcquirePointerLock() { |
| 2413 DidAcquirePointerLockInternal(); | 2413 DidAcquirePointerLockInternal(); |
| 2414 } | 2414 } |
| 2415 | 2415 |
| 2416 void TestRunner::DidNotAcquirePointerLock() { | 2416 void TestRunner::DidNotAcquirePointerLock() { |
| 2417 DidNotAcquirePointerLockInternal(); | 2417 DidNotAcquirePointerLockInternal(); |
| 2418 } | 2418 } |
| 2419 | 2419 |
| 2420 void TestRunner::DidLosePointerLock() { | 2420 void TestRunner::DidLosePointerLock() { |
| 2421 DidLosePointerLockInternal(); | 2421 DidLosePointerLockInternal(); |
| 2422 } | 2422 } |
| 2423 | 2423 |
| 2424 void TestRunner::SetPointerLockWillFailSynchronously() { | 2424 void TestRunner::SetPointerLockWillFailSynchronously() { |
| 2425 pointer_lock_planned_result_ = PointerLockWillFailSync; | 2425 pointer_lock_planned_result_ = PointerLockWillFailSync; |
| 2426 } | 2426 } |
| 2427 | 2427 |
| 2428 void TestRunner::SetPointerLockWillRespondAsynchronously() { | 2428 void TestRunner::SetPointerLockWillRespondAsynchronously() { |
| 2429 pointer_lock_planned_result_ = PointerLockWillRespondAsync; | 2429 pointer_lock_planned_result_ = PointerLockWillRespondAsync; |
| 2430 } | 2430 } |
| 2431 | 2431 |
| 2432 void TestRunner::SetPopupBlockingEnabled(bool block_popups) { | 2432 void TestRunner::SetPopupBlockingEnabled(bool block_popups) { |
| 2433 delegate_->preferences()->java_script_can_open_windows_automatically = | 2433 delegate_->Preferences()->java_script_can_open_windows_automatically = |
| 2434 !block_popups; | 2434 !block_popups; |
| 2435 delegate_->applyPreferences(); | 2435 delegate_->ApplyPreferences(); |
| 2436 } | 2436 } |
| 2437 | 2437 |
| 2438 void TestRunner::SetJavaScriptCanAccessClipboard(bool can_access) { | 2438 void TestRunner::SetJavaScriptCanAccessClipboard(bool can_access) { |
| 2439 delegate_->preferences()->java_script_can_access_clipboard = can_access; | 2439 delegate_->Preferences()->java_script_can_access_clipboard = can_access; |
| 2440 delegate_->applyPreferences(); | 2440 delegate_->ApplyPreferences(); |
| 2441 } | 2441 } |
| 2442 | 2442 |
| 2443 void TestRunner::SetXSSAuditorEnabled(bool enabled) { | 2443 void TestRunner::SetXSSAuditorEnabled(bool enabled) { |
| 2444 delegate_->preferences()->xss_auditor_enabled = enabled; | 2444 delegate_->Preferences()->xss_auditor_enabled = enabled; |
| 2445 delegate_->applyPreferences(); | 2445 delegate_->ApplyPreferences(); |
| 2446 } | 2446 } |
| 2447 | 2447 |
| 2448 void TestRunner::SetAllowUniversalAccessFromFileURLs(bool allow) { | 2448 void TestRunner::SetAllowUniversalAccessFromFileURLs(bool allow) { |
| 2449 delegate_->preferences()->allow_universal_access_from_file_urls = allow; | 2449 delegate_->Preferences()->allow_universal_access_from_file_urls = allow; |
| 2450 delegate_->applyPreferences(); | 2450 delegate_->ApplyPreferences(); |
| 2451 } | 2451 } |
| 2452 | 2452 |
| 2453 void TestRunner::SetAllowFileAccessFromFileURLs(bool allow) { | 2453 void TestRunner::SetAllowFileAccessFromFileURLs(bool allow) { |
| 2454 delegate_->preferences()->allow_file_access_from_file_urls = allow; | 2454 delegate_->Preferences()->allow_file_access_from_file_urls = allow; |
| 2455 delegate_->applyPreferences(); | 2455 delegate_->ApplyPreferences(); |
| 2456 } | 2456 } |
| 2457 | 2457 |
| 2458 void TestRunner::OverridePreference(const std::string key, | 2458 void TestRunner::OverridePreference(const std::string key, |
| 2459 v8::Handle<v8::Value> value) { | 2459 v8::Handle<v8::Value> value) { |
| 2460 TestPreferences* prefs = delegate_->preferences(); | 2460 TestPreferences* prefs = delegate_->Preferences(); |
| 2461 if (key == "WebKitDefaultFontSize") { | 2461 if (key == "WebKitDefaultFontSize") { |
| 2462 prefs->default_font_size = value->Int32Value(); | 2462 prefs->default_font_size = value->Int32Value(); |
| 2463 } else if (key == "WebKitMinimumFontSize") { | 2463 } else if (key == "WebKitMinimumFontSize") { |
| 2464 prefs->minimum_font_size = value->Int32Value(); | 2464 prefs->minimum_font_size = value->Int32Value(); |
| 2465 } else if (key == "WebKitDefaultTextEncodingName") { | 2465 } else if (key == "WebKitDefaultTextEncodingName") { |
| 2466 prefs->default_text_encoding_name = V8StringToWebString(value->ToString()); | 2466 prefs->default_text_encoding_name = V8StringToWebString(value->ToString()); |
| 2467 } else if (key == "WebKitJavaScriptEnabled") { | 2467 } else if (key == "WebKitJavaScriptEnabled") { |
| 2468 prefs->java_script_enabled = value->BooleanValue(); | 2468 prefs->java_script_enabled = value->BooleanValue(); |
| 2469 } else if (key == "WebKitSupportsMultipleWindows") { | 2469 } else if (key == "WebKitSupportsMultipleWindows") { |
| 2470 prefs->supports_multiple_windows = value->BooleanValue(); | 2470 prefs->supports_multiple_windows = value->BooleanValue(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 2492 prefs->allow_display_of_insecure_content = value->BooleanValue(); | 2492 prefs->allow_display_of_insecure_content = value->BooleanValue(); |
| 2493 } else if (key == "WebKitAllowRunningInsecureContent") { | 2493 } else if (key == "WebKitAllowRunningInsecureContent") { |
| 2494 prefs->allow_running_of_insecure_content = value->BooleanValue(); | 2494 prefs->allow_running_of_insecure_content = value->BooleanValue(); |
| 2495 } else if (key == "WebKitShouldRespectImageOrientation") { | 2495 } else if (key == "WebKitShouldRespectImageOrientation") { |
| 2496 prefs->should_respect_image_orientation = value->BooleanValue(); | 2496 prefs->should_respect_image_orientation = value->BooleanValue(); |
| 2497 } else if (key == "WebKitWebAudioEnabled") { | 2497 } else if (key == "WebKitWebAudioEnabled") { |
| 2498 DCHECK(value->BooleanValue()); | 2498 DCHECK(value->BooleanValue()); |
| 2499 } else { | 2499 } else { |
| 2500 std::string message("Invalid name for preference: "); | 2500 std::string message("Invalid name for preference: "); |
| 2501 message.append(key); | 2501 message.append(key); |
| 2502 delegate_->printMessage(std::string("CONSOLE MESSAGE: ") + message + "\n"); | 2502 delegate_->PrintMessage(std::string("CONSOLE MESSAGE: ") + message + "\n"); |
| 2503 } | 2503 } |
| 2504 delegate_->applyPreferences(); | 2504 delegate_->ApplyPreferences(); |
| 2505 } | 2505 } |
| 2506 | 2506 |
| 2507 void TestRunner::SetAcceptLanguages(const std::string& accept_languages) { | 2507 void TestRunner::SetAcceptLanguages(const std::string& accept_languages) { |
| 2508 proxy_->SetAcceptLanguages(accept_languages); | 2508 proxy_->SetAcceptLanguages(accept_languages); |
| 2509 } | 2509 } |
| 2510 | 2510 |
| 2511 void TestRunner::SetPluginsEnabled(bool enabled) { | 2511 void TestRunner::SetPluginsEnabled(bool enabled) { |
| 2512 delegate_->preferences()->plugins_enabled = enabled; | 2512 delegate_->Preferences()->plugins_enabled = enabled; |
| 2513 delegate_->applyPreferences(); | 2513 delegate_->ApplyPreferences(); |
| 2514 } | 2514 } |
| 2515 | 2515 |
| 2516 void TestRunner::DumpEditingCallbacks() { | 2516 void TestRunner::DumpEditingCallbacks() { |
| 2517 dump_editting_callbacks_ = true; | 2517 dump_editting_callbacks_ = true; |
| 2518 } | 2518 } |
| 2519 | 2519 |
| 2520 void TestRunner::DumpAsMarkup() { | 2520 void TestRunner::DumpAsMarkup() { |
| 2521 dump_as_markup_ = true; | 2521 dump_as_markup_ = true; |
| 2522 generate_pixel_results_ = false; | 2522 generate_pixel_results_ = false; |
| 2523 } | 2523 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2663 void TestRunner::DumpResourceRequestPriorities() { | 2663 void TestRunner::DumpResourceRequestPriorities() { |
| 2664 should_dump_resource_priorities_ = true; | 2664 should_dump_resource_priorities_ = true; |
| 2665 } | 2665 } |
| 2666 | 2666 |
| 2667 void TestRunner::SetUseMockTheme(bool use) { | 2667 void TestRunner::SetUseMockTheme(bool use) { |
| 2668 use_mock_theme_ = use; | 2668 use_mock_theme_ = use; |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 void TestRunner::ShowWebInspector(const std::string& str, | 2671 void TestRunner::ShowWebInspector(const std::string& str, |
| 2672 const std::string& frontend_url) { | 2672 const std::string& frontend_url) { |
| 2673 showDevTools(str, frontend_url); | 2673 ShowDevTools(str, frontend_url); |
| 2674 } | 2674 } |
| 2675 | 2675 |
| 2676 void TestRunner::WaitUntilExternalURLLoad() { | 2676 void TestRunner::WaitUntilExternalURLLoad() { |
| 2677 wait_until_external_url_load_ = true; | 2677 wait_until_external_url_load_ = true; |
| 2678 } | 2678 } |
| 2679 | 2679 |
| 2680 void TestRunner::CloseWebInspector() { | 2680 void TestRunner::CloseWebInspector() { |
| 2681 delegate_->closeDevTools(); | 2681 delegate_->CloseDevTools(); |
| 2682 } | 2682 } |
| 2683 | 2683 |
| 2684 bool TestRunner::IsChooserShown() { | 2684 bool TestRunner::IsChooserShown() { |
| 2685 return proxy_->IsChooserShown(); | 2685 return proxy_->IsChooserShown(); |
| 2686 } | 2686 } |
| 2687 | 2687 |
| 2688 void TestRunner::EvaluateInWebInspector(int call_id, | 2688 void TestRunner::EvaluateInWebInspector(int call_id, |
| 2689 const std::string& script) { | 2689 const std::string& script) { |
| 2690 delegate_->evaluateInWebInspector(call_id, script); | 2690 delegate_->EvaluateInWebInspector(call_id, script); |
| 2691 } | 2691 } |
| 2692 | 2692 |
| 2693 void TestRunner::ClearAllDatabases() { | 2693 void TestRunner::ClearAllDatabases() { |
| 2694 delegate_->clearAllDatabases(); | 2694 delegate_->ClearAllDatabases(); |
| 2695 } | 2695 } |
| 2696 | 2696 |
| 2697 void TestRunner::SetDatabaseQuota(int quota) { | 2697 void TestRunner::SetDatabaseQuota(int quota) { |
| 2698 delegate_->setDatabaseQuota(quota); | 2698 delegate_->SetDatabaseQuota(quota); |
| 2699 } | 2699 } |
| 2700 | 2700 |
| 2701 void TestRunner::SetAlwaysAcceptCookies(bool accept) { | 2701 void TestRunner::SetAlwaysAcceptCookies(bool accept) { |
| 2702 delegate_->setAcceptAllCookies(accept); | 2702 delegate_->SetAcceptAllCookies(accept); |
| 2703 } | 2703 } |
| 2704 | 2704 |
| 2705 void TestRunner::SetWindowIsKey(bool value) { | 2705 void TestRunner::SetWindowIsKey(bool value) { |
| 2706 delegate_->setFocus(proxy_, value); | 2706 delegate_->SetFocus(proxy_, value); |
| 2707 } | 2707 } |
| 2708 | 2708 |
| 2709 std::string TestRunner::PathToLocalResource(const std::string& path) { | 2709 std::string TestRunner::PathToLocalResource(const std::string& path) { |
| 2710 return delegate_->pathToLocalResource(path); | 2710 return delegate_->PathToLocalResource(path); |
| 2711 } | 2711 } |
| 2712 | 2712 |
| 2713 void TestRunner::SetBackingScaleFactor(double value, | 2713 void TestRunner::SetBackingScaleFactor(double value, |
| 2714 v8::Handle<v8::Function> callback) { | 2714 v8::Handle<v8::Function> callback) { |
| 2715 delegate_->setDeviceScaleFactor(value); | 2715 delegate_->SetDeviceScaleFactor(value); |
| 2716 delegate_->postTask(new InvokeCallbackTask(this, callback)); | 2716 delegate_->PostTask(new InvokeCallbackTask(this, callback)); |
| 2717 } | 2717 } |
| 2718 | 2718 |
| 2719 void TestRunner::SetColorProfile(const std::string& name, | 2719 void TestRunner::SetColorProfile(const std::string& name, |
| 2720 v8::Handle<v8::Function> callback) { | 2720 v8::Handle<v8::Function> callback) { |
| 2721 delegate_->setDeviceColorProfile(name); | 2721 delegate_->SetDeviceColorProfile(name); |
| 2722 delegate_->postTask(new InvokeCallbackTask(this, callback)); | 2722 delegate_->PostTask(new InvokeCallbackTask(this, callback)); |
| 2723 } | 2723 } |
| 2724 | 2724 |
| 2725 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2725 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
| 2726 delegate_->setLocale(locale); | 2726 delegate_->SetLocale(locale); |
| 2727 } | 2727 } |
| 2728 | 2728 |
| 2729 void TestRunner::SetMIDIAccessorResult(bool result) { | 2729 void TestRunner::SetMIDIAccessorResult(bool result) { |
| 2730 midi_accessor_result_ = result; | 2730 midi_accessor_result_ = result; |
| 2731 } | 2731 } |
| 2732 | 2732 |
| 2733 void TestRunner::SetMIDISysexPermission(bool value) { | 2733 void TestRunner::SetMIDISysexPermission(bool value) { |
| 2734 const std::vector<WebTestProxyBase*>& windowList = | 2734 const std::vector<WebTestProxyBase*>& windowList = |
| 2735 test_interfaces_->GetWindowList(); | 2735 test_interfaces_->GetWindowList(); |
| 2736 for (unsigned i = 0; i < windowList.size(); ++i) | 2736 for (unsigned i = 0; i < windowList.size(); ++i) |
| 2737 windowList.at(i)->GetMIDIClientMock()->setSysexPermission(value); | 2737 windowList.at(i)->GetMIDIClientMock()->setSysexPermission(value); |
| 2738 } | 2738 } |
| 2739 | 2739 |
| 2740 void TestRunner::GrantWebNotificationPermission(const GURL& origin, | 2740 void TestRunner::GrantWebNotificationPermission(const GURL& origin, |
| 2741 bool permission_granted) { | 2741 bool permission_granted) { |
| 2742 delegate_->grantWebNotificationPermission(origin, permission_granted); | 2742 delegate_->GrantWebNotificationPermission(origin, permission_granted); |
| 2743 } | 2743 } |
| 2744 | 2744 |
| 2745 void TestRunner::ClearWebNotificationPermissions() { | 2745 void TestRunner::ClearWebNotificationPermissions() { |
| 2746 delegate_->clearWebNotificationPermissions(); | 2746 delegate_->ClearWebNotificationPermissions(); |
| 2747 } | 2747 } |
| 2748 | 2748 |
| 2749 bool TestRunner::SimulateWebNotificationClick(const std::string& value) { | 2749 bool TestRunner::SimulateWebNotificationClick(const std::string& value) { |
| 2750 return notification_presenter_->SimulateClick(value); | 2750 return notification_presenter_->SimulateClick(value); |
| 2751 } | 2751 } |
| 2752 | 2752 |
| 2753 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, | 2753 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, |
| 2754 double confidence) { | 2754 double confidence) { |
| 2755 proxy_->GetSpeechRecognizerMock()->AddMockResult( | 2755 proxy_->GetSpeechRecognizerMock()->AddMockResult( |
| 2756 WebString::fromUTF8(transcript), confidence); | 2756 WebString::fromUTF8(transcript), confidence); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2869 void TestRunner::SetMockPushClientSuccess(const std::string& endpoint, | 2869 void TestRunner::SetMockPushClientSuccess(const std::string& endpoint, |
| 2870 const std::string& registration_id) { | 2870 const std::string& registration_id) { |
| 2871 proxy_->GetPushClientMock()->SetMockSuccessValues(endpoint, registration_id); | 2871 proxy_->GetPushClientMock()->SetMockSuccessValues(endpoint, registration_id); |
| 2872 } | 2872 } |
| 2873 | 2873 |
| 2874 void TestRunner::SetMockPushClientError(const std::string& message) { | 2874 void TestRunner::SetMockPushClientError(const std::string& message) { |
| 2875 proxy_->GetPushClientMock()->SetMockErrorValues(message); | 2875 proxy_->GetPushClientMock()->SetMockErrorValues(message); |
| 2876 } | 2876 } |
| 2877 | 2877 |
| 2878 void TestRunner::LocationChangeDone() { | 2878 void TestRunner::LocationChangeDone() { |
| 2879 web_history_item_count_ = delegate_->navigationEntryCount(); | 2879 web_history_item_count_ = delegate_->NavigationEntryCount(); |
| 2880 | 2880 |
| 2881 // No more new work after the first complete load. | 2881 // No more new work after the first complete load. |
| 2882 work_queue_.set_frozen(true); | 2882 work_queue_.set_frozen(true); |
| 2883 | 2883 |
| 2884 if (!wait_until_done_) | 2884 if (!wait_until_done_) |
| 2885 work_queue_.ProcessWorkSoon(); | 2885 work_queue_.ProcessWorkSoon(); |
| 2886 } | 2886 } |
| 2887 | 2887 |
| 2888 void TestRunner::CheckResponseMimeType() { | 2888 void TestRunner::CheckResponseMimeType() { |
| 2889 // Text output: the test page can request different types of output which we | 2889 // Text output: the test page can request different types of output which we |
| 2890 // handle here. | 2890 // handle here. |
| 2891 if (!dump_as_text_) { | 2891 if (!dump_as_text_) { |
| 2892 std::string mimeType = | 2892 std::string mimeType = |
| 2893 web_view_->mainFrame()->dataSource()->response().mimeType().utf8(); | 2893 web_view_->mainFrame()->dataSource()->response().mimeType().utf8(); |
| 2894 if (mimeType == "text/plain") { | 2894 if (mimeType == "text/plain") { |
| 2895 dump_as_text_ = true; | 2895 dump_as_text_ = true; |
| 2896 generate_pixel_results_ = false; | 2896 generate_pixel_results_ = false; |
| 2897 } | 2897 } |
| 2898 } | 2898 } |
| 2899 } | 2899 } |
| 2900 | 2900 |
| 2901 void TestRunner::CompleteNotifyDone() { | 2901 void TestRunner::CompleteNotifyDone() { |
| 2902 if (wait_until_done_ && !topLoadingFrame() && work_queue_.is_empty()) | 2902 if (wait_until_done_ && !topLoadingFrame() && work_queue_.is_empty()) |
| 2903 delegate_->testFinished(); | 2903 delegate_->TestFinished(); |
| 2904 wait_until_done_ = false; | 2904 wait_until_done_ = false; |
| 2905 } | 2905 } |
| 2906 | 2906 |
| 2907 void TestRunner::DidAcquirePointerLockInternal() { | 2907 void TestRunner::DidAcquirePointerLockInternal() { |
| 2908 pointer_locked_ = true; | 2908 pointer_locked_ = true; |
| 2909 web_view_->didAcquirePointerLock(); | 2909 web_view_->didAcquirePointerLock(); |
| 2910 | 2910 |
| 2911 // Reset planned result to default. | 2911 // Reset planned result to default. |
| 2912 pointer_lock_planned_result_ = PointerLockWillSucceed; | 2912 pointer_lock_planned_result_ = PointerLockWillSucceed; |
| 2913 } | 2913 } |
| 2914 | 2914 |
| 2915 void TestRunner::DidNotAcquirePointerLockInternal() { | 2915 void TestRunner::DidNotAcquirePointerLockInternal() { |
| 2916 DCHECK(!pointer_locked_); | 2916 DCHECK(!pointer_locked_); |
| 2917 pointer_locked_ = false; | 2917 pointer_locked_ = false; |
| 2918 web_view_->didNotAcquirePointerLock(); | 2918 web_view_->didNotAcquirePointerLock(); |
| 2919 | 2919 |
| 2920 // Reset planned result to default. | 2920 // Reset planned result to default. |
| 2921 pointer_lock_planned_result_ = PointerLockWillSucceed; | 2921 pointer_lock_planned_result_ = PointerLockWillSucceed; |
| 2922 } | 2922 } |
| 2923 | 2923 |
| 2924 void TestRunner::DidLosePointerLockInternal() { | 2924 void TestRunner::DidLosePointerLockInternal() { |
| 2925 bool was_locked = pointer_locked_; | 2925 bool was_locked = pointer_locked_; |
| 2926 pointer_locked_ = false; | 2926 pointer_locked_ = false; |
| 2927 if (was_locked) | 2927 if (was_locked) |
| 2928 web_view_->didLosePointerLock(); | 2928 web_view_->didLosePointerLock(); |
| 2929 } | 2929 } |
| 2930 | 2930 |
| 2931 } // namespace content | 2931 } // namespace content |
| OLD | NEW |