| 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 SetBluetoothManualChooser(bool enable); | 204 void SetBluetoothManualChooser(bool enable); |
| 205 void SetCanOpenWindows(); | 205 void SetCanOpenWindows(); |
| 206 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); | 206 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); |
| 207 void SetColorProfile(const std::string& name, | 207 void SetColorProfile(const std::string& name, |
| 208 v8::Local<v8::Function> callback); | 208 v8::Local<v8::Function> callback); |
| 209 void SetCustomPolicyDelegate(gin::Arguments* args); | 209 void SetCustomPolicyDelegate(gin::Arguments* args); |
| 210 void SetCustomTextOutput(const std::string& output); | 210 void SetCustomTextOutput(const std::string& output); |
| 211 void SetDatabaseQuota(int quota); | 211 void SetDatabaseQuota(int quota); |
| 212 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, | 212 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, |
| 213 const std::string& scheme); | 213 const std::string& scheme); |
| 214 void SetDumpConsoleMessages(bool value); |
| 214 void SetImagesAllowed(bool allowed); | 215 void SetImagesAllowed(bool allowed); |
| 215 void SetIsolatedWorldContentSecurityPolicy(int world_id, | 216 void SetIsolatedWorldContentSecurityPolicy(int world_id, |
| 216 const std::string& policy); | 217 const std::string& policy); |
| 217 void SetIsolatedWorldSecurityOrigin(int world_id, | 218 void SetIsolatedWorldSecurityOrigin(int world_id, |
| 218 v8::Local<v8::Value> origin); | 219 v8::Local<v8::Value> origin); |
| 219 void SetJavaScriptCanAccessClipboard(bool can_access); | 220 void SetJavaScriptCanAccessClipboard(bool can_access); |
| 220 void SetMIDIAccessorResult(bool result); | 221 void SetMIDIAccessorResult(bool result); |
| 221 void SetMediaAllowed(bool allowed); | 222 void SetMediaAllowed(bool allowed); |
| 222 void SetMockDeviceLight(double value); | 223 void SetMockDeviceLight(double value); |
| 223 void SetMockDeviceMotion(gin::Arguments* args); | 224 void SetMockDeviceMotion(gin::Arguments* args); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 .SetMethod("setCloseRemainingWindowsWhenComplete", | 506 .SetMethod("setCloseRemainingWindowsWhenComplete", |
| 506 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete) | 507 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete) |
| 507 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) | 508 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) |
| 508 .SetMethod("setCustomPolicyDelegate", | 509 .SetMethod("setCustomPolicyDelegate", |
| 509 &TestRunnerBindings::SetCustomPolicyDelegate) | 510 &TestRunnerBindings::SetCustomPolicyDelegate) |
| 510 .SetMethod("setCustomTextOutput", | 511 .SetMethod("setCustomTextOutput", |
| 511 &TestRunnerBindings::SetCustomTextOutput) | 512 &TestRunnerBindings::SetCustomTextOutput) |
| 512 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) | 513 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) |
| 513 .SetMethod("setDomainRelaxationForbiddenForURLScheme", | 514 .SetMethod("setDomainRelaxationForbiddenForURLScheme", |
| 514 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) | 515 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) |
| 516 .SetMethod("setDumpConsoleMessages", |
| 517 &TestRunnerBindings::SetDumpConsoleMessages) |
| 515 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) | 518 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) |
| 516 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) | 519 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) |
| 517 .SetMethod("setIsolatedWorldContentSecurityPolicy", | 520 .SetMethod("setIsolatedWorldContentSecurityPolicy", |
| 518 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) | 521 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) |
| 519 .SetMethod("setIsolatedWorldSecurityOrigin", | 522 .SetMethod("setIsolatedWorldSecurityOrigin", |
| 520 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) | 523 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) |
| 521 .SetMethod("setJavaScriptCanAccessClipboard", | 524 .SetMethod("setJavaScriptCanAccessClipboard", |
| 522 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) | 525 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) |
| 523 .SetMethod("setMIDIAccessorResult", | 526 .SetMethod("setMIDIAccessorResult", |
| 524 &TestRunnerBindings::SetMIDIAccessorResult) | 527 &TestRunnerBindings::SetMIDIAccessorResult) |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 return view_runner_->CallShouldCloseOnWebView(); | 695 return view_runner_->CallShouldCloseOnWebView(); |
| 693 return false; | 696 return false; |
| 694 } | 697 } |
| 695 | 698 |
| 696 void TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme( | 699 void TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme( |
| 697 bool forbidden, const std::string& scheme) { | 700 bool forbidden, const std::string& scheme) { |
| 698 if (view_runner_) | 701 if (view_runner_) |
| 699 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); | 702 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); |
| 700 } | 703 } |
| 701 | 704 |
| 705 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) { |
| 706 if (runner_) |
| 707 runner_->SetDumpConsoleMessages(enabled); |
| 708 } |
| 709 |
| 702 v8::Local<v8::Value> | 710 v8::Local<v8::Value> |
| 703 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( | 711 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( |
| 704 int world_id, const std::string& script) { | 712 int world_id, const std::string& script) { |
| 705 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) | 713 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) |
| 706 return v8::Local<v8::Value>(); | 714 return v8::Local<v8::Value>(); |
| 707 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, | 715 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, |
| 708 script); | 716 script); |
| 709 } | 717 } |
| 710 | 718 |
| 711 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( | 719 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( |
| (...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 layout_test_runtime_flags_.set_dump_drag_image(true); | 2566 layout_test_runtime_flags_.set_dump_drag_image(true); |
| 2559 DumpAsTextWithPixelResults(); | 2567 DumpAsTextWithPixelResults(); |
| 2560 OnLayoutTestRuntimeFlagsChanged(); | 2568 OnLayoutTestRuntimeFlagsChanged(); |
| 2561 } | 2569 } |
| 2562 | 2570 |
| 2563 void TestRunner::DumpNavigationPolicy() { | 2571 void TestRunner::DumpNavigationPolicy() { |
| 2564 layout_test_runtime_flags_.set_dump_navigation_policy(true); | 2572 layout_test_runtime_flags_.set_dump_navigation_policy(true); |
| 2565 OnLayoutTestRuntimeFlagsChanged(); | 2573 OnLayoutTestRuntimeFlagsChanged(); |
| 2566 } | 2574 } |
| 2567 | 2575 |
| 2576 void TestRunner::SetDumpConsoleMessages(bool value) { |
| 2577 layout_test_runtime_flags_.set_dump_console_messages(value); |
| 2578 OnLayoutTestRuntimeFlagsChanged(); |
| 2579 } |
| 2580 |
| 2581 bool TestRunner::ShouldDumpConsoleMessages() const { |
| 2582 return layout_test_runtime_flags_.dump_console_messages(); |
| 2583 } |
| 2584 |
| 2568 void TestRunner::CloseWebInspector() { | 2585 void TestRunner::CloseWebInspector() { |
| 2569 delegate_->CloseDevTools(); | 2586 delegate_->CloseDevTools(); |
| 2570 } | 2587 } |
| 2571 | 2588 |
| 2572 bool TestRunner::IsChooserShown() { | 2589 bool TestRunner::IsChooserShown() { |
| 2573 return 0 < chooser_count_; | 2590 return 0 < chooser_count_; |
| 2574 } | 2591 } |
| 2575 | 2592 |
| 2576 void TestRunner::EvaluateInWebInspector(int call_id, | 2593 void TestRunner::EvaluateInWebInspector(int call_id, |
| 2577 const std::string& script) { | 2594 const std::string& script) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2718 | 2735 |
| 2719 void TestRunner::CompleteNotifyDone() { | 2736 void TestRunner::CompleteNotifyDone() { |
| 2720 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2737 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
| 2721 work_queue_.is_empty()) | 2738 work_queue_.is_empty()) |
| 2722 delegate_->TestFinished(); | 2739 delegate_->TestFinished(); |
| 2723 layout_test_runtime_flags_.set_wait_until_done(false); | 2740 layout_test_runtime_flags_.set_wait_until_done(false); |
| 2724 OnLayoutTestRuntimeFlagsChanged(); | 2741 OnLayoutTestRuntimeFlagsChanged(); |
| 2725 } | 2742 } |
| 2726 | 2743 |
| 2727 } // namespace test_runner | 2744 } // namespace test_runner |
| OLD | NEW |