| 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 |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "components/test_runner/app_banner_client.h" | |
| 18 #include "components/test_runner/layout_and_paint_async_then.h" | 17 #include "components/test_runner/layout_and_paint_async_then.h" |
| 19 #include "components/test_runner/layout_dump.h" | 18 #include "components/test_runner/layout_dump.h" |
| 20 #include "components/test_runner/mock_content_settings_client.h" | 19 #include "components/test_runner/mock_content_settings_client.h" |
| 21 #include "components/test_runner/mock_credential_manager_client.h" | 20 #include "components/test_runner/mock_credential_manager_client.h" |
| 22 #include "components/test_runner/mock_screen_orientation_client.h" | 21 #include "components/test_runner/mock_screen_orientation_client.h" |
| 23 #include "components/test_runner/mock_web_document_subresource_filter.h" | 22 #include "components/test_runner/mock_web_document_subresource_filter.h" |
| 24 #include "components/test_runner/mock_web_speech_recognizer.h" | 23 #include "components/test_runner/mock_web_speech_recognizer.h" |
| 25 #include "components/test_runner/mock_web_user_media_client.h" | 24 #include "components/test_runner/mock_web_user_media_client.h" |
| 26 #include "components/test_runner/pixel_dump.h" | 25 #include "components/test_runner/pixel_dump.h" |
| 27 #include "components/test_runner/spell_check_client.h" | 26 #include "components/test_runner/spell_check_client.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void ClearPrinting(); | 121 void ClearPrinting(); |
| 123 void CloseWebInspector(); | 122 void CloseWebInspector(); |
| 124 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 123 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
| 125 int y, | 124 int y, |
| 126 v8::Local<v8::Function> callback); | 125 v8::Local<v8::Function> callback); |
| 127 void DidAcquirePointerLock(); | 126 void DidAcquirePointerLock(); |
| 128 void DidLosePointerLock(); | 127 void DidLosePointerLock(); |
| 129 void DidNotAcquirePointerLock(); | 128 void DidNotAcquirePointerLock(); |
| 130 void DisableMockScreenOrientation(); | 129 void DisableMockScreenOrientation(); |
| 131 void DispatchBeforeInstallPromptEvent( | 130 void DispatchBeforeInstallPromptEvent( |
| 132 int request_id, | |
| 133 const std::vector<std::string>& event_platforms, | 131 const std::vector<std::string>& event_platforms, |
| 134 v8::Local<v8::Function> callback); | 132 v8::Local<v8::Function> callback); |
| 135 void DumpAsMarkup(); | 133 void DumpAsMarkup(); |
| 136 void DumpAsText(); | 134 void DumpAsText(); |
| 137 void DumpAsTextWithPixelResults(); | 135 void DumpAsTextWithPixelResults(); |
| 138 void DumpBackForwardList(); | 136 void DumpBackForwardList(); |
| 139 void DumpChildFrameScrollPositions(); | 137 void DumpChildFrameScrollPositions(); |
| 140 void DumpChildFramesAsMarkup(); | 138 void DumpChildFramesAsMarkup(); |
| 141 void DumpChildFramesAsText(); | 139 void DumpChildFramesAsText(); |
| 142 void DumpCreateView(); | 140 void DumpCreateView(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 void QueueLoadingScript(const std::string& script); | 175 void QueueLoadingScript(const std::string& script); |
| 178 void QueueNonLoadingScript(const std::string& script); | 176 void QueueNonLoadingScript(const std::string& script); |
| 179 void QueueReload(); | 177 void QueueReload(); |
| 180 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, | 178 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
| 181 const std::string& destination_protocol, | 179 const std::string& destination_protocol, |
| 182 const std::string& destination_host, | 180 const std::string& destination_host, |
| 183 bool allow_destination_subdomains); | 181 bool allow_destination_subdomains); |
| 184 void RemoveWebPageOverlay(); | 182 void RemoveWebPageOverlay(); |
| 185 void ResetDeviceLight(); | 183 void ResetDeviceLight(); |
| 186 void ResetTestHelperControllers(); | 184 void ResetTestHelperControllers(); |
| 187 void ResolveBeforeInstallPromptPromise(int request_id, | 185 void ResolveBeforeInstallPromptPromise(const std::string& platform); |
| 188 const std::string& platform); | |
| 189 void RunIdleTasks(v8::Local<v8::Function> callback); | 186 void RunIdleTasks(v8::Local<v8::Function> callback); |
| 190 void SendBluetoothManualChooserEvent(const std::string& event, | 187 void SendBluetoothManualChooserEvent(const std::string& event, |
| 191 const std::string& argument); | 188 const std::string& argument); |
| 192 void SetAcceptLanguages(const std::string& accept_languages); | 189 void SetAcceptLanguages(const std::string& accept_languages); |
| 193 void SetAllowFileAccessFromFileURLs(bool allow); | 190 void SetAllowFileAccessFromFileURLs(bool allow); |
| 194 void SetAllowRunningOfInsecureContent(bool allowed); | 191 void SetAllowRunningOfInsecureContent(bool allowed); |
| 195 void SetAutoplayAllowed(bool allowed); | 192 void SetAutoplayAllowed(bool allowed); |
| 196 void SetAllowUniversalAccessFromFileURLs(bool allow); | 193 void SetAllowUniversalAccessFromFileURLs(bool allow); |
| 197 void SetBlockThirdPartyCookies(bool block); | 194 void SetBlockThirdPartyCookies(bool block); |
| 198 void SetAudioData(const gin::ArrayBufferView& view); | 195 void SetAudioData(const gin::ArrayBufferView& view); |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1453 const std::string& origin, | 1450 const std::string& origin, |
| 1454 const std::string& embedding_origin) { | 1451 const std::string& embedding_origin) { |
| 1455 if (!runner_) | 1452 if (!runner_) |
| 1456 return; | 1453 return; |
| 1457 | 1454 |
| 1458 return runner_->SetPermission( | 1455 return runner_->SetPermission( |
| 1459 name, value, GURL(origin), GURL(embedding_origin)); | 1456 name, value, GURL(origin), GURL(embedding_origin)); |
| 1460 } | 1457 } |
| 1461 | 1458 |
| 1462 void TestRunnerBindings::DispatchBeforeInstallPromptEvent( | 1459 void TestRunnerBindings::DispatchBeforeInstallPromptEvent( |
| 1463 int request_id, | |
| 1464 const std::vector<std::string>& event_platforms, | 1460 const std::vector<std::string>& event_platforms, |
| 1465 v8::Local<v8::Function> callback) { | 1461 v8::Local<v8::Function> callback) { |
| 1466 if (!view_runner_) | 1462 if (!view_runner_) |
| 1467 return; | 1463 return; |
| 1468 | 1464 |
| 1469 return view_runner_->DispatchBeforeInstallPromptEvent( | 1465 return view_runner_->DispatchBeforeInstallPromptEvent(event_platforms, |
| 1470 request_id, event_platforms, callback); | 1466 callback); |
| 1471 } | 1467 } |
| 1472 | 1468 |
| 1473 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( | 1469 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( |
| 1474 int request_id, | |
| 1475 const std::string& platform) { | 1470 const std::string& platform) { |
| 1476 if (!runner_) | 1471 if (!runner_) |
| 1477 return; | 1472 return; |
| 1478 | 1473 |
| 1479 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); | 1474 runner_->ResolveBeforeInstallPromptPromise(platform); |
| 1480 } | 1475 } |
| 1481 | 1476 |
| 1482 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) { | 1477 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 1483 if (!view_runner_) | 1478 if (!view_runner_) |
| 1484 return; | 1479 return; |
| 1485 view_runner_->RunIdleTasks(callback); | 1480 view_runner_->RunIdleTasks(callback); |
| 1486 } | 1481 } |
| 1487 | 1482 |
| 1488 std::string TestRunnerBindings::PlatformName() { | 1483 std::string TestRunnerBindings::PlatformName() { |
| 1489 if (runner_) | 1484 if (runner_) |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2663 } | 2658 } |
| 2664 | 2659 |
| 2665 void TestRunner::SetPermission(const std::string& name, | 2660 void TestRunner::SetPermission(const std::string& name, |
| 2666 const std::string& value, | 2661 const std::string& value, |
| 2667 const GURL& origin, | 2662 const GURL& origin, |
| 2668 const GURL& embedding_origin) { | 2663 const GURL& embedding_origin) { |
| 2669 delegate_->SetPermission(name, value, origin, embedding_origin); | 2664 delegate_->SetPermission(name, value, origin, embedding_origin); |
| 2670 } | 2665 } |
| 2671 | 2666 |
| 2672 void TestRunner::ResolveBeforeInstallPromptPromise( | 2667 void TestRunner::ResolveBeforeInstallPromptPromise( |
| 2673 int request_id, | |
| 2674 const std::string& platform) { | 2668 const std::string& platform) { |
| 2675 if (!test_interfaces_->GetAppBannerClient()) | 2669 delegate_->ResolveBeforeInstallPromptPromise(platform); |
| 2676 return; | |
| 2677 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); | |
| 2678 } | 2670 } |
| 2679 | 2671 |
| 2680 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2672 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
| 2681 delegate_->SetLocale(locale); | 2673 delegate_->SetLocale(locale); |
| 2682 } | 2674 } |
| 2683 | 2675 |
| 2684 void TestRunner::SetMIDIAccessorResult(bool result) { | 2676 void TestRunner::SetMIDIAccessorResult(bool result) { |
| 2685 midi_accessor_result_ = result; | 2677 midi_accessor_result_ = result; |
| 2686 } | 2678 } |
| 2687 | 2679 |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2770 | 2762 |
| 2771 void TestRunner::NotifyDone() { | 2763 void TestRunner::NotifyDone() { |
| 2772 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2764 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
| 2773 !will_navigate_ && work_queue_.is_empty()) | 2765 !will_navigate_ && work_queue_.is_empty()) |
| 2774 delegate_->TestFinished(); | 2766 delegate_->TestFinished(); |
| 2775 layout_test_runtime_flags_.set_wait_until_done(false); | 2767 layout_test_runtime_flags_.set_wait_until_done(false); |
| 2776 OnLayoutTestRuntimeFlagsChanged(); | 2768 OnLayoutTestRuntimeFlagsChanged(); |
| 2777 } | 2769 } |
| 2778 | 2770 |
| 2779 } // namespace test_runner | 2771 } // namespace test_runner |
| OLD | NEW |