| 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 <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/test_runner/mock_credential_manager_client.h" | 10 #include "components/test_runner/mock_credential_manager_client.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 void LayoutAndPaintAsync(); | 288 void LayoutAndPaintAsync(); |
| 289 void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback); | 289 void LayoutAndPaintAsyncThen(v8::Local<v8::Function> callback); |
| 290 void GetManifestThen(v8::Local<v8::Function> callback); | 290 void GetManifestThen(v8::Local<v8::Function> callback); |
| 291 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); | 291 void CapturePixelsAsyncThen(v8::Local<v8::Function> callback); |
| 292 void CopyImageAtAndCapturePixelsAsyncThen(int x, | 292 void CopyImageAtAndCapturePixelsAsyncThen(int x, |
| 293 int y, | 293 int y, |
| 294 v8::Local<v8::Function> callback); | 294 v8::Local<v8::Function> callback); |
| 295 void SetCustomTextOutput(std::string output); | 295 void SetCustomTextOutput(std::string output); |
| 296 void SetViewSourceForFrame(const std::string& name, bool enabled); | 296 void SetViewSourceForFrame(const std::string& name, bool enabled); |
| 297 void SetBluetoothMockDataSet(const std::string& dataset_name); | 297 void SetBluetoothMockDataSet(const std::string& dataset_name); |
| 298 void SetBluetoothManualChooser(); |
| 299 std::vector<std::string> GetBluetoothManualChooserEvents(); |
| 300 void SendBluetoothManualChooserEvent(const std::string& event, |
| 301 const std::string& argument); |
| 298 void SetGeofencingMockProvider(bool service_available); | 302 void SetGeofencingMockProvider(bool service_available); |
| 299 void ClearGeofencingMockProvider(); | 303 void ClearGeofencingMockProvider(); |
| 300 void SetGeofencingMockPosition(double latitude, double longitude); | 304 void SetGeofencingMockPosition(double latitude, double longitude); |
| 301 void SetPermission(const std::string& name, | 305 void SetPermission(const std::string& name, |
| 302 const std::string& value, | 306 const std::string& value, |
| 303 const std::string& origin, | 307 const std::string& origin, |
| 304 const std::string& embedding_origin); | 308 const std::string& embedding_origin); |
| 305 void DispatchBeforeInstallPromptEvent( | 309 void DispatchBeforeInstallPromptEvent( |
| 306 int request_id, | 310 int request_id, |
| 307 const std::vector<std::string>& event_platforms, | 311 const std::vector<std::string>& event_platforms, |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 &TestRunnerBindings::LayoutAndPaintAsyncThen) | 563 &TestRunnerBindings::LayoutAndPaintAsyncThen) |
| 560 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) | 564 .SetMethod("getManifestThen", &TestRunnerBindings::GetManifestThen) |
| 561 .SetMethod("capturePixelsAsyncThen", | 565 .SetMethod("capturePixelsAsyncThen", |
| 562 &TestRunnerBindings::CapturePixelsAsyncThen) | 566 &TestRunnerBindings::CapturePixelsAsyncThen) |
| 563 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", | 567 .SetMethod("copyImageAtAndCapturePixelsAsyncThen", |
| 564 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) | 568 &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) |
| 565 .SetMethod("setCustomTextOutput", | 569 .SetMethod("setCustomTextOutput", |
| 566 &TestRunnerBindings::SetCustomTextOutput) | 570 &TestRunnerBindings::SetCustomTextOutput) |
| 567 .SetMethod("setViewSourceForFrame", | 571 .SetMethod("setViewSourceForFrame", |
| 568 &TestRunnerBindings::SetViewSourceForFrame) | 572 &TestRunnerBindings::SetViewSourceForFrame) |
| 573 // The 4 Bluetooth functions are specified at |
| 574 // https://webbluetoothcg.github.io/web-bluetooth/tests/. |
| 569 .SetMethod("setBluetoothMockDataSet", | 575 .SetMethod("setBluetoothMockDataSet", |
| 570 &TestRunnerBindings::SetBluetoothMockDataSet) | 576 &TestRunnerBindings::SetBluetoothMockDataSet) |
| 577 .SetMethod("setBluetoothManualChooser", |
| 578 &TestRunnerBindings::SetBluetoothManualChooser) |
| 579 .SetMethod("getBluetoothManualChooserEvents", |
| 580 &TestRunnerBindings::GetBluetoothManualChooserEvents) |
| 581 .SetMethod("sendBluetoothManualChooserEvent", |
| 582 &TestRunnerBindings::SendBluetoothManualChooserEvent) |
| 571 .SetMethod("forceNextWebGLContextCreationToFail", | 583 .SetMethod("forceNextWebGLContextCreationToFail", |
| 572 &TestRunnerBindings::ForceNextWebGLContextCreationToFail) | 584 &TestRunnerBindings::ForceNextWebGLContextCreationToFail) |
| 573 .SetMethod("forceNextDrawingBufferCreationToFail", | 585 .SetMethod("forceNextDrawingBufferCreationToFail", |
| 574 &TestRunnerBindings::ForceNextDrawingBufferCreationToFail) | 586 &TestRunnerBindings::ForceNextDrawingBufferCreationToFail) |
| 575 .SetMethod("setGeofencingMockProvider", | 587 .SetMethod("setGeofencingMockProvider", |
| 576 &TestRunnerBindings::SetGeofencingMockProvider) | 588 &TestRunnerBindings::SetGeofencingMockProvider) |
| 577 .SetMethod("clearGeofencingMockProvider", | 589 .SetMethod("clearGeofencingMockProvider", |
| 578 &TestRunnerBindings::ClearGeofencingMockProvider) | 590 &TestRunnerBindings::ClearGeofencingMockProvider) |
| 579 .SetMethod("setGeofencingMockPosition", | 591 .SetMethod("setGeofencingMockPosition", |
| 580 &TestRunnerBindings::SetGeofencingMockPosition) | 592 &TestRunnerBindings::SetGeofencingMockPosition) |
| (...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1326 const std::string& name, v8::Local<v8::Function> callback) { | 1338 const std::string& name, v8::Local<v8::Function> callback) { |
| 1327 if (runner_) | 1339 if (runner_) |
| 1328 runner_->SetColorProfile(name, callback); | 1340 runner_->SetColorProfile(name, callback); |
| 1329 } | 1341 } |
| 1330 | 1342 |
| 1331 void TestRunnerBindings::SetBluetoothMockDataSet(const std::string& name) { | 1343 void TestRunnerBindings::SetBluetoothMockDataSet(const std::string& name) { |
| 1332 if (runner_) | 1344 if (runner_) |
| 1333 runner_->SetBluetoothMockDataSet(name); | 1345 runner_->SetBluetoothMockDataSet(name); |
| 1334 } | 1346 } |
| 1335 | 1347 |
| 1348 void TestRunnerBindings::SetBluetoothManualChooser() { |
| 1349 if (runner_) |
| 1350 runner_->SetBluetoothManualChooser(); |
| 1351 } |
| 1352 |
| 1353 std::vector<std::string> TestRunnerBindings::GetBluetoothManualChooserEvents() { |
| 1354 if (runner_) |
| 1355 return runner_->GetBluetoothManualChooserEvents(); |
| 1356 return std::vector<std::string>(1, "No Test Runner"); |
| 1357 } |
| 1358 |
| 1359 void TestRunnerBindings::SendBluetoothManualChooserEvent( |
| 1360 const std::string& event, |
| 1361 const std::string& argument) { |
| 1362 if (runner_) |
| 1363 runner_->SendBluetoothManualChooserEvent(event, argument); |
| 1364 } |
| 1365 |
| 1336 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { | 1366 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { |
| 1337 if (runner_) | 1367 if (runner_) |
| 1338 runner_->SetPOSIXLocale(locale); | 1368 runner_->SetPOSIXLocale(locale); |
| 1339 } | 1369 } |
| 1340 | 1370 |
| 1341 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { | 1371 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { |
| 1342 if (runner_) | 1372 if (runner_) |
| 1343 runner_->SetMIDIAccessorResult(result); | 1373 runner_->SetMIDIAccessorResult(result); |
| 1344 } | 1374 } |
| 1345 | 1375 |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2805 void TestRunner::SetColorProfile(const std::string& name, | 2835 void TestRunner::SetColorProfile(const std::string& name, |
| 2806 v8::Local<v8::Function> callback) { | 2836 v8::Local<v8::Function> callback) { |
| 2807 delegate_->SetDeviceColorProfile(name); | 2837 delegate_->SetDeviceColorProfile(name); |
| 2808 delegate_->PostTask(new InvokeCallbackTask(this, callback)); | 2838 delegate_->PostTask(new InvokeCallbackTask(this, callback)); |
| 2809 } | 2839 } |
| 2810 | 2840 |
| 2811 void TestRunner::SetBluetoothMockDataSet(const std::string& name) { | 2841 void TestRunner::SetBluetoothMockDataSet(const std::string& name) { |
| 2812 delegate_->SetBluetoothMockDataSet(name); | 2842 delegate_->SetBluetoothMockDataSet(name); |
| 2813 } | 2843 } |
| 2814 | 2844 |
| 2845 void TestRunner::SetBluetoothManualChooser() { |
| 2846 delegate_->SetBluetoothManualChooser(); |
| 2847 } |
| 2848 |
| 2849 std::vector<std::string> TestRunner::GetBluetoothManualChooserEvents() { |
| 2850 return delegate_->GetBluetoothManualChooserEvents(); |
| 2851 } |
| 2852 |
| 2853 void TestRunner::SendBluetoothManualChooserEvent(const std::string& event, |
| 2854 const std::string& argument) { |
| 2855 delegate_->SendBluetoothManualChooserEvent(event, argument); |
| 2856 } |
| 2857 |
| 2815 void TestRunner::SetGeofencingMockProvider(bool service_available) { | 2858 void TestRunner::SetGeofencingMockProvider(bool service_available) { |
| 2816 delegate_->SetGeofencingMockProvider(service_available); | 2859 delegate_->SetGeofencingMockProvider(service_available); |
| 2817 } | 2860 } |
| 2818 | 2861 |
| 2819 void TestRunner::ClearGeofencingMockProvider() { | 2862 void TestRunner::ClearGeofencingMockProvider() { |
| 2820 delegate_->ClearGeofencingMockProvider(); | 2863 delegate_->ClearGeofencingMockProvider(); |
| 2821 } | 2864 } |
| 2822 | 2865 |
| 2823 void TestRunner::SetGeofencingMockPosition(double latitude, double longitude) { | 2866 void TestRunner::SetGeofencingMockPosition(double latitude, double longitude) { |
| 2824 delegate_->SetGeofencingMockPosition(latitude, longitude); | 2867 delegate_->SetGeofencingMockPosition(latitude, longitude); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3066 } | 3109 } |
| 3067 | 3110 |
| 3068 void TestRunner::DidLosePointerLockInternal() { | 3111 void TestRunner::DidLosePointerLockInternal() { |
| 3069 bool was_locked = pointer_locked_; | 3112 bool was_locked = pointer_locked_; |
| 3070 pointer_locked_ = false; | 3113 pointer_locked_ = false; |
| 3071 if (was_locked) | 3114 if (was_locked) |
| 3072 web_view_->didLosePointerLock(); | 3115 web_view_->didLosePointerLock(); |
| 3073 } | 3116 } |
| 3074 | 3117 |
| 3075 } // namespace test_runner | 3118 } // namespace test_runner |
| OLD | NEW |