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 if (!args->GetNext(&title)) { | |
1351 args->ThrowError(); | |
1352 return; | |
1353 } | |
1354 int action_index = -1; | |
1355 if (!args->PeekNext().IsEmpty()) | |
1356 args->GetNext(&action_index); | |
jochen (gone - plz use gerrit)
2015/08/05 15:09:16
what if the 2nd parameter isn't an integer? should
johnme
2015/08/06 18:25:47
Done (oddly, none of the other methods taking gin:
| |
1357 runner_->SimulateWebNotificationClick(title, action_index); | |
1350 } | 1358 } |
1351 | 1359 |
1352 void TestRunnerBindings::AddMockSpeechRecognitionResult( | 1360 void TestRunnerBindings::AddMockSpeechRecognitionResult( |
1353 const std::string& transcript, double confidence) { | 1361 const std::string& transcript, double confidence) { |
1354 if (runner_) | 1362 if (runner_) |
1355 runner_->AddMockSpeechRecognitionResult(transcript, confidence); | 1363 runner_->AddMockSpeechRecognitionResult(transcript, confidence); |
1356 } | 1364 } |
1357 | 1365 |
1358 void TestRunnerBindings::SetMockSpeechRecognitionError( | 1366 void TestRunnerBindings::SetMockSpeechRecognitionError( |
1359 const std::string& error, const std::string& message) { | 1367 const std::string& error, const std::string& message) { |
(...skipping 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2847 } | 2855 } |
2848 | 2856 |
2849 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2857 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
2850 delegate_->SetLocale(locale); | 2858 delegate_->SetLocale(locale); |
2851 } | 2859 } |
2852 | 2860 |
2853 void TestRunner::SetMIDIAccessorResult(bool result) { | 2861 void TestRunner::SetMIDIAccessorResult(bool result) { |
2854 midi_accessor_result_ = result; | 2862 midi_accessor_result_ = result; |
2855 } | 2863 } |
2856 | 2864 |
2857 void TestRunner::SimulateWebNotificationClick(const std::string& title) { | 2865 void TestRunner::SimulateWebNotificationClick(const std::string& title, |
2858 delegate_->SimulateWebNotificationClick(title); | 2866 int action_index) { |
2867 delegate_->SimulateWebNotificationClick(title, action_index); | |
2859 } | 2868 } |
2860 | 2869 |
2861 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, | 2870 void TestRunner::AddMockSpeechRecognitionResult(const std::string& transcript, |
2862 double confidence) { | 2871 double confidence) { |
2863 proxy_->GetSpeechRecognizerMock()->AddMockResult( | 2872 proxy_->GetSpeechRecognizerMock()->AddMockResult( |
2864 WebString::fromUTF8(transcript), confidence); | 2873 WebString::fromUTF8(transcript), confidence); |
2865 } | 2874 } |
2866 | 2875 |
2867 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, | 2876 void TestRunner::SetMockSpeechRecognitionError(const std::string& error, |
2868 const std::string& message) { | 2877 const std::string& message) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3061 } | 3070 } |
3062 | 3071 |
3063 void TestRunner::DidLosePointerLockInternal() { | 3072 void TestRunner::DidLosePointerLockInternal() { |
3064 bool was_locked = pointer_locked_; | 3073 bool was_locked = pointer_locked_; |
3065 pointer_locked_ = false; | 3074 pointer_locked_ = false; |
3066 if (was_locked) | 3075 if (was_locked) |
3067 web_view_->didLosePointerLock(); | 3076 web_view_->didLosePointerLock(); |
3068 } | 3077 } |
3069 | 3078 |
3070 } // namespace test_runner | 3079 } // namespace test_runner |
OLD | NEW |