| 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/nullable_string16.h" | 14 #include "base/strings/nullable_string16.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
| 17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "components/test_runner/app_banner_client.h" | |
| 20 #include "components/test_runner/layout_and_paint_async_then.h" | 19 #include "components/test_runner/layout_and_paint_async_then.h" |
| 21 #include "components/test_runner/layout_dump.h" | 20 #include "components/test_runner/layout_dump.h" |
| 22 #include "components/test_runner/mock_content_settings_client.h" | 21 #include "components/test_runner/mock_content_settings_client.h" |
| 23 #include "components/test_runner/mock_credential_manager_client.h" | 22 #include "components/test_runner/mock_credential_manager_client.h" |
| 24 #include "components/test_runner/mock_screen_orientation_client.h" | 23 #include "components/test_runner/mock_screen_orientation_client.h" |
| 25 #include "components/test_runner/mock_web_document_subresource_filter.h" | 24 #include "components/test_runner/mock_web_document_subresource_filter.h" |
| 26 #include "components/test_runner/mock_web_speech_recognizer.h" | 25 #include "components/test_runner/mock_web_speech_recognizer.h" |
| 27 #include "components/test_runner/mock_web_user_media_client.h" | 26 #include "components/test_runner/mock_web_user_media_client.h" |
| 28 #include "components/test_runner/pixel_dump.h" | 27 #include "components/test_runner/pixel_dump.h" |
| 29 #include "components/test_runner/spell_check_client.h" | 28 #include "components/test_runner/spell_check_client.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 void ClearPrinting(); | 123 void ClearPrinting(); |
| 125 void CloseWebInspector(); | 124 void CloseWebInspector(); |
| 126 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 125 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
| 127 int y, | 126 int y, |
| 128 v8::Local<v8::Function> callback); | 127 v8::Local<v8::Function> callback); |
| 129 void DidAcquirePointerLock(); | 128 void DidAcquirePointerLock(); |
| 130 void DidLosePointerLock(); | 129 void DidLosePointerLock(); |
| 131 void DidNotAcquirePointerLock(); | 130 void DidNotAcquirePointerLock(); |
| 132 void DisableMockScreenOrientation(); | 131 void DisableMockScreenOrientation(); |
| 133 void DispatchBeforeInstallPromptEvent( | 132 void DispatchBeforeInstallPromptEvent( |
| 134 int request_id, | |
| 135 const std::vector<std::string>& event_platforms, | 133 const std::vector<std::string>& event_platforms, |
| 136 v8::Local<v8::Function> callback); | 134 v8::Local<v8::Function> callback); |
| 137 void DumpAsMarkup(); | 135 void DumpAsMarkup(); |
| 138 void DumpAsText(); | 136 void DumpAsText(); |
| 139 void DumpAsTextWithPixelResults(); | 137 void DumpAsTextWithPixelResults(); |
| 140 void DumpBackForwardList(); | 138 void DumpBackForwardList(); |
| 141 void DumpChildFrameScrollPositions(); | 139 void DumpChildFrameScrollPositions(); |
| 142 void DumpChildFramesAsMarkup(); | 140 void DumpChildFramesAsMarkup(); |
| 143 void DumpChildFramesAsText(); | 141 void DumpChildFramesAsText(); |
| 144 void DumpCreateView(); | 142 void DumpCreateView(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 void QueueLoadingScript(const std::string& script); | 177 void QueueLoadingScript(const std::string& script); |
| 180 void QueueNonLoadingScript(const std::string& script); | 178 void QueueNonLoadingScript(const std::string& script); |
| 181 void QueueReload(); | 179 void QueueReload(); |
| 182 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, | 180 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
| 183 const std::string& destination_protocol, | 181 const std::string& destination_protocol, |
| 184 const std::string& destination_host, | 182 const std::string& destination_host, |
| 185 bool allow_destination_subdomains); | 183 bool allow_destination_subdomains); |
| 186 void RemoveWebPageOverlay(); | 184 void RemoveWebPageOverlay(); |
| 187 void ResetDeviceLight(); | 185 void ResetDeviceLight(); |
| 188 void ResetTestHelperControllers(); | 186 void ResetTestHelperControllers(); |
| 189 void ResolveBeforeInstallPromptPromise(int request_id, | 187 void ResolveBeforeInstallPromptPromise(const std::string& platform); |
| 190 const std::string& platform); | |
| 191 void RunIdleTasks(v8::Local<v8::Function> callback); | 188 void RunIdleTasks(v8::Local<v8::Function> callback); |
| 192 void SendBluetoothManualChooserEvent(const std::string& event, | 189 void SendBluetoothManualChooserEvent(const std::string& event, |
| 193 const std::string& argument); | 190 const std::string& argument); |
| 194 void SetAcceptLanguages(const std::string& accept_languages); | 191 void SetAcceptLanguages(const std::string& accept_languages); |
| 195 void SetAllowFileAccessFromFileURLs(bool allow); | 192 void SetAllowFileAccessFromFileURLs(bool allow); |
| 196 void SetAllowRunningOfInsecureContent(bool allowed); | 193 void SetAllowRunningOfInsecureContent(bool allowed); |
| 197 void SetAutoplayAllowed(bool allowed); | 194 void SetAutoplayAllowed(bool allowed); |
| 198 void SetAllowUniversalAccessFromFileURLs(bool allow); | 195 void SetAllowUniversalAccessFromFileURLs(bool allow); |
| 199 void SetBlockThirdPartyCookies(bool block); | 196 void SetBlockThirdPartyCookies(bool block); |
| 200 void SetAudioData(const gin::ArrayBufferView& view); | 197 void SetAudioData(const gin::ArrayBufferView& view); |
| (...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1475 const std::string& origin, | 1472 const std::string& origin, |
| 1476 const std::string& embedding_origin) { | 1473 const std::string& embedding_origin) { |
| 1477 if (!runner_) | 1474 if (!runner_) |
| 1478 return; | 1475 return; |
| 1479 | 1476 |
| 1480 return runner_->SetPermission( | 1477 return runner_->SetPermission( |
| 1481 name, value, GURL(origin), GURL(embedding_origin)); | 1478 name, value, GURL(origin), GURL(embedding_origin)); |
| 1482 } | 1479 } |
| 1483 | 1480 |
| 1484 void TestRunnerBindings::DispatchBeforeInstallPromptEvent( | 1481 void TestRunnerBindings::DispatchBeforeInstallPromptEvent( |
| 1485 int request_id, | |
| 1486 const std::vector<std::string>& event_platforms, | 1482 const std::vector<std::string>& event_platforms, |
| 1487 v8::Local<v8::Function> callback) { | 1483 v8::Local<v8::Function> callback) { |
| 1488 if (!view_runner_) | 1484 if (!view_runner_) |
| 1489 return; | 1485 return; |
| 1490 | 1486 |
| 1491 return view_runner_->DispatchBeforeInstallPromptEvent( | 1487 return view_runner_->DispatchBeforeInstallPromptEvent(event_platforms, |
| 1492 request_id, event_platforms, callback); | 1488 callback); |
| 1493 } | 1489 } |
| 1494 | 1490 |
| 1495 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( | 1491 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( |
| 1496 int request_id, | |
| 1497 const std::string& platform) { | 1492 const std::string& platform) { |
| 1498 if (!runner_) | 1493 if (!runner_) |
| 1499 return; | 1494 return; |
| 1500 | 1495 |
| 1501 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); | 1496 runner_->ResolveBeforeInstallPromptPromise(platform); |
| 1502 } | 1497 } |
| 1503 | 1498 |
| 1504 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) { | 1499 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 1505 if (!view_runner_) | 1500 if (!view_runner_) |
| 1506 return; | 1501 return; |
| 1507 view_runner_->RunIdleTasks(callback); | 1502 view_runner_->RunIdleTasks(callback); |
| 1508 } | 1503 } |
| 1509 | 1504 |
| 1510 std::string TestRunnerBindings::PlatformName() { | 1505 std::string TestRunnerBindings::PlatformName() { |
| 1511 if (runner_) | 1506 if (runner_) |
| (...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2685 } | 2680 } |
| 2686 | 2681 |
| 2687 void TestRunner::SetPermission(const std::string& name, | 2682 void TestRunner::SetPermission(const std::string& name, |
| 2688 const std::string& value, | 2683 const std::string& value, |
| 2689 const GURL& origin, | 2684 const GURL& origin, |
| 2690 const GURL& embedding_origin) { | 2685 const GURL& embedding_origin) { |
| 2691 delegate_->SetPermission(name, value, origin, embedding_origin); | 2686 delegate_->SetPermission(name, value, origin, embedding_origin); |
| 2692 } | 2687 } |
| 2693 | 2688 |
| 2694 void TestRunner::ResolveBeforeInstallPromptPromise( | 2689 void TestRunner::ResolveBeforeInstallPromptPromise( |
| 2695 int request_id, | |
| 2696 const std::string& platform) { | 2690 const std::string& platform) { |
| 2697 if (!test_interfaces_->GetAppBannerClient()) | 2691 delegate_->ResolveBeforeInstallPromptPromise(platform); |
| 2698 return; | |
| 2699 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); | |
| 2700 } | 2692 } |
| 2701 | 2693 |
| 2702 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2694 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
| 2703 delegate_->SetLocale(locale); | 2695 delegate_->SetLocale(locale); |
| 2704 } | 2696 } |
| 2705 | 2697 |
| 2706 void TestRunner::SetMIDIAccessorResult(midi::mojom::Result result) { | 2698 void TestRunner::SetMIDIAccessorResult(midi::mojom::Result result) { |
| 2707 midi_accessor_result_ = result; | 2699 midi_accessor_result_ = result; |
| 2708 } | 2700 } |
| 2709 | 2701 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2794 | 2786 |
| 2795 void TestRunner::NotifyDone() { | 2787 void TestRunner::NotifyDone() { |
| 2796 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2788 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
| 2797 !will_navigate_ && work_queue_.is_empty()) | 2789 !will_navigate_ && work_queue_.is_empty()) |
| 2798 delegate_->TestFinished(); | 2790 delegate_->TestFinished(); |
| 2799 layout_test_runtime_flags_.set_wait_until_done(false); | 2791 layout_test_runtime_flags_.set_wait_until_done(false); |
| 2800 OnLayoutTestRuntimeFlagsChanged(); | 2792 OnLayoutTestRuntimeFlagsChanged(); |
| 2801 } | 2793 } |
| 2802 | 2794 |
| 2803 } // namespace test_runner | 2795 } // namespace test_runner |
| OLD | NEW |