| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 void QueueReload(); | 241 void QueueReload(); |
| 242 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, | 242 void RemoveOriginAccessWhitelistEntry(const std::string& source_origin, |
| 243 const std::string& destination_protocol, | 243 const std::string& destination_protocol, |
| 244 const std::string& destination_host, | 244 const std::string& destination_host, |
| 245 bool allow_destination_subdomains); | 245 bool allow_destination_subdomains); |
| 246 void RemoveWebPageOverlay(); | 246 void RemoveWebPageOverlay(); |
| 247 void ResetDeviceLight(); | 247 void ResetDeviceLight(); |
| 248 void ResetTestHelperControllers(); | 248 void ResetTestHelperControllers(); |
| 249 void ResolveBeforeInstallPromptPromise(int request_id, | 249 void ResolveBeforeInstallPromptPromise(int request_id, |
| 250 const std::string& platform); | 250 const std::string& platform); |
| 251 void RunIdleTasks(v8::Local<v8::Function> callback); |
| 251 void SendBluetoothManualChooserEvent(const std::string& event, | 252 void SendBluetoothManualChooserEvent(const std::string& event, |
| 252 const std::string& argument); | 253 const std::string& argument); |
| 253 void SetAcceptLanguages(const std::string& accept_languages); | 254 void SetAcceptLanguages(const std::string& accept_languages); |
| 254 void SetAllowDisplayOfInsecureContent(bool allowed); | 255 void SetAllowDisplayOfInsecureContent(bool allowed); |
| 255 void SetAllowFileAccessFromFileURLs(bool allow); | 256 void SetAllowFileAccessFromFileURLs(bool allow); |
| 256 void SetAllowRunningOfInsecureContent(bool allowed); | 257 void SetAllowRunningOfInsecureContent(bool allowed); |
| 257 void SetAllowUniversalAccessFromFileURLs(bool allow); | 258 void SetAllowUniversalAccessFromFileURLs(bool allow); |
| 258 void SetAlwaysAcceptCookies(bool accept); | 259 void SetAlwaysAcceptCookies(bool accept); |
| 259 void SetAudioData(const gin::ArrayBufferView& view); | 260 void SetAudioData(const gin::ArrayBufferView& view); |
| 260 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); | 261 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) | 548 .SetMethod("queueReload", &TestRunnerBindings::QueueReload) |
| 548 .SetMethod("removeOriginAccessWhitelistEntry", | 549 .SetMethod("removeOriginAccessWhitelistEntry", |
| 549 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) | 550 &TestRunnerBindings::RemoveOriginAccessWhitelistEntry) |
| 550 .SetMethod("removeWebPageOverlay", | 551 .SetMethod("removeWebPageOverlay", |
| 551 &TestRunnerBindings::RemoveWebPageOverlay) | 552 &TestRunnerBindings::RemoveWebPageOverlay) |
| 552 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) | 553 .SetMethod("resetDeviceLight", &TestRunnerBindings::ResetDeviceLight) |
| 553 .SetMethod("resetTestHelperControllers", | 554 .SetMethod("resetTestHelperControllers", |
| 554 &TestRunnerBindings::ResetTestHelperControllers) | 555 &TestRunnerBindings::ResetTestHelperControllers) |
| 555 .SetMethod("resolveBeforeInstallPromptPromise", | 556 .SetMethod("resolveBeforeInstallPromptPromise", |
| 556 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) | 557 &TestRunnerBindings::ResolveBeforeInstallPromptPromise) |
| 558 .SetMethod("runIdleTasks", |
| 559 &TestRunnerBindings::RunIdleTasks) |
| 557 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) | 560 .SetMethod("selectionAsMarkup", &TestRunnerBindings::SelectionAsMarkup) |
| 558 | 561 |
| 559 // The Bluetooth functions are specified at | 562 // The Bluetooth functions are specified at |
| 560 // https://webbluetoothcg.github.io/web-bluetooth/tests/. | 563 // https://webbluetoothcg.github.io/web-bluetooth/tests/. |
| 561 .SetMethod("sendBluetoothManualChooserEvent", | 564 .SetMethod("sendBluetoothManualChooserEvent", |
| 562 &TestRunnerBindings::SendBluetoothManualChooserEvent) | 565 &TestRunnerBindings::SendBluetoothManualChooserEvent) |
| 563 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) | 566 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) |
| 564 .SetMethod("setAllowDisplayOfInsecureContent", | 567 .SetMethod("setAllowDisplayOfInsecureContent", |
| 565 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) | 568 &TestRunnerBindings::SetAllowDisplayOfInsecureContent) |
| 566 .SetMethod("setAllowFileAccessFromFileURLs", | 569 .SetMethod("setAllowFileAccessFromFileURLs", |
| (...skipping 988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 | 1558 |
| 1556 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( | 1559 void TestRunnerBindings::ResolveBeforeInstallPromptPromise( |
| 1557 int request_id, | 1560 int request_id, |
| 1558 const std::string& platform) { | 1561 const std::string& platform) { |
| 1559 if (!runner_) | 1562 if (!runner_) |
| 1560 return; | 1563 return; |
| 1561 | 1564 |
| 1562 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); | 1565 runner_->ResolveBeforeInstallPromptPromise(request_id, platform); |
| 1563 } | 1566 } |
| 1564 | 1567 |
| 1568 void TestRunnerBindings::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 1569 if (!runner_) |
| 1570 return; |
| 1571 runner_->RunIdleTasks(callback); |
| 1572 } |
| 1573 |
| 1565 std::string TestRunnerBindings::PlatformName() { | 1574 std::string TestRunnerBindings::PlatformName() { |
| 1566 if (runner_) | 1575 if (runner_) |
| 1567 return runner_->platform_name_; | 1576 return runner_->platform_name_; |
| 1568 return std::string(); | 1577 return std::string(); |
| 1569 } | 1578 } |
| 1570 | 1579 |
| 1571 std::string TestRunnerBindings::TooltipText() { | 1580 std::string TestRunnerBindings::TooltipText() { |
| 1572 if (runner_) | 1581 if (runner_) |
| 1573 return runner_->tooltip_text_; | 1582 return runner_->tooltip_text_; |
| 1574 return std::string(); | 1583 return std::string(); |
| (...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3014 base::Bind(&TestRunner::DispatchBeforeInstallPromptCallback, | 3023 base::Bind(&TestRunner::DispatchBeforeInstallPromptCallback, |
| 3015 weak_factory_.GetWeakPtr(), base::Passed(&task))); | 3024 weak_factory_.GetWeakPtr(), base::Passed(&task))); |
| 3016 } | 3025 } |
| 3017 | 3026 |
| 3018 void TestRunner::ResolveBeforeInstallPromptPromise( | 3027 void TestRunner::ResolveBeforeInstallPromptPromise( |
| 3019 int request_id, | 3028 int request_id, |
| 3020 const std::string& platform) { | 3029 const std::string& platform) { |
| 3021 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); | 3030 test_interfaces_->GetAppBannerClient()->ResolvePromise(request_id, platform); |
| 3022 } | 3031 } |
| 3023 | 3032 |
| 3033 void TestRunner::RunIdleTasks(v8::Local<v8::Function> callback) { |
| 3034 scoped_ptr<InvokeCallbackTask> task(new InvokeCallbackTask(this, callback)); |
| 3035 delegate_->RunIdleTasks( |
| 3036 base::Bind(&TestRunner::InvokeCallback, |
| 3037 weak_factory_.GetWeakPtr(), |
| 3038 base::Passed(&task))); |
| 3039 } |
| 3040 |
| 3024 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 3041 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
| 3025 delegate_->SetLocale(locale); | 3042 delegate_->SetLocale(locale); |
| 3026 } | 3043 } |
| 3027 | 3044 |
| 3028 void TestRunner::SetMIDIAccessorResult(bool result) { | 3045 void TestRunner::SetMIDIAccessorResult(bool result) { |
| 3029 midi_accessor_result_ = result; | 3046 midi_accessor_result_ = result; |
| 3030 } | 3047 } |
| 3031 | 3048 |
| 3032 void TestRunner::SimulateWebNotificationClick(const std::string& title, | 3049 void TestRunner::SimulateWebNotificationClick(const std::string& title, |
| 3033 int action_index) { | 3050 int action_index) { |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3285 } | 3302 } |
| 3286 | 3303 |
| 3287 void TestRunner::DidLosePointerLockInternal() { | 3304 void TestRunner::DidLosePointerLockInternal() { |
| 3288 bool was_locked = pointer_locked_; | 3305 bool was_locked = pointer_locked_; |
| 3289 pointer_locked_ = false; | 3306 pointer_locked_ = false; |
| 3290 if (was_locked) | 3307 if (was_locked) |
| 3291 web_view_->didLosePointerLock(); | 3308 web_view_->didLosePointerLock(); |
| 3292 } | 3309 } |
| 3293 | 3310 |
| 3294 } // namespace test_runner | 3311 } // namespace test_runner |
| OLD | NEW |