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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 void SetColorProfile(const std::string& name, | 204 void SetColorProfile(const std::string& name, |
205 v8::Local<v8::Function> callback); | 205 v8::Local<v8::Function> callback); |
206 void SetCustomPolicyDelegate(gin::Arguments* args); | 206 void SetCustomPolicyDelegate(gin::Arguments* args); |
207 void SetCustomTextOutput(const std::string& output); | 207 void SetCustomTextOutput(const std::string& output); |
208 void SetDatabaseQuota(int quota); | 208 void SetDatabaseQuota(int quota); |
209 void SetDisallowedSubresourcePathSuffixes( | 209 void SetDisallowedSubresourcePathSuffixes( |
210 const std::vector<std::string>& suffixes); | 210 const std::vector<std::string>& suffixes); |
211 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, | 211 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, |
212 const std::string& scheme); | 212 const std::string& scheme); |
213 void SetDumpConsoleMessages(bool value); | 213 void SetDumpConsoleMessages(bool value); |
| 214 void SetDumpJavaScriptDialogs(bool value); |
214 void SetEffectiveConnectionType(const std::string& connection_type); | 215 void SetEffectiveConnectionType(const std::string& connection_type); |
215 void SetMockSpellCheckerEnabled(bool enabled); | 216 void SetMockSpellCheckerEnabled(bool enabled); |
216 void SetImagesAllowed(bool allowed); | 217 void SetImagesAllowed(bool allowed); |
217 void SetIsolatedWorldContentSecurityPolicy(int world_id, | 218 void SetIsolatedWorldContentSecurityPolicy(int world_id, |
218 const std::string& policy); | 219 const std::string& policy); |
219 void SetIsolatedWorldSecurityOrigin(int world_id, | 220 void SetIsolatedWorldSecurityOrigin(int world_id, |
220 v8::Local<v8::Value> origin); | 221 v8::Local<v8::Value> origin); |
221 void SetJavaScriptCanAccessClipboard(bool can_access); | 222 void SetJavaScriptCanAccessClipboard(bool can_access); |
222 void SetMIDIAccessorResult(bool result); | 223 void SetMIDIAccessorResult(bool result); |
223 void SetMockDeviceLight(double value); | 224 void SetMockDeviceLight(double value); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) | 511 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) |
511 .SetMethod("setCustomPolicyDelegate", | 512 .SetMethod("setCustomPolicyDelegate", |
512 &TestRunnerBindings::SetCustomPolicyDelegate) | 513 &TestRunnerBindings::SetCustomPolicyDelegate) |
513 .SetMethod("setCustomTextOutput", | 514 .SetMethod("setCustomTextOutput", |
514 &TestRunnerBindings::SetCustomTextOutput) | 515 &TestRunnerBindings::SetCustomTextOutput) |
515 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) | 516 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) |
516 .SetMethod("setDomainRelaxationForbiddenForURLScheme", | 517 .SetMethod("setDomainRelaxationForbiddenForURLScheme", |
517 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) | 518 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) |
518 .SetMethod("setDumpConsoleMessages", | 519 .SetMethod("setDumpConsoleMessages", |
519 &TestRunnerBindings::SetDumpConsoleMessages) | 520 &TestRunnerBindings::SetDumpConsoleMessages) |
| 521 .SetMethod("setDumpJavaScriptDialogs", |
| 522 &TestRunnerBindings::SetDumpJavaScriptDialogs) |
520 .SetMethod("setEffectiveConnectionType", | 523 .SetMethod("setEffectiveConnectionType", |
521 &TestRunnerBindings::SetEffectiveConnectionType) | 524 &TestRunnerBindings::SetEffectiveConnectionType) |
522 .SetMethod("setMockSpellCheckerEnabled", | 525 .SetMethod("setMockSpellCheckerEnabled", |
523 &TestRunnerBindings::SetMockSpellCheckerEnabled) | 526 &TestRunnerBindings::SetMockSpellCheckerEnabled) |
524 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) | 527 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) |
525 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) | 528 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) |
526 .SetMethod("setIsolatedWorldContentSecurityPolicy", | 529 .SetMethod("setIsolatedWorldContentSecurityPolicy", |
527 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) | 530 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) |
528 .SetMethod("setIsolatedWorldSecurityOrigin", | 531 .SetMethod("setIsolatedWorldSecurityOrigin", |
529 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) | 532 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 bool forbidden, const std::string& scheme) { | 710 bool forbidden, const std::string& scheme) { |
708 if (view_runner_) | 711 if (view_runner_) |
709 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); | 712 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); |
710 } | 713 } |
711 | 714 |
712 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) { | 715 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) { |
713 if (runner_) | 716 if (runner_) |
714 runner_->SetDumpConsoleMessages(enabled); | 717 runner_->SetDumpConsoleMessages(enabled); |
715 } | 718 } |
716 | 719 |
| 720 void TestRunnerBindings::SetDumpJavaScriptDialogs(bool enabled) { |
| 721 if (runner_) |
| 722 runner_->SetDumpJavaScriptDialogs(enabled); |
| 723 } |
| 724 |
717 void TestRunnerBindings::SetEffectiveConnectionType( | 725 void TestRunnerBindings::SetEffectiveConnectionType( |
718 const std::string& connection_type) { | 726 const std::string& connection_type) { |
719 blink::WebEffectiveConnectionType web_type = | 727 blink::WebEffectiveConnectionType web_type = |
720 blink::WebEffectiveConnectionType::TypeUnknown; | 728 blink::WebEffectiveConnectionType::TypeUnknown; |
721 if (connection_type == "TypeUnknown") | 729 if (connection_type == "TypeUnknown") |
722 web_type = blink::WebEffectiveConnectionType::TypeUnknown; | 730 web_type = blink::WebEffectiveConnectionType::TypeUnknown; |
723 else if (connection_type == "TypeOffline") | 731 else if (connection_type == "TypeOffline") |
724 web_type = blink::WebEffectiveConnectionType::TypeOffline; | 732 web_type = blink::WebEffectiveConnectionType::TypeOffline; |
725 else if (connection_type == "TypeSlow2G") | 733 else if (connection_type == "TypeSlow2G") |
726 web_type = blink::WebEffectiveConnectionType::TypeSlow2G; | 734 web_type = blink::WebEffectiveConnectionType::TypeSlow2G; |
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2610 void TestRunner::DumpNavigationPolicy() { | 2618 void TestRunner::DumpNavigationPolicy() { |
2611 layout_test_runtime_flags_.set_dump_navigation_policy(true); | 2619 layout_test_runtime_flags_.set_dump_navigation_policy(true); |
2612 OnLayoutTestRuntimeFlagsChanged(); | 2620 OnLayoutTestRuntimeFlagsChanged(); |
2613 } | 2621 } |
2614 | 2622 |
2615 void TestRunner::SetDumpConsoleMessages(bool value) { | 2623 void TestRunner::SetDumpConsoleMessages(bool value) { |
2616 layout_test_runtime_flags_.set_dump_console_messages(value); | 2624 layout_test_runtime_flags_.set_dump_console_messages(value); |
2617 OnLayoutTestRuntimeFlagsChanged(); | 2625 OnLayoutTestRuntimeFlagsChanged(); |
2618 } | 2626 } |
2619 | 2627 |
| 2628 void TestRunner::SetDumpJavaScriptDialogs(bool value) { |
| 2629 layout_test_runtime_flags_.set_dump_javascript_dialogs(value); |
| 2630 OnLayoutTestRuntimeFlagsChanged(); |
| 2631 } |
| 2632 |
2620 void TestRunner::SetEffectiveConnectionType( | 2633 void TestRunner::SetEffectiveConnectionType( |
2621 blink::WebEffectiveConnectionType connection_type) { | 2634 blink::WebEffectiveConnectionType connection_type) { |
2622 effective_connection_type_ = connection_type; | 2635 effective_connection_type_ = connection_type; |
2623 } | 2636 } |
2624 | 2637 |
2625 void TestRunner::SetMockSpellCheckerEnabled(bool enabled) { | 2638 void TestRunner::SetMockSpellCheckerEnabled(bool enabled) { |
2626 spellcheck_->SetEnabled(enabled); | 2639 spellcheck_->SetEnabled(enabled); |
2627 } | 2640 } |
2628 | 2641 |
2629 bool TestRunner::ShouldDumpConsoleMessages() const { | 2642 bool TestRunner::ShouldDumpConsoleMessages() const { |
2630 return layout_test_runtime_flags_.dump_console_messages(); | 2643 return layout_test_runtime_flags_.dump_console_messages(); |
2631 } | 2644 } |
2632 | 2645 |
| 2646 bool TestRunner::ShouldDumpJavaScriptDialogs() const { |
| 2647 return layout_test_runtime_flags_.dump_javascript_dialogs(); |
| 2648 } |
| 2649 |
2633 void TestRunner::CloseWebInspector() { | 2650 void TestRunner::CloseWebInspector() { |
2634 delegate_->CloseDevTools(); | 2651 delegate_->CloseDevTools(); |
2635 } | 2652 } |
2636 | 2653 |
2637 bool TestRunner::IsChooserShown() { | 2654 bool TestRunner::IsChooserShown() { |
2638 return 0 < chooser_count_; | 2655 return 0 < chooser_count_; |
2639 } | 2656 } |
2640 | 2657 |
2641 void TestRunner::EvaluateInWebInspector(int call_id, | 2658 void TestRunner::EvaluateInWebInspector(int call_id, |
2642 const std::string& script) { | 2659 const std::string& script) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2786 | 2803 |
2787 void TestRunner::NotifyDone() { | 2804 void TestRunner::NotifyDone() { |
2788 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2805 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2789 !will_navigate_ && work_queue_.is_empty()) | 2806 !will_navigate_ && work_queue_.is_empty()) |
2790 delegate_->TestFinished(); | 2807 delegate_->TestFinished(); |
2791 layout_test_runtime_flags_.set_wait_until_done(false); | 2808 layout_test_runtime_flags_.set_wait_until_done(false); |
2792 OnLayoutTestRuntimeFlagsChanged(); | 2809 OnLayoutTestRuntimeFlagsChanged(); |
2793 } | 2810 } |
2794 | 2811 |
2795 } // namespace test_runner | 2812 } // namespace test_runner |
OLD | NEW |