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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(const std::string& title); |
277 void SimulateWebNotificationActionClick(const std::string& title, | |
Peter Beverloo
2015/08/04 21:08:33
Can we overload methods here? We shouldn't have tw
johnme
2015/08/05 13:51:27
Done, using gin::Arguments*.
| |
278 int action_index); | |
277 void AddMockSpeechRecognitionResult(const std::string& transcript, | 279 void AddMockSpeechRecognitionResult(const std::string& transcript, |
278 double confidence); | 280 double confidence); |
279 void SetMockSpeechRecognitionError(const std::string& error, | 281 void SetMockSpeechRecognitionError(const std::string& error, |
280 const std::string& message); | 282 const std::string& message); |
281 bool WasMockSpeechRecognitionAborted(); | 283 bool WasMockSpeechRecognitionAborted(); |
282 void AddMockCredentialManagerResponse(const std::string& id, | 284 void AddMockCredentialManagerResponse(const std::string& id, |
283 const std::string& name, | 285 const std::string& name, |
284 const std::string& avatar, | 286 const std::string& avatar, |
285 const std::string& password); | 287 const std::string& password); |
286 void AddWebPageOverlay(); | 288 void AddWebPageOverlay(); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 .SetMethod("pathToLocalResource", | 537 .SetMethod("pathToLocalResource", |
536 &TestRunnerBindings::PathToLocalResource) | 538 &TestRunnerBindings::PathToLocalResource) |
537 .SetMethod("setBackingScaleFactor", | 539 .SetMethod("setBackingScaleFactor", |
538 &TestRunnerBindings::SetBackingScaleFactor) | 540 &TestRunnerBindings::SetBackingScaleFactor) |
539 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) | 541 .SetMethod("setColorProfile", &TestRunnerBindings::SetColorProfile) |
540 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) | 542 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) |
541 .SetMethod("setMIDIAccessorResult", | 543 .SetMethod("setMIDIAccessorResult", |
542 &TestRunnerBindings::SetMIDIAccessorResult) | 544 &TestRunnerBindings::SetMIDIAccessorResult) |
543 .SetMethod("simulateWebNotificationClick", | 545 .SetMethod("simulateWebNotificationClick", |
544 &TestRunnerBindings::SimulateWebNotificationClick) | 546 &TestRunnerBindings::SimulateWebNotificationClick) |
547 .SetMethod("simulateWebNotificationActionClick", | |
548 &TestRunnerBindings::SimulateWebNotificationActionClick) | |
545 .SetMethod("addMockSpeechRecognitionResult", | 549 .SetMethod("addMockSpeechRecognitionResult", |
546 &TestRunnerBindings::AddMockSpeechRecognitionResult) | 550 &TestRunnerBindings::AddMockSpeechRecognitionResult) |
547 .SetMethod("setMockSpeechRecognitionError", | 551 .SetMethod("setMockSpeechRecognitionError", |
548 &TestRunnerBindings::SetMockSpeechRecognitionError) | 552 &TestRunnerBindings::SetMockSpeechRecognitionError) |
549 .SetMethod("wasMockSpeechRecognitionAborted", | 553 .SetMethod("wasMockSpeechRecognitionAborted", |
550 &TestRunnerBindings::WasMockSpeechRecognitionAborted) | 554 &TestRunnerBindings::WasMockSpeechRecognitionAborted) |
551 .SetMethod("addMockCredentialManagerResponse", | 555 .SetMethod("addMockCredentialManagerResponse", |
552 &TestRunnerBindings::AddMockCredentialManagerResponse) | 556 &TestRunnerBindings::AddMockCredentialManagerResponse) |
553 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) | 557 .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) |
554 .SetMethod("removeWebPageOverlay", | 558 .SetMethod("removeWebPageOverlay", |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1339 } | 1343 } |
1340 | 1344 |
1341 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { | 1345 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { |
1342 if (runner_) | 1346 if (runner_) |
1343 runner_->SetMIDIAccessorResult(result); | 1347 runner_->SetMIDIAccessorResult(result); |
1344 } | 1348 } |
1345 | 1349 |
1346 void TestRunnerBindings::SimulateWebNotificationClick( | 1350 void TestRunnerBindings::SimulateWebNotificationClick( |
1347 const std::string& title) { | 1351 const std::string& title) { |
1348 if (runner_) | 1352 if (runner_) |
1349 runner_->SimulateWebNotificationClick(title); | 1353 runner_->SimulateWebNotificationClick(title, -1 /* action_index */); |
1354 } | |
1355 | |
1356 void TestRunnerBindings::SimulateWebNotificationActionClick( | |
1357 const std::string& title, int action_index) { | |
1358 if (runner_) | |
1359 runner_->SimulateWebNotificationClick(title, action_index); | |
1350 } | 1360 } |
1351 | 1361 |
1352 void TestRunnerBindings::AddMockSpeechRecognitionResult( | 1362 void TestRunnerBindings::AddMockSpeechRecognitionResult( |
1353 const std::string& transcript, double confidence) { | 1363 const std::string& transcript, double confidence) { |
1354 if (runner_) | 1364 if (runner_) |
1355 runner_->AddMockSpeechRecognitionResult(transcript, confidence); | 1365 runner_->AddMockSpeechRecognitionResult(transcript, confidence); |
1356 } | 1366 } |
1357 | 1367 |
1358 void TestRunnerBindings::SetMockSpeechRecognitionError( | 1368 void TestRunnerBindings::SetMockSpeechRecognitionError( |
1359 const std::string& error, const std::string& message) { | 1369 const std::string& error, const std::string& message) { |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2847 } | 2857 } |
2848 | 2858 |
2849 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2859 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
2850 delegate_->SetLocale(locale); | 2860 delegate_->SetLocale(locale); |
2851 } | 2861 } |
2852 | 2862 |
2853 void TestRunner::SetMIDIAccessorResult(bool result) { | 2863 void TestRunner::SetMIDIAccessorResult(bool result) { |
2854 midi_accessor_result_ = result; | 2864 midi_accessor_result_ = result; |
2855 } | 2865 } |
2856 | 2866 |
2857 void TestRunner::SimulateWebNotificationClick(const std::string& title) { | 2867 void TestRunner::SimulateWebNotificationClick(const std::string& title, |
2858 delegate_->SimulateWebNotificationClick(title); | 2868 int action_index) { |
2869 delegate_->SimulateWebNotificationClick(title, action_index); | |
2859 } | 2870 } |
2860 | 2871 |
2861 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, | 2872 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, |
2862 double confidence) { | 2873 double confidence) { |
2863 proxy_->GetSpeechRecognizerMock()->AddMockResult( | 2874 proxy_->GetSpeechRecognizerMock()->AddMockResult( |
2864 WebString::fromUTF8(transcript), confidence); | 2875 WebString::fromUTF8(transcript), confidence); |
2865 } | 2876 } |
2866 | 2877 |
2867 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, | 2878 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, |
2868 const std::string& message) { | 2879 const std::string& message) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3061 } | 3072 } |
3062 | 3073 |
3063 void TestRunner::DidLosePointerLockInternal() { | 3074 void TestRunner::DidLosePointerLockInternal() { |
3064 bool was_locked = pointer_locked_; | 3075 bool was_locked = pointer_locked_; |
3065 pointer_locked_ = false; | 3076 pointer_locked_ = false; |
3066 if (was_locked) | 3077 if (was_locked) |
3067 web_view_->didLosePointerLock(); | 3078 web_view_->didLosePointerLock(); |
3068 } | 3079 } |
3069 | 3080 |
3070 } // namespace test_runner | 3081 } // namespace test_runner |
OLD | NEW |