Changeset 140277 in webkit
- Timestamp:
- Jan 20, 2013 12:16:24 PM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r140271 r140277 1 2013-01-20 Jochen Eisinger <jochen@chromium.org> 2 3 [chromium] move speech related methods to TestRunner library 4 https://bugs.webkit.org/show_bug.cgi?id=107266 5 6 Reviewed by Adam Barth. 7 8 * DumpRenderTree/chromium/DRTTestRunner.cpp: 9 (DRTTestRunner::DRTTestRunner): 10 (DRTTestRunner::displayInvalidatedRegion): 11 * DumpRenderTree/chromium/DRTTestRunner.h: 12 (DRTTestRunner): 13 * DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h: 14 (WebTestDelegate): 15 (WebTestRunner::WebTestDelegate::addMockSpeechInputResult): 16 (WebTestRunner::WebTestDelegate::setMockSpeechInputDumpRect): 17 (WebTestRunner::WebTestDelegate::addMockSpeechRecognitionResult): 18 (WebTestRunner::WebTestDelegate::setMockSpeechRecognitionError): 19 (WebTestRunner::WebTestDelegate::wasMockSpeechRecognitionAborted): 20 * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp: 21 (WebTestRunner::TestRunner::TestRunner): 22 (WebTestRunner): 23 (WebTestRunner::TestRunner::addMockSpeechInputResult): 24 (WebTestRunner::TestRunner::setMockSpeechInputDumpRect): 25 (WebTestRunner::TestRunner::addMockSpeechRecognitionResult): 26 (WebTestRunner::TestRunner::setMockSpeechRecognitionError): 27 (WebTestRunner::TestRunner::wasMockSpeechRecognitionAborted): 28 * DumpRenderTree/chromium/TestRunner/src/TestRunner.h: 29 (TestRunner): 30 * DumpRenderTree/chromium/WebViewHost.cpp: 31 (WebViewHost::addMockSpeechInputResult): 32 (WebViewHost::setMockSpeechInputDumpRect): 33 (WebViewHost::addMockSpeechRecognitionResult): 34 (WebViewHost::setMockSpeechRecognitionError): 35 (WebViewHost::wasMockSpeechRecognitionAborted): 36 * DumpRenderTree/chromium/WebViewHost.h: 37 1 38 2013-01-20 Jochen Eisinger <jochen@chromium.org> 2 39 -
trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
r140271 r140277 35 35 36 36 #include "DRTDevToolsAgent.h" 37 #include "MockWebSpeechInputController.h"38 #include "MockWebSpeechRecognizer.h"39 37 #include "Task.h" 40 38 #include "TestShell.h" … … 91 89 // names to their methods will be done by calling bindToJavaScript() (defined 92 90 // by CppBoundClass, the parent to DRTTestRunner). 93 #if ENABLE(INPUT_SPEECH)94 bindMethod("addMockSpeechInputResult", &DRTTestRunner::addMockSpeechInputResult);95 bindMethod("setMockSpeechInputDumpRect", &DRTTestRunner::setMockSpeechInputDumpRect);96 #endif97 #if ENABLE(SCRIPTED_SPEECH)98 bindMethod("addMockSpeechRecognitionResult", &DRTTestRunner::addMockSpeechRecognitionResult);99 bindMethod("setMockSpeechRecognitionError", &DRTTestRunner::setMockSpeechRecognitionError);100 bindMethod("wasMockSpeechRecognitionAborted", &DRTTestRunner::wasMockSpeechRecognitionAborted);101 #endif102 91 bindMethod("display", &DRTTestRunner::display); 103 92 bindMethod("displayInvalidatedRegion", &DRTTestRunner::displayInvalidatedRegion); … … 462 451 result->setNull(); 463 452 } 464 465 #if ENABLE(INPUT_SPEECH)466 void DRTTestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result)467 {468 result->setNull();469 if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isNumber() || !arguments[2].isString())470 return;471 472 if (MockWebSpeechInputController* controller = m_shell->webViewHost()->speechInputControllerMock())473 controller->addMockRecognitionResult(cppVariantToWebString(arguments[0]), arguments[1].toDouble(), cppVariantToWebString(arguments[2]));474 }475 476 void DRTTestRunner::setMockSpeechInputDumpRect(const CppArgumentList& arguments, CppVariant* result)477 {478 result->setNull();479 if (arguments.size() < 1 || !arguments[0].isBool())480 return;481 482 if (MockWebSpeechInputController* controller = m_shell->webViewHost()->speechInputControllerMock())483 controller->setDumpRect(arguments[0].value.boolValue);484 }485 #endif486 487 #if ENABLE(SCRIPTED_SPEECH)488 void DRTTestRunner::addMockSpeechRecognitionResult(const CppArgumentList& arguments, CppVariant* result)489 {490 result->setNull();491 if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isNumber())492 return;493 494 if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer())495 recognizer->addMockResult(cppVariantToWebString(arguments[0]), arguments[1].toDouble());496 }497 498 void DRTTestRunner::setMockSpeechRecognitionError(const CppArgumentList& arguments, CppVariant* result)499 {500 result->setNull();501 if (arguments.size() != 2 || !arguments[0].isString() || !arguments[1].isString())502 return;503 504 if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer())505 recognizer->setError(cppVariantToWebString(arguments[0]), cppVariantToWebString(arguments[1]));506 }507 508 void DRTTestRunner::wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant* result)509 {510 result->set(false);511 if (MockWebSpeechRecognizer* recognizer = m_shell->webViewHost()->mockSpeechRecognizer())512 result->set(recognizer->wasAborted());513 }514 #endif -
trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h
r140271 r140277 111 111 void displayInvalidatedRegion(const CppArgumentList&, CppVariant*); 112 112 113 // Speech input related functions.114 #if ENABLE(INPUT_SPEECH)115 void addMockSpeechInputResult(const CppArgumentList&, CppVariant*);116 void setMockSpeechInputDumpRect(const CppArgumentList&, CppVariant*);117 #endif118 #if ENABLE(SCRIPTED_SPEECH)119 void addMockSpeechRecognitionResult(const CppArgumentList&, CppVariant*);120 void setMockSpeechRecognitionError(const CppArgumentList&, CppVariant*);121 void wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant*);122 #endif123 124 113 public: 125 114 // The following methods are not exposed to JavaScript. -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestDelegate.h
r140271 r140277 104 104 virtual void setMockGeolocationPosition(double, double, double) { } 105 105 virtual void setMockGeolocationPositionUnavailableError(const std::string&) { } 106 #if ENABLE(NOTIFICATIONS)107 106 virtual void grantWebNotificationPermission(const std::string&) { } 108 107 virtual bool simulateLegacyWebNotificationClick(const std::string&) { return false; } 109 #endif 108 virtual void addMockSpeechInputResult(const std::string&, double, const std::string&) { } 109 virtual void setMockSpeechInputDumpRect(bool) { } 110 virtual void addMockSpeechRecognitionResult(const std::string&, double) { } 111 virtual void setMockSpeechRecognitionError(const std::string&, const std::string&) { } 112 virtual bool wasMockSpeechRecognitionAborted() { return false; } 113 110 114 }; 111 115 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
r140271 r140277 225 225 bindMethod("grantWebNotificationPermission", &TestRunner::grantWebNotificationPermission); 226 226 bindMethod("simulateLegacyWebNotificationClick", &TestRunner::simulateLegacyWebNotificationClick); 227 #endif 228 #if ENABLE(INPUT_SPEECH) 229 bindMethod("addMockSpeechInputResult", &TestRunner::addMockSpeechInputResult); 230 bindMethod("setMockSpeechInputDumpRect", &TestRunner::setMockSpeechInputDumpRect); 231 #endif 232 #if ENABLE(SCRIPTED_SPEECH) 233 bindMethod("addMockSpeechRecognitionResult", &TestRunner::addMockSpeechRecognitionResult); 234 bindMethod("setMockSpeechRecognitionError", &TestRunner::setMockSpeechRecognitionError); 235 bindMethod("wasMockSpeechRecognitionAborted", &TestRunner::wasMockSpeechRecognitionAborted); 227 236 #endif 228 237 … … 1488 1497 #endif 1489 1498 1499 #if ENABLE(INPUT_SPEECH) 1500 void TestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result) 1501 { 1502 result->setNull(); 1503 if (arguments.size() < 3 || !arguments[0].isString() || !arguments[1].isNumber() || !arguments[2].isString()) 1504 return; 1505 1506 m_delegate->addMockSpeechInputResult(arguments[0].toString(), arguments[1].toDouble(), arguments[2].toString()); 1507 } 1508 1509 void TestRunner::setMockSpeechInputDumpRect(const CppArgumentList& arguments, CppVariant* result) 1510 { 1511 result->setNull(); 1512 if (arguments.size() < 1 || !arguments[0].isBool()) 1513 return; 1514 1515 m_delegate->setMockSpeechInputDumpRect(arguments[0].toBoolean()); 1516 } 1517 #endif 1518 1519 #if ENABLE(SCRIPTED_SPEECH) 1520 void TestRunner::addMockSpeechRecognitionResult(const CppArgumentList& arguments, CppVariant* result) 1521 { 1522 result->setNull(); 1523 if (arguments.size() < 2 || !arguments[0].isString() || !arguments[1].isNumber()) 1524 return; 1525 1526 m_delegate->addMockSpeechRecognitionResult(arguments[0].toString(), arguments[1].toDouble()); 1527 } 1528 1529 void TestRunner::setMockSpeechRecognitionError(const CppArgumentList& arguments, CppVariant* result) 1530 { 1531 result->setNull(); 1532 if (arguments.size() != 2 || !arguments[0].isString() || !arguments[1].isString()) 1533 return; 1534 1535 m_delegate->setMockSpeechRecognitionError(arguments[0].toString(), arguments[1].toString()); 1536 } 1537 1538 void TestRunner::wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant* result) 1539 { 1540 result->set(m_delegate->wasMockSpeechRecognitionAborted()); 1541 } 1542 #endif 1543 1490 1544 void TestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result) 1491 1545 { -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
r140271 r140277 384 384 #endif 385 385 386 // Speech input related functions. 387 #if ENABLE(INPUT_SPEECH) 388 void addMockSpeechInputResult(const CppArgumentList&, CppVariant*); 389 void setMockSpeechInputDumpRect(const CppArgumentList&, CppVariant*); 390 #endif 391 #if ENABLE(SCRIPTED_SPEECH) 392 void addMockSpeechRecognitionResult(const CppArgumentList&, CppVariant*); 393 void setMockSpeechRecognitionError(const CppArgumentList&, CppVariant*); 394 void wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant*); 395 #endif 396 386 397 /////////////////////////////////////////////////////////////////////////// 387 398 // Properties -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r140271 r140277 1184 1184 #endif 1185 1185 1186 #if ENABLE(INPUT_SPEECH) 1187 void WebViewHost::addMockSpeechInputResult(const std::string& result, double confidence, const std::string& language) 1188 { 1189 m_speechInputControllerMock->addMockRecognitionResult(WebString::fromUTF8(result), confidence, WebString::fromUTF8(language)); 1190 } 1191 1192 void WebViewHost::setMockSpeechInputDumpRect(bool dumpRect) 1193 { 1194 m_speechInputControllerMock->setDumpRect(dumpRect); 1195 } 1196 #endif 1197 1198 #if ENABLE(SCRIPTED_SPEECH) 1199 void WebViewHost::addMockSpeechRecognitionResult(const std::string& transcript, double confidence) 1200 { 1201 m_mockSpeechRecognizer->addMockResult(WebString::fromUTF8(transcript), confidence); 1202 } 1203 1204 void WebViewHost::setMockSpeechRecognitionError(const std::string& error, const std::string& message) 1205 { 1206 m_mockSpeechRecognizer->setError(WebString::fromUTF8(error), WebString::fromUTF8(message)); 1207 } 1208 1209 bool WebViewHost::wasMockSpeechRecognitionAborted() 1210 { 1211 return m_mockSpeechRecognizer->wasAborted(); 1212 } 1213 #endif 1214 1186 1215 // Public functions ----------------------------------------------------------- 1187 1216 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.h
r140271 r140277 169 169 virtual bool simulateLegacyWebNotificationClick(const std::string&) OVERRIDE; 170 170 #endif 171 #if ENABLE(INPUT_SPEECH) 172 virtual void addMockSpeechInputResult(const std::string&, double, const std::string&) OVERRIDE; 173 virtual void setMockSpeechInputDumpRect(bool) OVERRIDE; 174 #endif 175 #if ENABLE(SCRIPTED_SPEECH) 176 virtual void addMockSpeechRecognitionResult(const std::string&, double) OVERRIDE; 177 virtual void setMockSpeechRecognitionError(const std::string&, const std::string&) OVERRIDE; 178 virtual bool wasMockSpeechRecognitionAborted() OVERRIDE; 179 #endif 171 180 172 181 // NavigationHost
Note: See TracChangeset
for help on using the changeset viewer.