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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 void ClearAllDatabases(); | 266 void ClearAllDatabases(); |
267 void SetDatabaseQuota(int quota); | 267 void SetDatabaseQuota(int quota); |
268 void SetAlwaysAcceptCookies(bool accept); | 268 void SetAlwaysAcceptCookies(bool accept); |
269 void SetWindowIsKey(bool value); | 269 void SetWindowIsKey(bool value); |
270 std::string PathToLocalResource(const std::string& path); | 270 std::string PathToLocalResource(const std::string& path); |
271 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); | 271 void SetBackingScaleFactor(double value, v8::Local<v8::Function> callback); |
272 void SetColorProfile(const std::string& name, | 272 void SetColorProfile(const std::string& name, |
273 v8::Local<v8::Function> callback); | 273 v8::Local<v8::Function> callback); |
274 void SetPOSIXLocale(const std::string& locale); | 274 void SetPOSIXLocale(const std::string& locale); |
275 void SetMIDIAccessorResult(bool result); | 275 void SetMIDIAccessorResult(bool result); |
276 void SimulateWebNotificationClick(const std::string& title); | 276 void SimulateWebNotificationClick(gin::Arguments* args); |
277 void AddMockSpeechRecognitionResult(const std::string& transcript, | 277 void AddMockSpeechRecognitionResult(const std::string& transcript, |
278 double confidence); | 278 double confidence); |
279 void SetMockSpeechRecognitionError(const std::string& error, | 279 void SetMockSpeechRecognitionError(const std::string& error, |
280 const std::string& message); | 280 const std::string& message); |
281 bool WasMockSpeechRecognitionAborted(); | 281 bool WasMockSpeechRecognitionAborted(); |
282 void AddMockCredentialManagerResponse(const std::string& id, | 282 void AddMockCredentialManagerResponse(const std::string& id, |
283 const std::string& name, | 283 const std::string& name, |
284 const std::string& avatar, | 284 const std::string& avatar, |
285 const std::string& password); | 285 const std::string& password); |
286 void AddWebPageOverlay(); | 286 void AddWebPageOverlay(); |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { | 1336 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { |
1337 if (runner_) | 1337 if (runner_) |
1338 runner_->SetPOSIXLocale(locale); | 1338 runner_->SetPOSIXLocale(locale); |
1339 } | 1339 } |
1340 | 1340 |
1341 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { | 1341 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { |
1342 if (runner_) | 1342 if (runner_) |
1343 runner_->SetMIDIAccessorResult(result); | 1343 runner_->SetMIDIAccessorResult(result); |
1344 } | 1344 } |
1345 | 1345 |
1346 void TestRunnerBindings::SimulateWebNotificationClick( | 1346 void TestRunnerBindings::SimulateWebNotificationClick(gin::Arguments* args) { |
1347 const std::string& title) { | 1347 if (!runner_) |
1348 if (runner_) | 1348 return; |
1349 runner_->SimulateWebNotificationClick(title); | 1349 std::string title; |
| 1350 int action_index = -1; |
| 1351 if (args->GetNext(&title) && |
| 1352 (args->PeekNext().IsEmpty() || args->GetNext(&action_index))) |
| 1353 runner_->SimulateWebNotificationClick(title, action_index); |
| 1354 else |
| 1355 args->ThrowError(); |
1350 } | 1356 } |
1351 | 1357 |
1352 void TestRunnerBindings::AddMockSpeechRecognitionResult( | 1358 void TestRunnerBindings::AddMockSpeechRecognitionResult( |
1353 const std::string& transcript, double confidence) { | 1359 const std::string& transcript, double confidence) { |
1354 if (runner_) | 1360 if (runner_) |
1355 runner_->AddMockSpeechRecognitionResult(transcript, confidence); | 1361 runner_->AddMockSpeechRecognitionResult(transcript, confidence); |
1356 } | 1362 } |
1357 | 1363 |
1358 void TestRunnerBindings::SetMockSpeechRecognitionError( | 1364 void TestRunnerBindings::SetMockSpeechRecognitionError( |
1359 const std::string& error, const std::string& message) { | 1365 const std::string& error, const std::string& message) { |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2847 } | 2853 } |
2848 | 2854 |
2849 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2855 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
2850 delegate_->SetLocale(locale); | 2856 delegate_->SetLocale(locale); |
2851 } | 2857 } |
2852 | 2858 |
2853 void TestRunner::SetMIDIAccessorResult(bool result) { | 2859 void TestRunner::SetMIDIAccessorResult(bool result) { |
2854 midi_accessor_result_ = result; | 2860 midi_accessor_result_ = result; |
2855 } | 2861 } |
2856 | 2862 |
2857 void TestRunner::SimulateWebNotificationClick(const std::string& title) { | 2863 void TestRunner::SimulateWebNotificationClick(const std::string& title, |
2858 delegate_->SimulateWebNotificationClick(title); | 2864 int action_index) { |
| 2865 delegate_->SimulateWebNotificationClick(title, action_index); |
2859 } | 2866 } |
2860 | 2867 |
2861 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, | 2868 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, |
2862 double confidence) { | 2869 double confidence) { |
2863 proxy_->GetSpeechRecognizerMock()->AddMockResult( | 2870 proxy_->GetSpeechRecognizerMock()->AddMockResult( |
2864 WebString::fromUTF8(transcript), confidence); | 2871 WebString::fromUTF8(transcript), confidence); |
2865 } | 2872 } |
2866 | 2873 |
2867 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, | 2874 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, |
2868 const std::string& message) { | 2875 const std::string& message) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3061 } | 3068 } |
3062 | 3069 |
3063 void TestRunner::DidLosePointerLockInternal() { | 3070 void TestRunner::DidLosePointerLockInternal() { |
3064 bool was_locked = pointer_locked_; | 3071 bool was_locked = pointer_locked_; |
3065 pointer_locked_ = false; | 3072 pointer_locked_ = false; |
3066 if (was_locked) | 3073 if (was_locked) |
3067 web_view_->didLosePointerLock(); | 3074 web_view_->didLosePointerLock(); |
3068 } | 3075 } |
3069 | 3076 |
3070 } // namespace test_runner | 3077 } // namespace test_runner |
OLD | NEW |