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 "content/shell/renderer/test_runner/test_runner.h" | 5 #include "content/shell/renderer/test_runner/test_runner.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "content/shell/common/test_runner/WebPreferences.h" | 9 #include "content/shell/common/test_runner/WebPreferences.h" |
10 #include "content/shell/renderer/test_runner/MockWebSpeechInputController.h" | 10 #include "content/shell/renderer/test_runner/MockWebSpeechInputController.h" |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 bool IsChooserShown(); | 227 bool IsChooserShown(); |
228 void EvaluateInWebInspector(int call_id, const std::string& script); | 228 void EvaluateInWebInspector(int call_id, const std::string& script); |
229 void ClearAllDatabases(); | 229 void ClearAllDatabases(); |
230 void SetDatabaseQuota(int quota); | 230 void SetDatabaseQuota(int quota); |
231 void SetAlwaysAcceptCookies(bool accept); | 231 void SetAlwaysAcceptCookies(bool accept); |
232 void SetWindowIsKey(bool value); | 232 void SetWindowIsKey(bool value); |
233 std::string PathToLocalResource(const std::string& path); | 233 std::string PathToLocalResource(const std::string& path); |
234 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); | 234 void SetBackingScaleFactor(double value, v8::Handle<v8::Function> callback); |
235 void SetPOSIXLocale(const std::string& locale); | 235 void SetPOSIXLocale(const std::string& locale); |
236 void SetMIDIAccessorResult(bool result); | 236 void SetMIDIAccessorResult(bool result); |
237 void SetMIDISysExPermission(bool value); | 237 void SetMIDISysexPermission(bool value); |
238 void GrantWebNotificationPermission(gin::Arguments* args); | 238 void GrantWebNotificationPermission(gin::Arguments* args); |
239 bool SimulateWebNotificationClick(const std::string& value); | 239 bool SimulateWebNotificationClick(const std::string& value); |
240 void AddMockSpeechInputResult(const std::string& result, | 240 void AddMockSpeechInputResult(const std::string& result, |
241 double confidence, | 241 double confidence, |
242 const std::string& language); | 242 const std::string& language); |
243 void SetMockSpeechInputDumpRect(bool value); | 243 void SetMockSpeechInputDumpRect(bool value); |
244 void AddMockSpeechRecognitionResult(const std::string& transcript, | 244 void AddMockSpeechRecognitionResult(const std::string& transcript, |
245 double confidence); | 245 double confidence); |
246 void SetMockSpeechRecognitionError(const std::string& error, | 246 void SetMockSpeechRecognitionError(const std::string& error, |
247 const std::string& message); | 247 const std::string& message); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 .SetMethod("setAlwaysAcceptCookies", | 453 .SetMethod("setAlwaysAcceptCookies", |
454 &TestRunnerBindings::SetAlwaysAcceptCookies) | 454 &TestRunnerBindings::SetAlwaysAcceptCookies) |
455 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) | 455 .SetMethod("setWindowIsKey", &TestRunnerBindings::SetWindowIsKey) |
456 .SetMethod("pathToLocalResource", | 456 .SetMethod("pathToLocalResource", |
457 &TestRunnerBindings::PathToLocalResource) | 457 &TestRunnerBindings::PathToLocalResource) |
458 .SetMethod("setBackingScaleFactor", | 458 .SetMethod("setBackingScaleFactor", |
459 &TestRunnerBindings::SetBackingScaleFactor) | 459 &TestRunnerBindings::SetBackingScaleFactor) |
460 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) | 460 .SetMethod("setPOSIXLocale", &TestRunnerBindings::SetPOSIXLocale) |
461 .SetMethod("setMIDIAccessorResult", | 461 .SetMethod("setMIDIAccessorResult", |
462 &TestRunnerBindings::SetMIDIAccessorResult) | 462 &TestRunnerBindings::SetMIDIAccessorResult) |
463 .SetMethod("setMIDISysExPermission", | 463 .SetMethod("setMIDISysexPermission", |
464 &TestRunnerBindings::SetMIDISysExPermission) | 464 &TestRunnerBindings::SetMIDISysexPermission) |
465 .SetMethod("grantWebNotificationPermission", | 465 .SetMethod("grantWebNotificationPermission", |
466 &TestRunnerBindings::GrantWebNotificationPermission) | 466 &TestRunnerBindings::GrantWebNotificationPermission) |
467 .SetMethod("simulateWebNotificationClick", | 467 .SetMethod("simulateWebNotificationClick", |
468 &TestRunnerBindings::SimulateWebNotificationClick) | 468 &TestRunnerBindings::SimulateWebNotificationClick) |
469 .SetMethod("addMockSpeechInputResult", | 469 .SetMethod("addMockSpeechInputResult", |
470 &TestRunnerBindings::AddMockSpeechInputResult) | 470 &TestRunnerBindings::AddMockSpeechInputResult) |
471 .SetMethod("setMockSpeechInputDumpRect", | 471 .SetMethod("setMockSpeechInputDumpRect", |
472 &TestRunnerBindings::SetMockSpeechInputDumpRect) | 472 &TestRunnerBindings::SetMockSpeechInputDumpRect) |
473 .SetMethod("addMockSpeechRecognitionResult", | 473 .SetMethod("addMockSpeechRecognitionResult", |
474 &TestRunnerBindings::AddMockSpeechRecognitionResult) | 474 &TestRunnerBindings::AddMockSpeechRecognitionResult) |
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1162 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { | 1162 void TestRunnerBindings::SetPOSIXLocale(const std::string& locale) { |
1163 if (runner_) | 1163 if (runner_) |
1164 runner_->SetPOSIXLocale(locale); | 1164 runner_->SetPOSIXLocale(locale); |
1165 } | 1165 } |
1166 | 1166 |
1167 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { | 1167 void TestRunnerBindings::SetMIDIAccessorResult(bool result) { |
1168 if (runner_) | 1168 if (runner_) |
1169 runner_->SetMIDIAccessorResult(result); | 1169 runner_->SetMIDIAccessorResult(result); |
1170 } | 1170 } |
1171 | 1171 |
1172 void TestRunnerBindings::SetMIDISysExPermission(bool value) { | 1172 void TestRunnerBindings::SetMIDISysexPermission(bool value) { |
1173 if (runner_) | 1173 if (runner_) |
1174 runner_->SetMIDISysExPermission(value); | 1174 runner_->SetMIDISysexPermission(value); |
1175 } | 1175 } |
1176 | 1176 |
1177 void TestRunnerBindings::GrantWebNotificationPermission(gin::Arguments* args) { | 1177 void TestRunnerBindings::GrantWebNotificationPermission(gin::Arguments* args) { |
1178 if (runner_) { | 1178 if (runner_) { |
1179 std::string origin; | 1179 std::string origin; |
1180 bool permission_granted = true; | 1180 bool permission_granted = true; |
1181 args->GetNext(&origin); | 1181 args->GetNext(&origin); |
1182 args->GetNext(&permission_granted); | 1182 args->GetNext(&permission_granted); |
1183 return runner_->GrantWebNotificationPermission(origin, permission_granted); | 1183 return runner_->GrantWebNotificationPermission(origin, permission_granted); |
1184 } | 1184 } |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 } | 2504 } |
2505 | 2505 |
2506 void TestRunner::SetPOSIXLocale(const std::string& locale) { | 2506 void TestRunner::SetPOSIXLocale(const std::string& locale) { |
2507 delegate_->setLocale(locale); | 2507 delegate_->setLocale(locale); |
2508 } | 2508 } |
2509 | 2509 |
2510 void TestRunner::SetMIDIAccessorResult(bool result) { | 2510 void TestRunner::SetMIDIAccessorResult(bool result) { |
2511 midi_accessor_result_ = result; | 2511 midi_accessor_result_ = result; |
2512 } | 2512 } |
2513 | 2513 |
2514 void TestRunner::SetMIDISysExPermission(bool value) { | 2514 void TestRunner::SetMIDISysexPermission(bool value) { |
2515 const std::vector<WebTestProxyBase*>& windowList = | 2515 const std::vector<WebTestProxyBase*>& windowList = |
2516 test_interfaces_->windowList(); | 2516 test_interfaces_->windowList(); |
2517 for (unsigned i = 0; i < windowList.size(); ++i) | 2517 for (unsigned i = 0; i < windowList.size(); ++i) |
2518 windowList.at(i)->midiClientMock()->setSysExPermission(value); | 2518 windowList.at(i)->midiClientMock()->setSysexPermission(value); |
2519 } | 2519 } |
2520 | 2520 |
2521 void TestRunner::GrantWebNotificationPermission(const std::string& origin, | 2521 void TestRunner::GrantWebNotificationPermission(const std::string& origin, |
2522 bool permission_granted) { | 2522 bool permission_granted) { |
2523 notification_presenter_->GrantPermission(origin, permission_granted); | 2523 notification_presenter_->GrantPermission(origin, permission_granted); |
2524 } | 2524 } |
2525 | 2525 |
2526 bool TestRunner::SimulateWebNotificationClick(const std::string& value) { | 2526 bool TestRunner::SimulateWebNotificationClick(const std::string& value) { |
2527 return notification_presenter_->SimulateClick(value); | 2527 return notification_presenter_->SimulateClick(value); |
2528 } | 2528 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2628 } | 2628 } |
2629 | 2629 |
2630 void TestRunner::DidLosePointerLockInternal() { | 2630 void TestRunner::DidLosePointerLockInternal() { |
2631 bool was_locked = pointer_locked_; | 2631 bool was_locked = pointer_locked_; |
2632 pointer_locked_ = false; | 2632 pointer_locked_ = false; |
2633 if (was_locked) | 2633 if (was_locked) |
2634 web_view_->didLosePointerLock(); | 2634 web_view_->didLosePointerLock(); |
2635 } | 2635 } |
2636 | 2636 |
2637 } // namespace content | 2637 } // namespace content |
OLD | NEW |