| 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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 void SetAlwaysAcceptCookies(bool accept); | 289 void SetAlwaysAcceptCookies(bool accept); |
| 290 void SetWindowIsKey(bool value); | 290 void SetWindowIsKey(bool value); |
| 291 std::string PathToLocalResource(const std::string& path); | 291 std::string PathToLocalResource(const std::string& path); |
| 292 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); | 292 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); |
| 293 void EnableUseZoomForDSF(v8::Local<v8::Function> callback); | 293 void EnableUseZoomForDSF(v8::Local<v8::Function> callback); |
| 294 void SetColorProfile(const std::string& name, | 294 void SetColorProfile(const std::string& name, |
| 295 v8::Local<v8::Function> callback); | 295 v8::Local<v8::Function> callback); |
| 296 void SetPOSIXLocale(const std::string& locale); | 296 void SetPOSIXLocale(const std::string& locale); |
| 297 void SetMIDIAccessorResult(bool result); | 297 void SetMIDIAccessorResult(bool result); |
| 298 void SimulateWebNotificationClick(const std::string& title, int action_index); | 298 void SimulateWebNotificationClick(const std::string& title, int action_index); |
| 299 void SimulateWebNotificationClose(const std::string& title, bool by_user); |
| 299 void AddMockSpeechRecognitionResult(const std::string& transcript, | 300 void AddMockSpeechRecognitionResult(const std::string& transcript, |
| 300 double confidence); | 301 double confidence); |
| 301 void SetMockSpeechRecognitionError(const std::string& error, | 302 void SetMockSpeechRecognitionError(const std::string& error, |
| 302 const std::string& message); | 303 const std::string& message); |
| 303 bool WasMockSpeechRecognitionAborted(); | 304 bool WasMockSpeechRecognitionAborted(); |
| 304 void AddMockCredentialManagerResponse(const std::string& id, | 305 void AddMockCredentialManagerResponse(const std::string& id, |
| 305 const std::string& name, | 306 const std::string& name, |
| 306 const std::string& avatar, | 307 const std::string& avatar, |
| 307 const std::string& password); | 308 const std::string& password); |
| 308 void AddWebPageOverlay(); | 309 void AddWebPageOverlay(); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 .SetMethod("setBackingScaleFactor", | 566 .SetMethod("setBackingScaleFactor", |
| 566 &TestRunnerBindings::SetBackingScaleFactor) | 567 &TestRunnerBindings::SetBackingScaleFactor) |
| 567 .SetMethod("enableUseZoomForDSF", | 568 .SetMethod("enableUseZoomForDSF", |
| 568 &TestRunnerBindings::EnableUseZoomForDSF) | 569 &TestRunnerBindings::EnableUseZoomForDSF) |
| 569 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) | 570 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) |
| 570 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) | 571 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) |
| 571 .SetMethod("setMIDIAccessorResult", | 572 .SetMethod("setMIDIAccessorResult", |
| 572 &TestRunnerBindings::SetMIDIAccessorResult) | 573 &TestRunnerBindings::SetMIDIAccessorResult) |
| 573 .SetMethod("simulateWebNotificationClick", | 574 .SetMethod("simulateWebNotificationClick", |
| 574 &TestRunnerBindings::SimulateWebNotificationClick) | 575 &TestRunnerBindings::SimulateWebNotificationClick) |
| 576 .SetMethod("simulateWebNotificationClose", |
| 577 &TestRunnerBindings::SimulateWebNotificationClose) |
| 575 .SetMethod("addMockSpeechRecognitionResult", | 578 .SetMethod("addMockSpeechRecognitionResult", |
| 576 &TestRunnerBindings::AddMockSpeechRecognitionResult) | 579 &TestRunnerBindings::AddMockSpeechRecognitionResult) |
| 577 .SetMethod("setMockSpeechRecognitionError", | 580 .SetMethod("setMockSpeechRecognitionError", |
| 578 &TestRunnerBindings::SetMockSpeechRecognitionError) | 581 &TestRunnerBindings::SetMockSpeechRecognitionError) |
| 579 .SetMethod("wasMockSpeechRecognitionAborted", | 582 .SetMethod("wasMockSpeechRecognitionAborted", |
| 580 &TestRunnerBindings::WasMockSpeechRecognitionAborted) | 583 &TestRunnerBindings::WasMockSpeechRecognitionAborted) |
| 581 .SetMethod("addMockCredentialManagerResponse", | 584 .SetMethod("addMockCredentialManagerResponse", |
| 582 &TestRunnerBindings::AddMockCredentialManagerResponse) | 585 &TestRunnerBindings::AddMockCredentialManagerResponse) |
| 583 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) | 586 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) |
| 584 .SetMethod("removeWebPageOverlay", | 587 .SetMethod("removeWebPageOverlay", |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 runner_->SetMIDIAccessorResult(result); | 1416 runner_->SetMIDIAccessorResult(result); |
| 1414 } | 1417 } |
| 1415 | 1418 |
| 1416 void TestRunnerBindings::SimulateWebNotificationClick(const std::string& title, | 1419 void TestRunnerBindings::SimulateWebNotificationClick(const std::string& title, |
| 1417 int action_index) { | 1420 int action_index) { |
| 1418 if (!runner_) | 1421 if (!runner_) |
| 1419 return; | 1422 return; |
| 1420 runner_->SimulateWebNotificationClick(title, action_index); | 1423 runner_->SimulateWebNotificationClick(title, action_index); |
| 1421 } | 1424 } |
| 1422 | 1425 |
| 1426 void TestRunnerBindings::SimulateWebNotificationClose(const std::string& title, |
| 1427 bool by_user) { |
| 1428 if (!runner_) |
| 1429 return; |
| 1430 runner_->SimulateWebNotificationClose(title, by_user); |
| 1431 } |
| 1432 |
| 1423 void TestRunnerBindings::AddMockSpeechRecognitionResult( | 1433 void TestRunnerBindings::AddMockSpeechRecognitionResult( |
| 1424 const std::string& transcript, double confidence) { | 1434 const std::string& transcript, double confidence) { |
| 1425 if (runner_) | 1435 if (runner_) |
| 1426 runner_->AddMockSpeechRecognitionResult(transcript, confidence); | 1436 runner_->AddMockSpeechRecognitionResult(transcript, confidence); |
| 1427 } | 1437 } |
| 1428 | 1438 |
| 1429 void TestRunnerBindings::SetMockSpeechRecognitionError( | 1439 void TestRunnerBindings::SetMockSpeechRecognitionError( |
| 1430 const std::string& error, const std::string& message) { | 1440 const std::string& error, const std::string& message) { |
| 1431 if (runner_) | 1441 if (runner_) |
| 1432 runner_->SetMockSpeechRecognitionError(error, message); | 1442 runner_->SetMockSpeechRecognitionError(error, message); |
| (...skipping 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 | 2991 |
| 2982 void TestRunner::SetMIDIAccessorResult(bool result) { | 2992 void TestRunner::SetMIDIAccessorResult(bool result) { |
| 2983 midi_accessor_result_ = result; | 2993 midi_accessor_result_ = result; |
| 2984 } | 2994 } |
| 2985 | 2995 |
| 2986 void TestRunner::SimulateWebNotificationClick(const std::string& title, | 2996 void TestRunner::SimulateWebNotificationClick(const std::string& title, |
| 2987 int action_index) { | 2997 int action_index) { |
| 2988 delegate_->SimulateWebNotificationClick(title, action_index); | 2998 delegate_->SimulateWebNotificationClick(title, action_index); |
| 2989 } | 2999 } |
| 2990 | 3000 |
| 3001 void TestRunner::SimulateWebNotificationClose(const std::string& title, |
| 3002 bool by_user) { |
| 3003 delegate_->SimulateWebNotificationClose(title, by_user); |
| 3004 } |
| 3005 |
| 2991 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, | 3006 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, |
| 2992 double confidence) { | 3007 double confidence) { |
| 2993 proxy_->GetSpeechRecognizerMock()->AddMockResult( | 3008 proxy_->GetSpeechRecognizerMock()->AddMockResult( |
| 2994 WebString::fromUTF8(transcript), confidence); | 3009 WebString::fromUTF8(transcript), confidence); |
| 2995 } | 3010 } |
| 2996 | 3011 |
| 2997 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, | 3012 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, |
| 2998 const std::string& message) { | 3013 const std::string& message) { |
| 2999 proxy_->GetSpeechRecognizerMock()->SetError(WebString::fromUTF8(error), | 3014 proxy_->GetSpeechRecognizerMock()->SetError(WebString::fromUTF8(error), |
| 3000 WebString::fromUTF8(message)); | 3015 WebString::fromUTF8(message)); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3213 } | 3228 } |
| 3214 | 3229 |
| 3215 void TestRunner::DidLosePointerLockInternal() { | 3230 void TestRunner::DidLosePointerLockInternal() { |
| 3216 bool was_locked = pointer_locked_; | 3231 bool was_locked = pointer_locked_; |
| 3217 pointer_locked_ = false; | 3232 pointer_locked_ = false; |
| 3218 if (was_locked) | 3233 if (was_locked) |
| 3219 web_view_->didLosePointerLock(); | 3234 web_view_->didLosePointerLock(); |
| 3220 } | 3235 } |
| 3221 | 3236 |
| 3222 } // namespace test_runner | 3237 } // namespace test_runner |
| OLD | NEW |