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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 void SetTextDirection(const std::string& direction_name); | 247 void SetTextDirection(const std::string& direction_name); |
248 void SetTextSubpixelPositioning(bool value); | 248 void SetTextSubpixelPositioning(bool value); |
249 void SetUseMockTheme(bool use); | 249 void SetUseMockTheme(bool use); |
250 void SetViewSourceForFrame(const std::string& name, bool enabled); | 250 void SetViewSourceForFrame(const std::string& name, bool enabled); |
251 void SetWillSendRequestClearHeader(const std::string& header); | 251 void SetWillSendRequestClearHeader(const std::string& header); |
252 void SetWindowIsKey(bool value); | 252 void SetWindowIsKey(bool value); |
253 void SetXSSAuditorEnabled(bool enabled); | 253 void SetXSSAuditorEnabled(bool enabled); |
254 void ShowWebInspector(gin::Arguments* args); | 254 void ShowWebInspector(gin::Arguments* args); |
255 void SimulateWebNotificationClick(const std::string& title, int action_index); | 255 void SimulateWebNotificationClick(const std::string& title, int action_index); |
256 void SimulateWebNotificationClose(const std::string& title, bool by_user); | 256 void SimulateWebNotificationClose(const std::string& title, bool by_user); |
| 257 void StripLineNumbersFromConsoleMessages(); |
257 void UseUnfortunateSynchronousResizeMode(); | 258 void UseUnfortunateSynchronousResizeMode(); |
258 void WaitForPolicyDelegate(); | 259 void WaitForPolicyDelegate(); |
259 void WaitUntilDone(); | 260 void WaitUntilDone(); |
260 void WaitUntilExternalURLLoad(); | 261 void WaitUntilExternalURLLoad(); |
261 void AddMockCredentialManagerError(const std::string& error); | 262 void AddMockCredentialManagerError(const std::string& error); |
262 void AddMockCredentialManagerResponse(const std::string& id, | 263 void AddMockCredentialManagerResponse(const std::string& id, |
263 const std::string& name, | 264 const std::string& name, |
264 const std::string& avatar, | 265 const std::string& avatar, |
265 const std::string& password); | 266 const std::string& password); |
266 bool AnimationScheduled(); | 267 bool AnimationScheduled(); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 .SetMethod("setUseDashboardCompatibilityMode", | 565 .SetMethod("setUseDashboardCompatibilityMode", |
565 &TestRunnerBindings::NotImplemented) | 566 &TestRunnerBindings::NotImplemented) |
566 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) | 567 .SetMethod("setUseMockTheme", &TestRunnerBindings::SetUseMockTheme) |
567 .SetMethod("setViewSourceForFrame", | 568 .SetMethod("setViewSourceForFrame", |
568 &TestRunnerBindings::SetViewSourceForFrame) | 569 &TestRunnerBindings::SetViewSourceForFrame) |
569 .SetMethod("setWillSendRequestClearHeader", | 570 .SetMethod("setWillSendRequestClearHeader", |
570 &TestRunnerBindings::SetWillSendRequestClearHeader) | 571 &TestRunnerBindings::SetWillSendRequestClearHeader) |
571 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) | 572 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) |
572 .SetMethod("setXSSAuditorEnabled", | 573 .SetMethod("setXSSAuditorEnabled", |
573 &TestRunnerBindings::SetXSSAuditorEnabled) | 574 &TestRunnerBindings::SetXSSAuditorEnabled) |
| 575 .SetMethod("stripLineNumbersFromConsoleMessages", |
| 576 &TestRunnerBindings::StripLineNumbersFromConsoleMessages) |
574 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector) | 577 .SetMethod("showWebInspector", &TestRunnerBindings::ShowWebInspector) |
575 .SetMethod("simulateWebNotificationClick", | 578 .SetMethod("simulateWebNotificationClick", |
576 &TestRunnerBindings::SimulateWebNotificationClick) | 579 &TestRunnerBindings::SimulateWebNotificationClick) |
577 .SetMethod("simulateWebNotificationClose", | 580 .SetMethod("simulateWebNotificationClose", |
578 &TestRunnerBindings::SimulateWebNotificationClose) | 581 &TestRunnerBindings::SimulateWebNotificationClose) |
579 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) | 582 .SetProperty("tooltipText", &TestRunnerBindings::TooltipText) |
580 .SetMethod("useUnfortunateSynchronousResizeMode", | 583 .SetMethod("useUnfortunateSynchronousResizeMode", |
581 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) | 584 &TestRunnerBindings::UseUnfortunateSynchronousResizeMode) |
582 .SetMethod("waitForPolicyDelegate", | 585 .SetMethod("waitForPolicyDelegate", |
583 &TestRunnerBindings::WaitForPolicyDelegate) | 586 &TestRunnerBindings::WaitForPolicyDelegate) |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1192 void TestRunnerBindings::DumpResourceRequestPriorities() { | 1195 void TestRunnerBindings::DumpResourceRequestPriorities() { |
1193 if (runner_) | 1196 if (runner_) |
1194 runner_->DumpResourceRequestPriorities(); | 1197 runner_->DumpResourceRequestPriorities(); |
1195 } | 1198 } |
1196 | 1199 |
1197 void TestRunnerBindings::SetUseMockTheme(bool use) { | 1200 void TestRunnerBindings::SetUseMockTheme(bool use) { |
1198 if (runner_) | 1201 if (runner_) |
1199 runner_->SetUseMockTheme(use); | 1202 runner_->SetUseMockTheme(use); |
1200 } | 1203 } |
1201 | 1204 |
| 1205 void TestRunnerBindings::StripLineNumbersFromConsoleMessages() { |
| 1206 if (runner_) |
| 1207 runner_->StripLineNumbersFromConsoleMessages(); |
| 1208 } |
| 1209 |
1202 void TestRunnerBindings::WaitUntilExternalURLLoad() { | 1210 void TestRunnerBindings::WaitUntilExternalURLLoad() { |
1203 if (runner_) | 1211 if (runner_) |
1204 runner_->WaitUntilExternalURLLoad(); | 1212 runner_->WaitUntilExternalURLLoad(); |
1205 } | 1213 } |
1206 | 1214 |
1207 void TestRunnerBindings::DumpDragImage() { | 1215 void TestRunnerBindings::DumpDragImage() { |
1208 if (runner_) | 1216 if (runner_) |
1209 runner_->DumpDragImage(); | 1217 runner_->DumpDragImage(); |
1210 } | 1218 } |
1211 | 1219 |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1821 } | 1829 } |
1822 | 1830 |
1823 bool TestRunner::isPrinting() const { | 1831 bool TestRunner::isPrinting() const { |
1824 return layout_test_runtime_flags_.is_printing(); | 1832 return layout_test_runtime_flags_.is_printing(); |
1825 } | 1833 } |
1826 | 1834 |
1827 bool TestRunner::shouldWaitUntilExternalURLLoad() const { | 1835 bool TestRunner::shouldWaitUntilExternalURLLoad() const { |
1828 return layout_test_runtime_flags_.wait_until_external_url_load(); | 1836 return layout_test_runtime_flags_.wait_until_external_url_load(); |
1829 } | 1837 } |
1830 | 1838 |
| 1839 bool TestRunner::shouldDumpConsoleLineNumbers() const { |
| 1840 return layout_test_runtime_flags_.include_line_numbers_in_console_messages(); |
| 1841 } |
| 1842 |
1831 const std::set<std::string>* TestRunner::httpHeadersToClear() const { | 1843 const std::set<std::string>* TestRunner::httpHeadersToClear() const { |
1832 return &http_headers_to_clear_; | 1844 return &http_headers_to_clear_; |
1833 } | 1845 } |
1834 | 1846 |
1835 bool TestRunner::IsFramePartOfMainTestWindow(blink::WebFrame* frame) const { | 1847 bool TestRunner::IsFramePartOfMainTestWindow(blink::WebFrame* frame) const { |
1836 return test_is_running_ && frame->top()->view() == main_view_; | 1848 return test_is_running_ && frame->top()->view() == main_view_; |
1837 } | 1849 } |
1838 | 1850 |
1839 bool TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { | 1851 bool TestRunner::tryToSetTopLoadingFrame(WebFrame* frame) { |
1840 if (!IsFramePartOfMainTestWindow(frame)) | 1852 if (!IsFramePartOfMainTestWindow(frame)) |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2555 void TestRunner::ShowWebInspector(const std::string& str, | 2567 void TestRunner::ShowWebInspector(const std::string& str, |
2556 const std::string& frontend_url) { | 2568 const std::string& frontend_url) { |
2557 ShowDevTools(str, frontend_url); | 2569 ShowDevTools(str, frontend_url); |
2558 } | 2570 } |
2559 | 2571 |
2560 void TestRunner::WaitUntilExternalURLLoad() { | 2572 void TestRunner::WaitUntilExternalURLLoad() { |
2561 layout_test_runtime_flags_.set_wait_until_external_url_load(true); | 2573 layout_test_runtime_flags_.set_wait_until_external_url_load(true); |
2562 OnLayoutTestRuntimeFlagsChanged(); | 2574 OnLayoutTestRuntimeFlagsChanged(); |
2563 } | 2575 } |
2564 | 2576 |
| 2577 void TestRunner::StripLineNumbersFromConsoleMessages() { |
| 2578 layout_test_runtime_flags_.set_include_line_numbers_in_console_messages( |
| 2579 false); |
| 2580 OnLayoutTestRuntimeFlagsChanged(); |
| 2581 } |
| 2582 |
2565 void TestRunner::DumpDragImage() { | 2583 void TestRunner::DumpDragImage() { |
2566 layout_test_runtime_flags_.set_dump_drag_image(true); | 2584 layout_test_runtime_flags_.set_dump_drag_image(true); |
2567 DumpAsTextWithPixelResults(); | 2585 DumpAsTextWithPixelResults(); |
2568 OnLayoutTestRuntimeFlagsChanged(); | 2586 OnLayoutTestRuntimeFlagsChanged(); |
2569 } | 2587 } |
2570 | 2588 |
2571 void TestRunner::DumpNavigationPolicy() { | 2589 void TestRunner::DumpNavigationPolicy() { |
2572 layout_test_runtime_flags_.set_dump_navigation_policy(true); | 2590 layout_test_runtime_flags_.set_dump_navigation_policy(true); |
2573 OnLayoutTestRuntimeFlagsChanged(); | 2591 OnLayoutTestRuntimeFlagsChanged(); |
2574 } | 2592 } |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 | 2753 |
2736 void TestRunner::NotifyDone() { | 2754 void TestRunner::NotifyDone() { |
2737 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2755 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2738 work_queue_.is_empty()) | 2756 work_queue_.is_empty()) |
2739 delegate_->TestFinished(); | 2757 delegate_->TestFinished(); |
2740 layout_test_runtime_flags_.set_wait_until_done(false); | 2758 layout_test_runtime_flags_.set_wait_until_done(false); |
2741 OnLayoutTestRuntimeFlagsChanged(); | 2759 OnLayoutTestRuntimeFlagsChanged(); |
2742 } | 2760 } |
2743 | 2761 |
2744 } // namespace test_runner | 2762 } // namespace test_runner |
OLD | NEW |