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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 void SetDatabaseQuota(int quota); | 288 void SetDatabaseQuota(int quota); |
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(gin::Arguments* args); | 298 void SimulateWebNotificationClick(const std::string& title, int action_index); |
299 void AddMockSpeechRecognitionResult(const std::string& transcript, | 299 void AddMockSpeechRecognitionResult(const std::string& transcript, |
300 double confidence); | 300 double confidence); |
301 void SetMockSpeechRecognitionError(const std::string& error, | 301 void SetMockSpeechRecognitionError(const std::string& error, |
302 const std::string& message); | 302 const std::string& message); |
303 bool WasMockSpeechRecognitionAborted(); | 303 bool WasMockSpeechRecognitionAborted(); |
304 void AddMockCredentialManagerResponse(const std::string& id, | 304 void AddMockCredentialManagerResponse(const std::string& id, |
305 const std::string& name, | 305 const std::string& name, |
306 const std::string& avatar, | 306 const std::string& avatar, |
307 const std::string& password); | 307 const std::string& password); |
308 void AddWebPageOverlay(); | 308 void AddWebPageOverlay(); |
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { | 1406 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { |
1407 if (runner_) | 1407 if (runner_) |
1408 runner_->SetPOSIXLocale(locale); | 1408 runner_->SetPOSIXLocale(locale); |
1409 } | 1409 } |
1410 | 1410 |
1411 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { | 1411 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { |
1412 if (runner_) | 1412 if (runner_) |
1413 runner_->SetMIDIAccessorResult(result); | 1413 runner_->SetMIDIAccessorResult(result); |
1414 } | 1414 } |
1415 | 1415 |
1416 void TestRunnerBindings::SimulateWebNotificationClick(gin::Arguments* args) { | 1416 void TestRunnerBindings::SimulateWebNotificationClick(const std::string& title, |
| 1417 int action_index) { |
1417 if (!runner_) | 1418 if (!runner_) |
1418 return; | 1419 return; |
1419 std::string title; | 1420 runner_->SimulateWebNotificationClick(title, action_index); |
1420 int action_index = -1; | |
1421 if (args->GetNext(&title) && | |
1422 (args->PeekNext().IsEmpty() || args->GetNext(&action_index))) | |
1423 runner_->SimulateWebNotificationClick(title, action_index); | |
1424 else | |
1425 args->ThrowError(); | |
1426 } | 1421 } |
1427 | 1422 |
1428 void TestRunnerBindings::AddMockSpeechRecognitionResult( | 1423 void TestRunnerBindings::AddMockSpeechRecognitionResult( |
1429 const std::string& transcript, double confidence) { | 1424 const std::string& transcript, double confidence) { |
1430 if (runner_) | 1425 if (runner_) |
1431 runner_->AddMockSpeechRecognitionResult(transcript, confidence); | 1426 runner_->AddMockSpeechRecognitionResult(transcript, confidence); |
1432 } | 1427 } |
1433 | 1428 |
1434 void TestRunnerBindings::SetMockSpeechRecognitionError( | 1429 void TestRunnerBindings::SetMockSpeechRecognitionError( |
1435 const std::string& error, const std::string& message) { | 1430 const std::string& error, const std::string& message) { |
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3218 } | 3213 } |
3219 | 3214 |
3220 void TestRunner::DidLosePointerLockInternal() { | 3215 void TestRunner::DidLosePointerLockInternal() { |
3221 bool was_locked = pointer_locked_; | 3216 bool was_locked = pointer_locked_; |
3222 pointer_locked_ = false; | 3217 pointer_locked_ = false; |
3223 if (was_locked) | 3218 if (was_locked) |
3224 web_view_->didLosePointerLock(); | 3219 web_view_->didLosePointerLock(); |
3225 } | 3220 } |
3226 | 3221 |
3227 } // namespace test_runner | 3222 } // namespace test_runner |
OLD | NEW |