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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 void QueueReload(); | 242 void QueueReload(); |
243 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, | 243 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
244 const std::string& destination_protocol, | 244 const std::string& destination_protocol, |
245 const std::string& destination_host, | 245 const std::string& destination_host, |
246 bool allow_destination_subdomains); | 246 bool allow_destination_subdomains); |
247 void RemoveWebPageOverlay(); | 247 void RemoveWebPageOverlay(); |
248 void ResetDeviceLight(); | 248 void ResetDeviceLight(); |
249 void ResetTestHelperControllers(); | 249 void ResetTestHelperControllers(); |
250 void ResolveBeforeInstallPromptPromise(int request_id, | 250 void ResolveBeforeInstallPromptPromise(int request_id, |
251 const std::string& platform); | 251 const std::string& platform); |
| 252 void RunIdleTasks(v8::Local<v8::Function> callback); |
252 void SendBluetoothManualChooserEvent(const std::string& event, | 253 void SendBluetoothManualChooserEvent(const std::string& event, |
253 const std::string& argument); | 254 const std::string& argument); |
254 void SetAcceptLanguages(const std::string& accept_languages); | 255 void SetAcceptLanguages(const std::string& accept_languages); |
255 void SetAllowDisplayOfInsecureContent(bool allowed); | 256 void SetAllowDisplayOfInsecureContent(bool allowed); |
256 void SetAllowFileAccessFromFileURLs(bool allow); | 257 void SetAllowFileAccessFromFileURLs(bool allow); |
257 void SetAllowRunningOfInsecureContent(bool allowed); | 258 void SetAllowRunningOfInsecureContent(bool allowed); |
258 void SetAllowUniversalAccessFromFileURLs(bool allow); | 259 void SetAllowUniversalAccessFromFileURLs(bool allow); |
259 void SetAlwaysAcceptCookies(bool accept); | 260 void SetAlwaysAcceptCookies(bool accept); |
260 void SetAudioData(const gin::ArrayBufferView& view); | 261 void SetAudioData(const gin::ArrayBufferView& view); |
261 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); | 262 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) | 549 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) |
549 .SetMethod("removeOriginAccessWhitelistEntry", | 550 .SetMethod("removeOriginAccessWhitelistEntry", |
550 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) | 551 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) |
551 .SetMethod("removeWebPageOverlay", | 552 .SetMethod("removeWebPageOverlay", |
552 &TestRunnerBindings::RemoveWebPageOverlay) | 553 &TestRunnerBindings::RemoveWebPageOverlay) |
553 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) | 554 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) |
554 .SetMethod("resetTestHelperControllers", | 555 .SetMethod("resetTestHelperControllers", |
555 &TestRunnerBindings::ResetTestHelperControllers) | 556 &TestRunnerBindings::ResetTestHelperControllers) |
556 .SetMethod("resolveBeforeInstallPromptPromise", | 557 .SetMethod("resolveBeforeInstallPromptPromise", |
557 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) | 558 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) |
| 559 .SetMethod("runIdleTasks", |
| 560 &TestRunnerBindings::RunIdleTasks) |
558 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) | 561 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) |
559 | 562 |
560 // The Bluetooth functions are specified at | 563 // The Bluetooth functions are specified at |
561 // https://webbluetoothcg.github.io/web-bluetooth/tests/. | 564 // https://webbluetoothcg.github.io/web-bluetooth/tests/. |
562 .SetMethod("sendBluetoothManualChooserEvent", | 565 .SetMethod("sendBluetoothManualChooserEvent", |
563 &TestRunnerBindings::SendBluetoothManualChooserEvent) | 566 &TestRunnerBindings::SendBluetoothManualChooserEvent) |
564 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) | 567 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) |
565 .SetMethod("setAllowDisplayOfInsecureContent", | 568 .SetMethod("setAllowDisplayOfInsecureContent", |
566 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) | 569 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) |
567 .SetMethod("setAllowFileAccessFromFileURLs", | 570 .SetMethod("setAllowFileAccessFromFileURLs", |
(...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1556 | 1559 |
1557 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( | 1560 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( |
1558 int request_id, | 1561 int request_id, |
1559 const std::string& platform) { | 1562 const std::string& platform) { |
1560 if (!runner_) | 1563 if (!runner_) |
1561 return; | 1564 return; |
1562 | 1565 |
1563 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); | 1566 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); |
1564 } | 1567 } |
1565 | 1568 |
| 1569 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 1570 if (!runner_) |
| 1571 return; |
| 1572 runner_->RunIdleTasks(callback); |
| 1573 } |
| 1574 |
1566 std::string TestRunnerBindings::PlatformName() { | 1575 std::string TestRunnerBindings::PlatformName() { |
1567 if (runner_) | 1576 if (runner_) |
1568 return runner_->platform_name_; | 1577 return runner_->platform_name_; |
1569 return std::string(); | 1578 return std::string(); |
1570 } | 1579 } |
1571 | 1580 |
1572 std::string TestRunnerBindings::TooltipText() { | 1581 std::string TestRunnerBindings::TooltipText() { |
1573 if (runner_) | 1582 if (runner_) |
1574 return runner_->tooltip_text_; | 1583 return runner_->tooltip_text_; |
1575 return std::string(); | 1584 return std::string(); |
(...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 base::Bind(&TestRunner::DispatchBeforeInstallPromptCallback, | 3044 base::Bind(&TestRunner::DispatchBeforeInstallPromptCallback, |
3036 weak_factory_.GetWeakPtr(), base::Passed(&task))); | 3045 weak_factory_.GetWeakPtr(), base::Passed(&task))); |
3037 } | 3046 } |
3038 | 3047 |
3039 void TestRunner::ResolveBeforeInstallPromptPromise( | 3048 void TestRunner::ResolveBeforeInstallPromptPromise( |
3040 int request_id, | 3049 int request_id, |
3041 const std::string& platform) { | 3050 const std::string& platform) { |
3042 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); | 3051 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); |
3043 } | 3052 } |
3044 | 3053 |
| 3054 void TestRunner::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 3055 scoped_ptr<InvokeCallbackTask> task(new InvokeCallbackTask(this, callback)); |
| 3056 delegate_->RunIdleTasks( |
| 3057 base::Bind(&TestRunner::InvokeCallback, |
| 3058 weak_factory_.GetWeakPtr(), |
| 3059 base::Passed(&task))); |
| 3060 } |
| 3061 |
3045 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 3062 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
3046 delegate_->SetLocale(locale); | 3063 delegate_->SetLocale(locale); |
3047 } | 3064 } |
3048 | 3065 |
3049 void TestRunner::SetMIDIAccessorResult(bool result) { | 3066 void TestRunner::SetMIDIAccessorResult(bool result) { |
3050 midi_accessor_result_ = result; | 3067 midi_accessor_result_ = result; |
3051 } | 3068 } |
3052 | 3069 |
3053 void TestRunner::SimulateWebNotificationClick(const std::string& title, | 3070 void TestRunner::SimulateWebNotificationClick(const std::string& title, |
3054 int action_index) { | 3071 int action_index) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3304 } | 3321 } |
3305 | 3322 |
3306 void TestRunner::DidLosePointerLockInternal() { | 3323 void TestRunner::DidLosePointerLockInternal() { |
3307 bool was_locked = pointer_locked_; | 3324 bool was_locked = pointer_locked_; |
3308 pointer_locked_ = false; | 3325 pointer_locked_ = false; |
3309 if (was_locked) | 3326 if (was_locked) |
3310 web_view_->didLosePointerLock(); | 3327 web_view_->didLosePointerLock(); |
3311 } | 3328 } |
3312 | 3329 |
3313 } // namespace test_runner | 3330 } // namespace test_runner |
OLD | NEW |