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/public/test/layouttest_support.h" | 10 #include "content/public/test/layouttest_support.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 void DumpSpellCheckCallbacks(); | 248 void DumpSpellCheckCallbacks(); |
249 void DumpBackForwardList(); | 249 void DumpBackForwardList(); |
250 void DumpSelectionRect(); | 250 void DumpSelectionRect(); |
251 void SetPrinting(); | 251 void SetPrinting(); |
252 void ClearPrinting(); | 252 void ClearPrinting(); |
253 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); | 253 void SetShouldStayOnPageAfterHandlingBeforeUnload(bool value); |
254 void SetWillSendRequestClearHeader(const std::string& header); | 254 void SetWillSendRequestClearHeader(const std::string& header); |
255 void DumpResourceRequestPriorities(); | 255 void DumpResourceRequestPriorities(); |
256 void SetUseMockTheme(bool use); | 256 void SetUseMockTheme(bool use); |
257 void WaitUntilExternalURLLoad(); | 257 void WaitUntilExternalURLLoad(); |
| 258 void DumpDragImage(); |
258 void ShowWebInspector(gin::Arguments* args); | 259 void ShowWebInspector(gin::Arguments* args); |
259 void CloseWebInspector(); | 260 void CloseWebInspector(); |
260 bool IsChooserShown(); | 261 bool IsChooserShown(); |
261 void EvaluateInWebInspector(int call_id, const std::string& script); | 262 void EvaluateInWebInspector(int call_id, const std::string& script); |
262 void ClearAllDatabases(); | 263 void ClearAllDatabases(); |
263 void SetDatabaseQuota(int quota); | 264 void SetDatabaseQuota(int quota); |
264 void SetAlwaysAcceptCookies(bool accept); | 265 void SetAlwaysAcceptCookies(bool accept); |
265 void SetWindowIsKey(bool value); | 266 void SetWindowIsKey(bool value); |
266 std::string PathToLocalResource(const std::string& path); | 267 std::string PathToLocalResource(const std::string& path); |
267 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); | 268 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 .SetMethod( | 487 .SetMethod( |
487 "setShouldStayOnPageAfterHandlingBeforeUnload", | 488 "setShouldStayOnPageAfterHandlingBeforeUnload", |
488 &TestRunnerBindings::SetShouldStayOnPageAfterHandlingBeforeUnload) | 489 &TestRunnerBindings::SetShouldStayOnPageAfterHandlingBeforeUnload) |
489 .SetMethod("setWillSendRequestClearHeader", | 490 .SetMethod("setWillSendRequestClearHeader", |
490 &TestRunnerBindings::SetWillSendRequestClearHeader) | 491 &TestRunnerBindings::SetWillSendRequestClearHeader) |
491 .SetMethod("dumpResourceRequestPriorities", | 492 .SetMethod("dumpResourceRequestPriorities", |
492 &TestRunnerBindings::DumpResourceRequestPriorities) | 493 &TestRunnerBindings::DumpResourceRequestPriorities) |
493 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) | 494 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) |
494 .SetMethod("waitUntilExternalURLLoad", | 495 .SetMethod("waitUntilExternalURLLoad", |
495 &TestRunnerBindings::WaitUntilExternalURLLoad) | 496 &TestRunnerBindings::WaitUntilExternalURLLoad) |
| 497 .SetMethod("dumpDragImage", &TestRunnerBindings::DumpDragImage) |
496 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector) | 498 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector) |
497 .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) | 499 .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) |
498 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) | 500 .SetMethod("isChooserShown", &TestRunnerBindings::IsChooserShown) |
499 .SetMethod("evaluateInWebInspector", | 501 .SetMethod("evaluateInWebInspector", |
500 &TestRunnerBindings::EvaluateInWebInspector) | 502 &TestRunnerBindings::EvaluateInWebInspector) |
501 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) | 503 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) |
502 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) | 504 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) |
503 .SetMethod("setAlwaysAcceptCookies", | 505 .SetMethod("setAlwaysAcceptCookies", |
504 &TestRunnerBindings::SetAlwaysAcceptCookies) | 506 &TestRunnerBindings::SetAlwaysAcceptCookies) |
505 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) | 507 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 void TestRunnerBindings::SetUseMockTheme(bool use) { | 1220 void TestRunnerBindings::SetUseMockTheme(bool use) { |
1219 if (runner_) | 1221 if (runner_) |
1220 runner_->SetUseMockTheme(use); | 1222 runner_->SetUseMockTheme(use); |
1221 } | 1223 } |
1222 | 1224 |
1223 void TestRunnerBindings::WaitUntilExternalURLLoad() { | 1225 void TestRunnerBindings::WaitUntilExternalURLLoad() { |
1224 if (runner_) | 1226 if (runner_) |
1225 runner_->WaitUntilExternalURLLoad(); | 1227 runner_->WaitUntilExternalURLLoad(); |
1226 } | 1228 } |
1227 | 1229 |
| 1230 void TestRunnerBindings::DumpDragImage() { |
| 1231 if (runner_) |
| 1232 runner_->DumpDragImage(); |
| 1233 } |
| 1234 |
1228 void TestRunnerBindings::ShowWebInspector(gin::Arguments* args) { | 1235 void TestRunnerBindings::ShowWebInspector(gin::Arguments* args) { |
1229 if (runner_) { | 1236 if (runner_) { |
1230 std::string settings; | 1237 std::string settings; |
1231 args->GetNext(&settings); | 1238 args->GetNext(&settings); |
1232 std::string frontend_url; | 1239 std::string frontend_url; |
1233 args->GetNext(&frontend_url); | 1240 args->GetNext(&frontend_url); |
1234 runner_->ShowWebInspector(settings, frontend_url); | 1241 runner_->ShowWebInspector(settings, frontend_url); |
1235 } | 1242 } |
1236 } | 1243 } |
1237 | 1244 |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 dump_create_view_ = false; | 1659 dump_create_view_ = false; |
1653 can_open_windows_ = false; | 1660 can_open_windows_ = false; |
1654 dump_resource_load_callbacks_ = false; | 1661 dump_resource_load_callbacks_ = false; |
1655 dump_resource_request_callbacks_ = false; | 1662 dump_resource_request_callbacks_ = false; |
1656 dump_resource_reqponse_mime_types_ = false; | 1663 dump_resource_reqponse_mime_types_ = false; |
1657 dump_window_status_changes_ = false; | 1664 dump_window_status_changes_ = false; |
1658 dump_progress_finished_callback_ = false; | 1665 dump_progress_finished_callback_ = false; |
1659 dump_spell_check_callbacks_ = false; | 1666 dump_spell_check_callbacks_ = false; |
1660 dump_back_forward_list_ = false; | 1667 dump_back_forward_list_ = false; |
1661 dump_selection_rect_ = false; | 1668 dump_selection_rect_ = false; |
| 1669 dump_drag_image_ = false; |
1662 test_repaint_ = false; | 1670 test_repaint_ = false; |
1663 sweep_horizontally_ = false; | 1671 sweep_horizontally_ = false; |
1664 is_printing_ = false; | 1672 is_printing_ = false; |
1665 midi_accessor_result_ = true; | 1673 midi_accessor_result_ = true; |
1666 should_stay_on_page_after_handling_before_unload_ = false; | 1674 should_stay_on_page_after_handling_before_unload_ = false; |
1667 should_dump_resource_priorities_ = false; | 1675 should_dump_resource_priorities_ = false; |
1668 has_custom_text_output_ = false; | 1676 has_custom_text_output_ = false; |
1669 custom_text_output_.clear(); | 1677 custom_text_output_.clear(); |
1670 | 1678 |
1671 http_headers_to_clear_.clear(); | 1679 http_headers_to_clear_.clear(); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1922 } | 1930 } |
1923 | 1931 |
1924 bool TestRunner::isPointerLocked() { | 1932 bool TestRunner::isPointerLocked() { |
1925 return pointer_locked_; | 1933 return pointer_locked_; |
1926 } | 1934 } |
1927 | 1935 |
1928 void TestRunner::setToolTipText(const WebString& text) { | 1936 void TestRunner::setToolTipText(const WebString& text) { |
1929 tooltip_text_ = text.utf8(); | 1937 tooltip_text_ = text.utf8(); |
1930 } | 1938 } |
1931 | 1939 |
| 1940 bool TestRunner::shouldDumpDragImage() { |
| 1941 return dump_drag_image_; |
| 1942 } |
| 1943 |
1932 bool TestRunner::midiAccessorResult() { | 1944 bool TestRunner::midiAccessorResult() { |
1933 return midi_accessor_result_; | 1945 return midi_accessor_result_; |
1934 } | 1946 } |
1935 | 1947 |
1936 void TestRunner::ClearDevToolsLocalStorage() { | 1948 void TestRunner::ClearDevToolsLocalStorage() { |
1937 delegate_->ClearDevToolsLocalStorage(); | 1949 delegate_->ClearDevToolsLocalStorage(); |
1938 } | 1950 } |
1939 | 1951 |
1940 void TestRunner::ShowDevTools(const std::string& settings, | 1952 void TestRunner::ShowDevTools(const std::string& settings, |
1941 const std::string& frontend_url) { | 1953 const std::string& frontend_url) { |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2718 | 2730 |
2719 void TestRunner::ShowWebInspector(const std::string& str, | 2731 void TestRunner::ShowWebInspector(const std::string& str, |
2720 const std::string& frontend_url) { | 2732 const std::string& frontend_url) { |
2721 ShowDevTools(str, frontend_url); | 2733 ShowDevTools(str, frontend_url); |
2722 } | 2734 } |
2723 | 2735 |
2724 void TestRunner::WaitUntilExternalURLLoad() { | 2736 void TestRunner::WaitUntilExternalURLLoad() { |
2725 wait_until_external_url_load_ = true; | 2737 wait_until_external_url_load_ = true; |
2726 } | 2738 } |
2727 | 2739 |
| 2740 void TestRunner::DumpDragImage() { |
| 2741 DumpAsTextWithPixelResults(); |
| 2742 dump_drag_image_ = true; |
| 2743 } |
| 2744 |
2728 void TestRunner::CloseWebInspector() { | 2745 void TestRunner::CloseWebInspector() { |
2729 delegate_->CloseDevTools(); | 2746 delegate_->CloseDevTools(); |
2730 } | 2747 } |
2731 | 2748 |
2732 bool TestRunner::IsChooserShown() { | 2749 bool TestRunner::IsChooserShown() { |
2733 return proxy_->IsChooserShown(); | 2750 return proxy_->IsChooserShown(); |
2734 } | 2751 } |
2735 | 2752 |
2736 void TestRunner::EvaluateInWebInspector(int call_id, | 2753 void TestRunner::EvaluateInWebInspector(int call_id, |
2737 const std::string& script) { | 2754 const std::string& script) { |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3004 } | 3021 } |
3005 | 3022 |
3006 void TestRunner::DidLosePointerLockInternal() { | 3023 void TestRunner::DidLosePointerLockInternal() { |
3007 bool was_locked = pointer_locked_; | 3024 bool was_locked = pointer_locked_; |
3008 pointer_locked_ = false; | 3025 pointer_locked_ = false; |
3009 if (was_locked) | 3026 if (was_locked) |
3010 web_view_->didLosePointerLock(); | 3027 web_view_->didLosePointerLock(); |
3011 } | 3028 } |
3012 | 3029 |
3013 } // namespace content | 3030 } // namespace content |
OLD | NEW |