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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 void QueueReload(); | 240 void QueueReload(); |
241 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, | 241 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
242 const std::string& destination_protocol, | 242 const std::string& destination_protocol, |
243 const std::string& destination_host, | 243 const std::string& destination_host, |
244 bool allow_destination_subdomains); | 244 bool allow_destination_subdomains); |
245 void RemoveWebPageOverlay(); | 245 void RemoveWebPageOverlay(); |
246 void ResetDeviceLight(); | 246 void ResetDeviceLight(); |
247 void ResetTestHelperControllers(); | 247 void ResetTestHelperControllers(); |
248 void ResolveBeforeInstallPromptPromise(int request_id, | 248 void ResolveBeforeInstallPromptPromise(int request_id, |
249 const std::string& platform); | 249 const std::string& platform); |
| 250 void RunIdleTasks(v8::Local<v8::Function> callback); |
250 void SendBluetoothManualChooserEvent(const std::string& event, | 251 void SendBluetoothManualChooserEvent(const std::string& event, |
251 const std::string& argument); | 252 const std::string& argument); |
252 void SetAcceptLanguages(const std::string& accept_languages); | 253 void SetAcceptLanguages(const std::string& accept_languages); |
253 void SetAllowDisplayOfInsecureContent(bool allowed); | 254 void SetAllowDisplayOfInsecureContent(bool allowed); |
254 void SetAllowFileAccessFromFileURLs(bool allow); | 255 void SetAllowFileAccessFromFileURLs(bool allow); |
255 void SetAllowRunningOfInsecureContent(bool allowed); | 256 void SetAllowRunningOfInsecureContent(bool allowed); |
256 void SetAllowUniversalAccessFromFileURLs(bool allow); | 257 void SetAllowUniversalAccessFromFileURLs(bool allow); |
257 void SetAlwaysAcceptCookies(bool accept); | 258 void SetAlwaysAcceptCookies(bool accept); |
258 void SetAudioData(const gin::ArrayBufferView& view); | 259 void SetAudioData(const gin::ArrayBufferView& view); |
259 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); | 260 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) | 546 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) |
546 .SetMethod("removeOriginAccessWhitelistEntry", | 547 .SetMethod("removeOriginAccessWhitelistEntry", |
547 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) | 548 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) |
548 .SetMethod("removeWebPageOverlay", | 549 .SetMethod("removeWebPageOverlay", |
549 &TestRunnerBindings::RemoveWebPageOverlay) | 550 &TestRunnerBindings::RemoveWebPageOverlay) |
550 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) | 551 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) |
551 .SetMethod("resetTestHelperControllers", | 552 .SetMethod("resetTestHelperControllers", |
552 &TestRunnerBindings::ResetTestHelperControllers) | 553 &TestRunnerBindings::ResetTestHelperControllers) |
553 .SetMethod("resolveBeforeInstallPromptPromise", | 554 .SetMethod("resolveBeforeInstallPromptPromise", |
554 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) | 555 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) |
| 556 .SetMethod("runIdleTasks", |
| 557 &TestRunnerBindings::RunIdleTasks) |
555 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) | 558 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) |
556 | 559 |
557 // The Bluetooth functions are specified at | 560 // The Bluetooth functions are specified at |
558 // https://webbluetoothcg.github.io/web-bluetooth/tests/. | 561 // https://webbluetoothcg.github.io/web-bluetooth/tests/. |
559 .SetMethod("sendBluetoothManualChooserEvent", | 562 .SetMethod("sendBluetoothManualChooserEvent", |
560 &TestRunnerBindings::SendBluetoothManualChooserEvent) | 563 &TestRunnerBindings::SendBluetoothManualChooserEvent) |
561 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) | 564 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) |
562 .SetMethod("setAllowDisplayOfInsecureContent", | 565 .SetMethod("setAllowDisplayOfInsecureContent", |
563 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) | 566 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) |
564 .SetMethod("setAllowFileAccessFromFileURLs", | 567 .SetMethod("setAllowFileAccessFromFileURLs", |
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 | 1555 |
1553 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( | 1556 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( |
1554 int request_id, | 1557 int request_id, |
1555 const std::string& platform) { | 1558 const std::string& platform) { |
1556 if (!runner_) | 1559 if (!runner_) |
1557 return; | 1560 return; |
1558 | 1561 |
1559 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); | 1562 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); |
1560 } | 1563 } |
1561 | 1564 |
| 1565 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 1566 if (!runner_) |
| 1567 return; |
| 1568 runner_->RunIdleTasks(callback); |
| 1569 } |
| 1570 |
1562 std::string TestRunnerBindings::PlatformName() { | 1571 std::string TestRunnerBindings::PlatformName() { |
1563 if (runner_) | 1572 if (runner_) |
1564 return runner_->platform_name_; | 1573 return runner_->platform_name_; |
1565 return std::string(); | 1574 return std::string(); |
1566 } | 1575 } |
1567 | 1576 |
1568 std::string TestRunnerBindings::TooltipText() { | 1577 std::string TestRunnerBindings::TooltipText() { |
1569 if (runner_) | 1578 if (runner_) |
1570 return runner_->tooltip_text_; | 1579 return runner_->tooltip_text_; |
1571 return std::string(); | 1580 return std::string(); |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2949 base::Bind(&TestRunner::DispatchBeforeInstallPromptCallback, | 2958 base::Bind(&TestRunner::DispatchBeforeInstallPromptCallback, |
2950 weak_factory_.GetWeakPtr(), base::Passed(&task))); | 2959 weak_factory_.GetWeakPtr(), base::Passed(&task))); |
2951 } | 2960 } |
2952 | 2961 |
2953 void TestRunner::ResolveBeforeInstallPromptPromise( | 2962 void TestRunner::ResolveBeforeInstallPromptPromise( |
2954 int request_id, | 2963 int request_id, |
2955 const std::string& platform) { | 2964 const std::string& platform) { |
2956 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); | 2965 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); |
2957 } | 2966 } |
2958 | 2967 |
| 2968 void TestRunner::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 2969 scoped_ptr<InvokeCallbackTask> task(new InvokeCallbackTask(this, callback)); |
| 2970 delegate_->RunIdleTasks( |
| 2971 base::Bind(&TestRunner::InvokeCallback, |
| 2972 weak_factory_.GetWeakPtr(), |
| 2973 base::Passed(&task))); |
| 2974 } |
| 2975 |
2959 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2976 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
2960 delegate_->SetLocale(locale); | 2977 delegate_->SetLocale(locale); |
2961 } | 2978 } |
2962 | 2979 |
2963 void TestRunner::SetMIDIAccessorResult(bool result) { | 2980 void TestRunner::SetMIDIAccessorResult(bool result) { |
2964 midi_accessor_result_ = result; | 2981 midi_accessor_result_ = result; |
2965 } | 2982 } |
2966 | 2983 |
2967 void TestRunner::SimulateWebNotificationClick(const std::string& title, | 2984 void TestRunner::SimulateWebNotificationClick(const std::string& title, |
2968 int action_index) { | 2985 int action_index) { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3221 } | 3238 } |
3222 | 3239 |
3223 void TestRunner::DidLosePointerLockInternal() { | 3240 void TestRunner::DidLosePointerLockInternal() { |
3224 bool was_locked = pointer_locked_; | 3241 bool was_locked = pointer_locked_; |
3225 pointer_locked_ = false; | 3242 pointer_locked_ = false; |
3226 if (was_locked) | 3243 if (was_locked) |
3227 web_view_->didLosePointerLock(); | 3244 web_view_->didLosePointerLock(); |
3228 } | 3245 } |
3229 | 3246 |
3230 } // namespace test_runner | 3247 } // namespace test_runner |
OLD | NEW |