| 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 SetMockDeviceLight(double value); | 222 void SetMockDeviceLight(double value); |
| 222 void SetMockDeviceMotion(gin::Arguments* args); | 223 void SetMockDeviceMotion(gin::Arguments* args); |
| 223 void SetMockDeviceOrientation(gin::Arguments* args); | 224 void SetMockDeviceOrientation(gin::Arguments* args); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 .SetMethod("setCloseRemainingWindowsWhenComplete", | 505 .SetMethod("setCloseRemainingWindowsWhenComplete", |
| 505 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete) | 506 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete) |
| 506 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) | 507 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) |
| 507 .SetMethod("setCustomPolicyDelegate", | 508 .SetMethod("setCustomPolicyDelegate", |
| 508 &TestRunnerBindings::SetCustomPolicyDelegate) | 509 &TestRunnerBindings::SetCustomPolicyDelegate) |
| 509 .SetMethod("setCustomTextOutput", | 510 .SetMethod("setCustomTextOutput", |
| 510 &TestRunnerBindings::SetCustomTextOutput) | 511 &TestRunnerBindings::SetCustomTextOutput) |
| 511 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) | 512 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) |
| 512 .SetMethod("setDomainRelaxationForbiddenForURLScheme", | 513 .SetMethod("setDomainRelaxationForbiddenForURLScheme", |
| 513 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) | 514 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) |
| 515 .SetMethod("setDumpConsoleMessages", |
| 516 &TestRunnerBindings::SetDumpConsoleMessages) |
| 514 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) | 517 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) |
| 515 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) | 518 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) |
| 516 .SetMethod("setIsolatedWorldContentSecurityPolicy", | 519 .SetMethod("setIsolatedWorldContentSecurityPolicy", |
| 517 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) | 520 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) |
| 518 .SetMethod("setIsolatedWorldSecurityOrigin", | 521 .SetMethod("setIsolatedWorldSecurityOrigin", |
| 519 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) | 522 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) |
| 520 .SetMethod("setJavaScriptCanAccessClipboard", | 523 .SetMethod("setJavaScriptCanAccessClipboard", |
| 521 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) | 524 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) |
| 522 .SetMethod("setMIDIAccessorResult", | 525 .SetMethod("setMIDIAccessorResult", |
| 523 &TestRunnerBindings::SetMIDIAccessorResult) | 526 &TestRunnerBindings::SetMIDIAccessorResult) |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 return view_runner_->CallShouldCloseOnWebView(); | 693 return view_runner_->CallShouldCloseOnWebView(); |
| 691 return false; | 694 return false; |
| 692 } | 695 } |
| 693 | 696 |
| 694 void TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme( | 697 void TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme( |
| 695 bool forbidden, const std::string& scheme) { | 698 bool forbidden, const std::string& scheme) { |
| 696 if (view_runner_) | 699 if (view_runner_) |
| 697 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); | 700 view_runner_->SetDomainRelaxationForbiddenForURLScheme(forbidden, scheme); |
| 698 } | 701 } |
| 699 | 702 |
| 703 void TestRunnerBindings::SetDumpConsoleMessages(bool enabled) { |
| 704 if (runner_) |
| 705 runner_->SetDumpConsoleMessages(enabled); |
| 706 } |
| 707 |
| 700 v8::Local<v8::Value> | 708 v8::Local<v8::Value> |
| 701 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( | 709 TestRunnerBindings::EvaluateScriptInIsolatedWorldAndReturnValue( |
| 702 int world_id, const std::string& script) { | 710 int world_id, const std::string& script) { |
| 703 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) | 711 if (!view_runner_ || world_id <= 0 || world_id >= (1 << 29)) |
| 704 return v8::Local<v8::Value>(); | 712 return v8::Local<v8::Value>(); |
| 705 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, | 713 return view_runner_->EvaluateScriptInIsolatedWorldAndReturnValue(world_id, |
| 706 script); | 714 script); |
| 707 } | 715 } |
| 708 | 716 |
| 709 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( | 717 void TestRunnerBindings::EvaluateScriptInIsolatedWorld( |
| (...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2546 layout_test_runtime_flags_.set_dump_drag_image(true); | 2554 layout_test_runtime_flags_.set_dump_drag_image(true); |
| 2547 DumpAsTextWithPixelResults(); | 2555 DumpAsTextWithPixelResults(); |
| 2548 OnLayoutTestRuntimeFlagsChanged(); | 2556 OnLayoutTestRuntimeFlagsChanged(); |
| 2549 } | 2557 } |
| 2550 | 2558 |
| 2551 void TestRunner::DumpNavigationPolicy() { | 2559 void TestRunner::DumpNavigationPolicy() { |
| 2552 layout_test_runtime_flags_.set_dump_navigation_policy(true); | 2560 layout_test_runtime_flags_.set_dump_navigation_policy(true); |
| 2553 OnLayoutTestRuntimeFlagsChanged(); | 2561 OnLayoutTestRuntimeFlagsChanged(); |
| 2554 } | 2562 } |
| 2555 | 2563 |
| 2564 void TestRunner::SetDumpConsoleMessages(bool value) { |
| 2565 layout_test_runtime_flags_.set_dump_console_messages(value); |
| 2566 OnLayoutTestRuntimeFlagsChanged(); |
| 2567 } |
| 2568 |
| 2569 bool TestRunner::ShouldDumpConsoleMessages() const { |
| 2570 return layout_test_runtime_flags_.dump_console_messages(); |
| 2571 } |
| 2572 |
| 2556 void TestRunner::CloseWebInspector() { | 2573 void TestRunner::CloseWebInspector() { |
| 2557 delegate_->CloseDevTools(); | 2574 delegate_->CloseDevTools(); |
| 2558 } | 2575 } |
| 2559 | 2576 |
| 2560 bool TestRunner::IsChooserShown() { | 2577 bool TestRunner::IsChooserShown() { |
| 2561 return 0 < chooser_count_; | 2578 return 0 < chooser_count_; |
| 2562 } | 2579 } |
| 2563 | 2580 |
| 2564 void TestRunner::EvaluateInWebInspector(int call_id, | 2581 void TestRunner::EvaluateInWebInspector(int call_id, |
| 2565 const std::string& script) { | 2582 const std::string& script) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2706 | 2723 |
| 2707 void TestRunner::CompleteNotifyDone() { | 2724 void TestRunner::CompleteNotifyDone() { |
| 2708 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2725 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
| 2709 work_queue_.is_empty()) | 2726 work_queue_.is_empty()) |
| 2710 delegate_->TestFinished(); | 2727 delegate_->TestFinished(); |
| 2711 layout_test_runtime_flags_.set_wait_until_done(false); | 2728 layout_test_runtime_flags_.set_wait_until_done(false); |
| 2712 OnLayoutTestRuntimeFlagsChanged(); | 2729 OnLayoutTestRuntimeFlagsChanged(); |
| 2713 } | 2730 } |
| 2714 | 2731 |
| 2715 } // namespace test_runner | 2732 } // namespace test_runner |
| OLD | NEW |