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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 void AddMockSpeechRecognitionResult(const std::string& transcript, | 113 void AddMockSpeechRecognitionResult(const std::string& transcript, |
114 double confidence); | 114 double confidence); |
115 void AddOriginAccessWhitelistEntry(const std::string& source_origin, | 115 void AddOriginAccessWhitelistEntry(const std::string& source_origin, |
116 const std::string& destination_protocol, | 116 const std::string& destination_protocol, |
117 const std::string& destination_host, | 117 const std::string& destination_host, |
118 bool allow_destination_subdomains); | 118 bool allow_destination_subdomains); |
119 void AddWebPageOverlay(); | 119 void AddWebPageOverlay(); |
120 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); | 120 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); |
121 void ClearAllDatabases(); | 121 void ClearAllDatabases(); |
122 void ClearGeofencingMockProvider(); | |
123 void ClearPrinting(); | 122 void ClearPrinting(); |
124 void CloseWebInspector(); | 123 void CloseWebInspector(); |
125 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 124 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
126 int y, | 125 int y, |
127 v8::Local<v8::Function> callback); | 126 v8::Local<v8::Function> callback); |
128 void DidAcquirePointerLock(); | 127 void DidAcquirePointerLock(); |
129 void DidLosePointerLock(); | 128 void DidLosePointerLock(); |
130 void DidNotAcquirePointerLock(); | 129 void DidNotAcquirePointerLock(); |
131 void DisableMockScreenOrientation(); | 130 void DisableMockScreenOrientation(); |
132 void DispatchBeforeInstallPromptEvent( | 131 void DispatchBeforeInstallPromptEvent( |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 void SetBluetoothManualChooser(bool enable); | 204 void SetBluetoothManualChooser(bool enable); |
206 void SetCanOpenWindows(); | 205 void SetCanOpenWindows(); |
207 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); | 206 void SetCloseRemainingWindowsWhenComplete(gin::Arguments* args); |
208 void SetColorProfile(const std::string& name, | 207 void SetColorProfile(const std::string& name, |
209 v8::Local<v8::Function> callback); | 208 v8::Local<v8::Function> callback); |
210 void SetCustomPolicyDelegate(gin::Arguments* args); | 209 void SetCustomPolicyDelegate(gin::Arguments* args); |
211 void SetCustomTextOutput(const std::string& output); | 210 void SetCustomTextOutput(const std::string& output); |
212 void SetDatabaseQuota(int quota); | 211 void SetDatabaseQuota(int quota); |
213 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, | 212 void SetDomainRelaxationForbiddenForURLScheme(bool forbidden, |
214 const std::string& scheme); | 213 const std::string& scheme); |
215 void SetGeofencingMockPosition(double latitude, double longitude); | |
216 void SetGeofencingMockProvider(bool service_available); | |
217 void SetImagesAllowed(bool allowed); | 214 void SetImagesAllowed(bool allowed); |
218 void SetInterceptPostMessage(bool value); | 215 void SetInterceptPostMessage(bool value); |
219 void SetIsolatedWorldContentSecurityPolicy(int world_id, | 216 void SetIsolatedWorldContentSecurityPolicy(int world_id, |
220 const std::string& policy); | 217 const std::string& policy); |
221 void SetIsolatedWorldSecurityOrigin(int world_id, | 218 void SetIsolatedWorldSecurityOrigin(int world_id, |
222 v8::Local<v8::Value> origin); | 219 v8::Local<v8::Value> origin); |
223 void SetJavaScriptCanAccessClipboard(bool can_access); | 220 void SetJavaScriptCanAccessClipboard(bool can_access); |
224 void SetMIDIAccessorResult(bool result); | 221 void SetMIDIAccessorResult(bool result); |
225 void SetMediaAllowed(bool allowed); | 222 void SetMediaAllowed(bool allowed); |
226 void SetMockDeviceLight(double value); | 223 void SetMockDeviceLight(double value); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 .SetMethod("addOriginAccessWhitelistEntry", | 345 .SetMethod("addOriginAccessWhitelistEntry", |
349 &TestRunnerBindings::AddOriginAccessWhitelistEntry) | 346 &TestRunnerBindings::AddOriginAccessWhitelistEntry) |
350 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) | 347 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) |
351 .SetMethod("animationScheduled", &TestRunnerBindings::AnimationScheduled) | 348 .SetMethod("animationScheduled", &TestRunnerBindings::AnimationScheduled) |
352 .SetMethod("callShouldCloseOnWebView", | 349 .SetMethod("callShouldCloseOnWebView", |
353 &TestRunnerBindings::CallShouldCloseOnWebView) | 350 &TestRunnerBindings::CallShouldCloseOnWebView) |
354 .SetMethod("capturePixelsAsyncThen", | 351 .SetMethod("capturePixelsAsyncThen", |
355 &TestRunnerBindings::CapturePixelsAsyncThen) | 352 &TestRunnerBindings::CapturePixelsAsyncThen) |
356 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) | 353 .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) |
357 .SetMethod("clearBackForwardList", &TestRunnerBindings::NotImplemented) | 354 .SetMethod("clearBackForwardList", &TestRunnerBindings::NotImplemented) |
358 .SetMethod("clearGeofencingMockProvider", | |
359 &TestRunnerBindings::ClearGeofencingMockProvider) | |
360 .SetMethod("clearPrinting", &TestRunnerBindings::ClearPrinting) | 355 .SetMethod("clearPrinting", &TestRunnerBindings::ClearPrinting) |
361 .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) | 356 .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) |
362 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", | 357 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", |
363 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) | 358 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) |
364 .SetMethod("didAcquirePointerLock", | 359 .SetMethod("didAcquirePointerLock", |
365 &TestRunnerBindings::DidAcquirePointerLock) | 360 &TestRunnerBindings::DidAcquirePointerLock) |
366 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock) | 361 .SetMethod("didLosePointerLock", &TestRunnerBindings::DidLosePointerLock) |
367 .SetMethod("didNotAcquirePointerLock", | 362 .SetMethod("didNotAcquirePointerLock", |
368 &TestRunnerBindings::DidNotAcquirePointerLock) | 363 &TestRunnerBindings::DidNotAcquirePointerLock) |
369 .SetMethod("disableAutoResizeMode", | 364 .SetMethod("disableAutoResizeMode", |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 .SetMethod("setCloseRemainingWindowsWhenComplete", | 510 .SetMethod("setCloseRemainingWindowsWhenComplete", |
516 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete) | 511 &TestRunnerBindings::SetCloseRemainingWindowsWhenComplete) |
517 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) | 512 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) |
518 .SetMethod("setCustomPolicyDelegate", | 513 .SetMethod("setCustomPolicyDelegate", |
519 &TestRunnerBindings::SetCustomPolicyDelegate) | 514 &TestRunnerBindings::SetCustomPolicyDelegate) |
520 .SetMethod("setCustomTextOutput", | 515 .SetMethod("setCustomTextOutput", |
521 &TestRunnerBindings::SetCustomTextOutput) | 516 &TestRunnerBindings::SetCustomTextOutput) |
522 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) | 517 .SetMethod("setDatabaseQuota", &TestRunnerBindings::SetDatabaseQuota) |
523 .SetMethod("setDomainRelaxationForbiddenForURLScheme", | 518 .SetMethod("setDomainRelaxationForbiddenForURLScheme", |
524 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) | 519 &TestRunnerBindings::SetDomainRelaxationForbiddenForURLScheme) |
525 .SetMethod("setGeofencingMockPosition", | |
526 &TestRunnerBindings::SetGeofencingMockPosition) | |
527 .SetMethod("setGeofencingMockProvider", | |
528 &TestRunnerBindings::SetGeofencingMockProvider) | |
529 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) | 520 .SetMethod("setIconDatabaseEnabled", &TestRunnerBindings::NotImplemented) |
530 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) | 521 .SetMethod("setImagesAllowed", &TestRunnerBindings::SetImagesAllowed) |
531 .SetMethod("setIsolatedWorldContentSecurityPolicy", | 522 .SetMethod("setIsolatedWorldContentSecurityPolicy", |
532 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) | 523 &TestRunnerBindings::SetIsolatedWorldContentSecurityPolicy) |
533 .SetMethod("setIsolatedWorldSecurityOrigin", | 524 .SetMethod("setIsolatedWorldSecurityOrigin", |
534 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) | 525 &TestRunnerBindings::SetIsolatedWorldSecurityOrigin) |
535 .SetMethod("setJavaScriptCanAccessClipboard", | 526 .SetMethod("setJavaScriptCanAccessClipboard", |
536 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) | 527 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) |
537 .SetMethod("setMIDIAccessorResult", | 528 .SetMethod("setMIDIAccessorResult", |
538 &TestRunnerBindings::SetMIDIAccessorResult) | 529 &TestRunnerBindings::SetMIDIAccessorResult) |
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 if (runner_) | 1411 if (runner_) |
1421 runner_->setCustomTextOutput(output); | 1412 runner_->setCustomTextOutput(output); |
1422 } | 1413 } |
1423 | 1414 |
1424 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name, | 1415 void TestRunnerBindings::SetViewSourceForFrame(const std::string& name, |
1425 bool enabled) { | 1416 bool enabled) { |
1426 if (view_runner_) | 1417 if (view_runner_) |
1427 view_runner_->SetViewSourceForFrame(name, enabled); | 1418 view_runner_->SetViewSourceForFrame(name, enabled); |
1428 } | 1419 } |
1429 | 1420 |
1430 void TestRunnerBindings::SetGeofencingMockProvider(bool service_available) { | |
1431 if (runner_) | |
1432 runner_->SetGeofencingMockProvider(service_available); | |
1433 } | |
1434 | |
1435 void TestRunnerBindings::ClearGeofencingMockProvider() { | |
1436 if (runner_) | |
1437 runner_->ClearGeofencingMockProvider(); | |
1438 } | |
1439 | |
1440 void TestRunnerBindings::SetGeofencingMockPosition(double latitude, | |
1441 double longitude) { | |
1442 if (runner_) | |
1443 runner_->SetGeofencingMockPosition(latitude, longitude); | |
1444 } | |
1445 | |
1446 void TestRunnerBindings::SetPermission(const std::string& name, | 1421 void TestRunnerBindings::SetPermission(const std::string& name, |
1447 const std::string& value, | 1422 const std::string& value, |
1448 const std::string& origin, | 1423 const std::string& origin, |
1449 const std::string& embedding_origin) { | 1424 const std::string& embedding_origin) { |
1450 if (!runner_) | 1425 if (!runner_) |
1451 return; | 1426 return; |
1452 | 1427 |
1453 return runner_->SetPermission( | 1428 return runner_->SetPermission( |
1454 name, value, GURL(origin), GURL(embedding_origin)); | 1429 name, value, GURL(origin), GURL(embedding_origin)); |
1455 } | 1430 } |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 // Reset the default quota for each origin to 5MB | 1607 // Reset the default quota for each origin to 5MB |
1633 delegate_->SetDatabaseQuota(5 * 1024 * 1024); | 1608 delegate_->SetDatabaseQuota(5 * 1024 * 1024); |
1634 delegate_->SetDeviceColorProfile("reset"); | 1609 delegate_->SetDeviceColorProfile("reset"); |
1635 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); | 1610 delegate_->SetDeviceScaleFactor(GetDefaultDeviceScaleFactor()); |
1636 delegate_->SetAcceptAllCookies(false); | 1611 delegate_->SetAcceptAllCookies(false); |
1637 delegate_->SetLocale(""); | 1612 delegate_->SetLocale(""); |
1638 delegate_->UseUnfortunateSynchronousResizeMode(false); | 1613 delegate_->UseUnfortunateSynchronousResizeMode(false); |
1639 delegate_->DisableAutoResizeMode(WebSize()); | 1614 delegate_->DisableAutoResizeMode(WebSize()); |
1640 delegate_->DeleteAllCookies(); | 1615 delegate_->DeleteAllCookies(); |
1641 delegate_->SetBluetoothManualChooser(false); | 1616 delegate_->SetBluetoothManualChooser(false); |
1642 delegate_->ClearGeofencingMockProvider(); | |
1643 delegate_->ResetPermissions(); | 1617 delegate_->ResetPermissions(); |
1644 ResetDeviceLight(); | 1618 ResetDeviceLight(); |
1645 } | 1619 } |
1646 | 1620 |
1647 dump_as_audio_ = false; | 1621 dump_as_audio_ = false; |
1648 dump_create_view_ = false; | 1622 dump_create_view_ = false; |
1649 can_open_windows_ = false; | 1623 can_open_windows_ = false; |
1650 dump_window_status_changes_ = false; | 1624 dump_window_status_changes_ = false; |
1651 dump_spell_check_callbacks_ = false; | 1625 dump_spell_check_callbacks_ = false; |
1652 dump_back_forward_list_ = false; | 1626 dump_back_forward_list_ = false; |
(...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2655 delegate_->SetFocus(web_view, false); | 2629 delegate_->SetFocus(web_view, false); |
2656 previously_focused_view_ = nullptr; | 2630 previously_focused_view_ = nullptr; |
2657 } | 2631 } |
2658 } | 2632 } |
2659 } | 2633 } |
2660 | 2634 |
2661 std::string TestRunner::PathToLocalResource(const std::string& path) { | 2635 std::string TestRunner::PathToLocalResource(const std::string& path) { |
2662 return delegate_->PathToLocalResource(path); | 2636 return delegate_->PathToLocalResource(path); |
2663 } | 2637 } |
2664 | 2638 |
2665 void TestRunner::SetGeofencingMockProvider(bool service_available) { | |
2666 delegate_->SetGeofencingMockProvider(service_available); | |
2667 } | |
2668 | |
2669 void TestRunner::ClearGeofencingMockProvider() { | |
2670 delegate_->ClearGeofencingMockProvider(); | |
2671 } | |
2672 | |
2673 void TestRunner::SetGeofencingMockPosition(double latitude, double longitude) { | |
2674 delegate_->SetGeofencingMockPosition(latitude, longitude); | |
2675 } | |
2676 | |
2677 void TestRunner::SetPermission(const std::string& name, | 2639 void TestRunner::SetPermission(const std::string& name, |
2678 const std::string& value, | 2640 const std::string& value, |
2679 const GURL& origin, | 2641 const GURL& origin, |
2680 const GURL& embedding_origin) { | 2642 const GURL& embedding_origin) { |
2681 delegate_->SetPermission(name, value, origin, embedding_origin); | 2643 delegate_->SetPermission(name, value, origin, embedding_origin); |
2682 } | 2644 } |
2683 | 2645 |
2684 void TestRunner::ResolveBeforeInstallPromptPromise( | 2646 void TestRunner::ResolveBeforeInstallPromptPromise( |
2685 int request_id, | 2647 int request_id, |
2686 const std::string& platform) { | 2648 const std::string& platform) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2778 | 2740 |
2779 void TestRunner::CompleteNotifyDone() { | 2741 void TestRunner::CompleteNotifyDone() { |
2780 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2742 if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && |
2781 work_queue_.is_empty()) | 2743 work_queue_.is_empty()) |
2782 delegate_->TestFinished(); | 2744 delegate_->TestFinished(); |
2783 layout_test_runtime_flags_.set_wait_until_done(false); | 2745 layout_test_runtime_flags_.set_wait_until_done(false); |
2784 OnLayoutTestRuntimeFlagsChanged(); | 2746 OnLayoutTestRuntimeFlagsChanged(); |
2785 } | 2747 } |
2786 | 2748 |
2787 } // namespace test_runner | 2749 } // namespace test_runner |
OLD | NEW |