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