Changeset 137993 in webkit
- Timestamp:
- Dec 18, 2012 12:25:58 AM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r137992 r137993 1 2012-12-18 Jochen Eisinger <jochen@chromium.org> 2 3 [chromium] move editing callback dumping to the WebTestProxy 4 https://bugs.webkit.org/show_bug.cgi?id=105013 5 6 Reviewed by Darin Fisher. 7 8 To decide whether or not to dump the editing callbacks, the WebTestProxy 9 needs to query the TestRunner. For this purpose, I introduce a 10 WebTestRunner class that just exposes the shouldDumpEditingCallbacks 11 method. In contrast to e.g. WebEventSender, the WebTestRunner is just 12 an interface, and it is not owned by the WebTestInterfaces, but the 13 embedder of the TestRunner library must provide it. This will change 14 once all TestRunner methods are in the library. 15 16 * DumpRenderTree/DumpRenderTree.gypi: 17 * DumpRenderTree/chromium/DRTTestRunner.cpp: 18 (DRTTestRunner::DRTTestRunner): 19 (DRTTestRunner::reset): 20 * DumpRenderTree/chromium/DRTTestRunner.h: 21 (DRTTestRunner): 22 (DRTTestRunner::taskList): 23 (DRTTestRunner::WorkQueue::taskList): 24 * DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h: 25 (WebTestRunner): 26 (WebTestInterfaces): 27 * DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h: 28 (WebKit): 29 (WebTestRunner): 30 (WebTestProxyBase): 31 (WebTestRunner::WebTestProxy::shouldBeginEditing): 32 (WebTestRunner::WebTestProxy::shouldEndEditing): 33 (WebTestRunner::WebTestProxy::shouldInsertNode): 34 (WebTestRunner::WebTestProxy::shouldInsertText): 35 (WebTestRunner::WebTestProxy::shouldChangeSelectedRange): 36 (WebTestRunner::WebTestProxy::shouldDeleteRange): 37 (WebTestRunner::WebTestProxy::shouldApplyStyle): 38 (WebTestRunner::WebTestProxy::didBeginEditing): 39 (WebTestRunner::WebTestProxy::didChangeSelection): 40 (WebTestRunner::WebTestProxy::didChangeContents): 41 (WebTestRunner::WebTestProxy::didEndEditing): 42 * DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h: Copied from Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h. 43 (WebTestRunner): 44 (WebTestRunner::WebTestRunner::shouldDumpEditingCallbacks): 45 * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp: 46 (WebTestRunner::TestRunner::TestRunner): 47 (WebTestRunner::TestRunner::~TestRunner): 48 (WebTestRunner): 49 (WebTestRunner::TestRunner::reset): 50 (WebTestRunner::TestRunner::shouldDumpEditingCallbacks): 51 (WebTestRunner::TestRunner::dumpEditingCallbacks): 52 * DumpRenderTree/chromium/TestRunner/src/TestRunner.h: 53 (TestRunner): 54 * DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp: 55 (WebTestRunner::WebTestInterfaces::Internal::testRunner): 56 (WebTestRunner::WebTestInterfaces::Internal::setTestRunner): 57 (WebTestInterfaces::Internal): 58 (WebTestRunner::WebTestInterfaces::Internal::Internal): 59 (WebTestRunner::WebTestInterfaces::testRunner): 60 (WebTestRunner): 61 (WebTestRunner::WebTestInterfaces::setTestRunner): 62 * DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp: 63 (WebTestRunner::WebTestProxyBase::postAccessibilityNotification): 64 (WebTestRunner): 65 (WebTestRunner::WebTestProxyBase::shouldBeginEditing): 66 (WebTestRunner::WebTestProxyBase::shouldEndEditing): 67 (WebTestRunner::WebTestProxyBase::shouldInsertNode): 68 (WebTestRunner::WebTestProxyBase::shouldInsertText): 69 (WebTestRunner::WebTestProxyBase::shouldChangeSelectedRange): 70 (WebTestRunner::WebTestProxyBase::shouldDeleteRange): 71 (WebTestRunner::WebTestProxyBase::shouldApplyStyle): 72 (WebTestRunner::WebTestProxyBase::didBeginEditing): 73 (WebTestRunner::WebTestProxyBase::didChangeSelection): 74 (WebTestRunner::WebTestProxyBase::didChangeContents): 75 (WebTestRunner::WebTestProxyBase::didEndEditing): 76 * DumpRenderTree/chromium/TestShell.cpp: 77 (TestShell::initialize): 78 (TestShell::createNewWindow): 79 * DumpRenderTree/chromium/WebViewHost.cpp: 80 (WebViewHost::shouldBeginEditing): 81 (WebViewHost::shouldEndEditing): 82 (WebViewHost::shouldInsertNode): 83 (WebViewHost::shouldInsertText): 84 (WebViewHost::shouldChangeSelectedRange): 85 (WebViewHost::shouldDeleteRange): 86 (WebViewHost::shouldApplyStyle): 87 * DumpRenderTree/chromium/WebViewHost.h: 88 (WebViewHost): 89 1 90 2012-12-17 Jochen Eisinger <jochen@chromium.org> 2 91 -
trunk/Tools/DumpRenderTree/DumpRenderTree.gypi
r137441 r137993 69 69 'chromium/TestRunner/public/WebTestPlugin.h', 70 70 'chromium/TestRunner/public/WebTestProxy.h', 71 'chromium/TestRunner/public/WebTestRunner.h', 71 72 'chromium/TestRunner/src/AccessibilityControllerChromium.cpp', 72 73 'chromium/TestRunner/src/AccessibilityControllerChromium.h', -
trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.cpp
r136846 r137993 135 135 bindMethod("dumpChildFramesAsText", &DRTTestRunner::dumpChildFramesAsText); 136 136 bindMethod("dumpChildFrameScrollPositions", &DRTTestRunner::dumpChildFrameScrollPositions); 137 bindMethod("dumpEditingCallbacks", &DRTTestRunner::dumpEditingCallbacks);138 137 bindMethod("dumpFrameLoadCallbacks", &DRTTestRunner::dumpFrameLoadCallbacks); 139 138 bindMethod("dumpProgressFinishedCallback", &DRTTestRunner::dumpProgressFinishedCallback); … … 278 277 } 279 278 280 void DRTTestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result)281 {282 m_dumpEditingCallbacks = true;283 result->setNull();284 }285 286 279 void DRTTestRunner::dumpBackForwardList(const CppArgumentList&, CppVariant* result) 287 280 { … … 549 542 m_dumpAsAudio = false; 550 543 m_dumpCreateView = false; 551 m_dumpEditingCallbacks = false;552 544 m_dumpFrameLoadCallbacks = false; 553 545 m_dumpProgressFinishedCallback = false; -
trunk/Tools/DumpRenderTree/chromium/DRTTestRunner.h
r136552 r137993 66 66 using WebTestRunner::CppArgumentList; 67 67 using WebTestRunner::CppVariant; 68 using WebTestRunner::WebMethodTask; 69 using WebTestRunner::WebTaskList; 68 70 69 71 class DRTTestRunner : public WebTestRunner::TestRunner { … … 73 75 DRTTestRunner(TestShell*); 74 76 75 ~DRTTestRunner();77 virtual ~DRTTestRunner(); 76 78 77 79 // This function sets a flag that tells the test_shell to dump pages as … … 79 81 // It takes an optional argument, whether to dump pixels results or not. 80 82 void dumpAsText(const CppArgumentList&, CppVariant*); 81 82 // This function sets a flag that tells the test_shell to print a line of83 // descriptive text for each editing command. It takes no arguments, and84 // ignores any that may be present.85 void dumpEditingCallbacks(const CppArgumentList&, CppVariant*);86 83 87 84 // This function sets a flag that tells the test_shell to print a line of … … 296 293 bool shouldDumpAsText() { return m_dumpAsText; } 297 294 void setShouldDumpAsText(bool value) { m_dumpAsText = value; } 298 bool shouldDumpEditingCallbacks() { return m_dumpEditingCallbacks; }299 295 bool shouldDumpFrameLoadCallbacks() { return m_dumpFrameLoadCallbacks; } 300 296 void setShouldDumpFrameLoadCallbacks(bool value) { m_dumpFrameLoadCallbacks = value; } … … 358 354 }; 359 355 360 WebT estRunner::WebTaskList* taskList() { return &m_taskList; }356 WebTaskList* taskList() { return &m_taskList; } 361 357 362 358 bool shouldStayOnPageAfterHandlingBeforeUnload() const { return m_shouldStayOnPageAfterHandlingBeforeUnload; } … … 381 377 void setFrozen(bool frozen) { m_frozen = frozen; } 382 378 bool isEmpty() { return m_queue.isEmpty(); } 383 WebT estRunner::WebTaskList* taskList() { return &m_taskList; }379 WebTaskList* taskList() { return &m_taskList; } 384 380 385 381 private: 386 382 void processWork(); 387 class WorkQueueTask: public Web TestRunner::WebMethodTask<WorkQueue> {383 class WorkQueueTask: public WebMethodTask<WorkQueue> { 388 384 public: 389 WorkQueueTask(WorkQueue* object): Web TestRunner::WebMethodTask<WorkQueue>(object) { }385 WorkQueueTask(WorkQueue* object): WebMethodTask<WorkQueue>(object) { } 390 386 virtual void runIfValid() { m_object->processWork(); } 391 387 }; 392 388 393 WebT estRunner::WebTaskList m_taskList;389 WebTaskList m_taskList; 394 390 Deque<WorkItem*> m_queue; 395 391 bool m_frozen; … … 397 393 }; 398 394 void completeNotifyDone(bool isTimeout); 399 class NotifyDoneTimedOutTask: public Web TestRunner::WebMethodTask<DRTTestRunner> {395 class NotifyDoneTimedOutTask: public WebMethodTask<DRTTestRunner> { 400 396 public: 401 NotifyDoneTimedOutTask(DRTTestRunner* object): Web TestRunner::WebMethodTask<DRTTestRunner>(object) { }397 NotifyDoneTimedOutTask(DRTTestRunner* object): WebMethodTask<DRTTestRunner>(object) { } 402 398 virtual void runIfValid() { m_object->completeNotifyDone(true); } 403 399 }; 404 400 405 401 // Used for test timeouts. 406 WebT estRunner::WebTaskList m_taskList;402 WebTaskList m_taskList; 407 403 408 404 // Non-owning pointer. The DRTTestRunner is owned by the host. … … 415 411 // If true, the test_shell will output a base64 encoded WAVE file. 416 412 bool m_dumpAsAudio; 417 418 // If true, the test_shell will write a descriptive line for each editing419 // command.420 bool m_dumpEditingCallbacks;421 413 422 414 // If true, the test_shell will draw the bounds of the current selection rect -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h
r132029 r137993 42 42 class WebEventSender; 43 43 class WebTestDelegate; 44 class WebTestRunner; 44 45 45 46 class WebTestInterfaces { … … 55 56 WebAccessibilityController* accessibilityController(); 56 57 WebEventSender* eventSender(); 58 WebTestRunner* testRunner(); 59 // FIXME: Remove this once TestRunner is complete. 60 void setTestRunner(WebTestRunner*); 57 61 58 62 private: -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h
r135006 r137993 35 35 #include "WebKit/chromium/public/WebAccessibilityNotification.h" 36 36 #include "WebKit/chromium/public/WebDragOperation.h" 37 #include "WebKit/chromium/public/WebEditingAction.h" 37 38 #include "WebKit/chromium/public/WebNavigationPolicy.h" 39 #include "WebKit/chromium/public/WebTextAffinity.h" 38 40 39 41 namespace WebKit { … … 42 44 class WebFrame; 43 45 class WebImage; 46 class WebNode; 47 class WebRange; 48 class WebString; 44 49 struct WebPoint; 45 50 struct WebSize; … … 50 55 class WebTestDelegate; 51 56 class WebTestInterfaces; 57 class WebTestRunner; 52 58 53 59 class WebTestProxyBase { … … 72 78 void postAccessibilityNotification(const WebKit::WebAccessibilityObject&, WebKit::WebAccessibilityNotification); 73 79 void startDragging(WebKit::WebFrame*, const WebKit::WebDragData&, WebKit::WebDragOperationsMask, const WebKit::WebImage&, const WebKit::WebPoint&); 80 bool shouldBeginEditing(const WebKit::WebRange&); 81 bool shouldEndEditing(const WebKit::WebRange&); 82 bool shouldInsertNode(const WebKit::WebNode&, const WebKit::WebRange&, WebKit::WebEditingAction); 83 bool shouldInsertText(const WebKit::WebString& text, const WebKit::WebRange&, WebKit::WebEditingAction); 84 bool shouldChangeSelectedRange(const WebKit::WebRange& fromRange, const WebKit::WebRange& toRange, WebKit::WebTextAffinity, bool stillSelecting); 85 bool shouldDeleteRange(const WebKit::WebRange&); 86 bool shouldApplyStyle(const WebKit::WebString& style, const WebKit::WebRange&); 87 void didBeginEditing(); 88 void didChangeSelection(bool isEmptySelection); 89 void didChangeContents(); 90 void didEndEditing(); 74 91 75 92 private: … … 137 154 WebViewClientImpl::startDragging(frame, data, mask, image, point); 138 155 } 156 virtual bool shouldBeginEditing(const WebKit::WebRange& range) 157 { 158 WebTestProxyBase::shouldBeginEditing(range); 159 return WebViewClientImpl::shouldBeginEditing(range); 160 } 161 virtual bool shouldEndEditing(const WebKit::WebRange& range) 162 { 163 WebTestProxyBase::shouldEndEditing(range); 164 return WebViewClientImpl::shouldEndEditing(range); 165 } 166 virtual bool shouldInsertNode(const WebKit::WebNode& node, const WebKit::WebRange& range, WebKit::WebEditingAction action) 167 { 168 WebTestProxyBase::shouldInsertNode(node, range, action); 169 return WebViewClientImpl::shouldInsertNode(node, range, action); 170 } 171 virtual bool shouldInsertText(const WebKit::WebString& text, const WebKit::WebRange& range, WebKit::WebEditingAction action) 172 { 173 WebTestProxyBase::shouldInsertText(text, range, action); 174 return WebViewClientImpl::shouldInsertText(text, range, action); 175 } 176 virtual bool shouldChangeSelectedRange(const WebKit::WebRange& fromRange, const WebKit::WebRange& toRange, WebKit::WebTextAffinity affinity, bool stillSelecting) 177 { 178 WebTestProxyBase::shouldChangeSelectedRange(fromRange, toRange, affinity, stillSelecting); 179 return WebViewClientImpl::shouldChangeSelectedRange(fromRange, toRange, affinity, stillSelecting); 180 } 181 virtual bool shouldDeleteRange(const WebKit::WebRange& range) 182 { 183 WebTestProxyBase::shouldDeleteRange(range); 184 return WebViewClientImpl::shouldDeleteRange(range); 185 } 186 virtual bool shouldApplyStyle(const WebKit::WebString& style, const WebKit::WebRange& range) 187 { 188 WebTestProxyBase::shouldApplyStyle(style, range); 189 return WebViewClientImpl::shouldApplyStyle(style, range); 190 } 191 virtual void didBeginEditing() 192 { 193 WebTestProxyBase::didBeginEditing(); 194 WebViewClientImpl::didBeginEditing(); 195 } 196 virtual void didChangeSelection(bool isEmptySelection) 197 { 198 WebTestProxyBase::didChangeSelection(isEmptySelection); 199 WebViewClientImpl::didChangeSelection(isEmptySelection); 200 } 201 virtual void didChangeContents() 202 { 203 WebTestProxyBase::didChangeContents(); 204 WebViewClientImpl::didChangeContents(); 205 } 206 virtual void didEndEditing() 207 { 208 WebTestProxyBase::didEndEditing(); 209 WebViewClientImpl::didEndEditing(); 210 } 139 211 }; 140 212 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestRunner.h
r137992 r137993 29 29 */ 30 30 31 #ifndef WebTestInterfaces_h 32 #define WebTestInterfaces_h 33 34 namespace WebKit { 35 class WebFrame; 36 class WebView; 37 } 31 #ifndef WebTestRunner_h 32 #define WebTestRunner_h 38 33 39 34 namespace WebTestRunner { 40 35 41 class WebAccessibilityController; 42 class WebEventSender; 43 class WebTestDelegate; 44 45 class WebTestInterfaces { 36 // FIXME: Once the TestRunner class is complete, this class should take a 37 // TestRunner* as ctor argument, and not have default implementations. 38 class WebTestRunner { 46 39 public: 47 WebTestInterfaces(); 48 ~WebTestInterfaces(); 49 50 void setWebView(WebKit::WebView*); 51 void setDelegate(WebTestDelegate*); 52 void bindTo(WebKit::WebFrame*); 53 void resetAll(); 54 55 WebAccessibilityController* accessibilityController(); 56 WebEventSender* eventSender(); 57 58 private: 59 class Internal; 60 Internal* m_internal; 40 virtual bool shouldDumpEditingCallbacks() const { return false; } 61 41 }; 62 42 63 43 } 64 44 65 #endif // WebTest Interfaces_h45 #endif // WebTestRunner_h -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
r137992 r137993 115 115 bindMethod("setTouchDragDropEnabled", &TestRunner::setTouchDragDropEnabled); 116 116 117 // The following modify the state of the TestRunner. 118 bindMethod("dumpEditingCallbacks", &TestRunner::dumpEditingCallbacks); 119 117 120 // Properties. 118 121 bindProperty("workerThreadCount", &TestRunner::workerThreadCount); … … 152 155 } 153 156 157 TestRunner::~TestRunner() 158 { 159 } 160 154 161 void TestRunner::reset() 155 162 { … … 170 177 #endif 171 178 179 m_dumpEditingCallbacks = false; 180 172 181 m_globalFlag.set(false); 173 182 m_platformName.set("chromium"); 174 183 175 184 m_userStyleSheetLocation = WebURL(); 185 } 186 187 bool TestRunner::shouldDumpEditingCallbacks() const 188 { 189 return m_dumpEditingCallbacks; 176 190 } 177 191 … … 838 852 } 839 853 854 void TestRunner::dumpEditingCallbacks(const CppArgumentList&, CppVariant* result) 855 { 856 m_dumpEditingCallbacks = true; 857 result->setNull(); 858 } 859 840 860 void TestRunner::workerThreadCount(CppVariant* result) 841 861 { -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
r137992 r137993 34 34 35 35 #include "CppBoundClass.h" 36 #include "WebTestRunner.h" 36 37 #include "platform/WebURL.h" 37 38 … … 44 45 class WebTestDelegate; 45 46 46 class TestRunner : public CppBoundClass {47 class TestRunner : public CppBoundClass, public WebTestRunner { 47 48 public: 48 49 TestRunner(); 50 virtual ~TestRunner(); 49 51 50 52 // FIXME: once DRTTestRunner is moved entirely to this class, change this … … 54 56 55 57 void reset(); 58 59 // WebTestRunner implementation. 60 virtual bool shouldDumpEditingCallbacks() const OVERRIDE; 56 61 57 62 protected: … … 174 179 175 180 /////////////////////////////////////////////////////////////////////////// 181 // Methods that modify the state of TestRunner 182 183 // This function sets a flag that tells the test_shell to print a line of 184 // descriptive text for each editing command. It takes no arguments, and 185 // ignores any that may be present. 186 void dumpEditingCallbacks(const CppArgumentList&, CppVariant*); 187 188 /////////////////////////////////////////////////////////////////////////// 176 189 // Properties 177 190 void workerThreadCount(CppVariant*); … … 205 218 CppVariant m_platformName; 206 219 220 // If true, the test_shell will write a descriptive line for each editing 221 // command. 222 bool m_dumpEditingCallbacks; 223 207 224 WebTestDelegate* m_delegate; 208 225 WebKit::WebView* m_webView; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp
r132781 r137993 56 56 WebAccessibilityController* accessibilityController() { return &m_accessibilityController; } 57 57 WebEventSender* eventSender() { return &m_eventSender; } 58 WebTestRunner* testRunner() { return m_testRunner; } 59 void setTestRunner(WebTestRunner* testRunner) { m_testRunner = testRunner; } 58 60 59 61 // TestDelegate implementation. … … 75 77 WebAccessibilityController m_accessibilityController; 76 78 WebEventSender m_eventSender; 79 WebTestRunner* m_testRunner; 77 80 WebTestDelegate* m_delegate; 78 81 }; … … 81 84 : m_accessibilityController(m_interfaces.accessibilityController()) 82 85 , m_eventSender(m_interfaces.eventSender()) 86 , m_testRunner(0) 83 87 , m_delegate(0) 84 88 { … … 200 204 } 201 205 202 } 206 WebTestRunner* WebTestInterfaces::testRunner() 207 { 208 return m_internal->testRunner(); 209 } 210 211 void WebTestInterfaces::setTestRunner(WebTestRunner* testRunner) 212 { 213 m_internal->setTestRunner(testRunner); 214 } 215 216 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp
r135006 r137993 38 38 #include "WebEventSender.h" 39 39 #include "WebNode.h" 40 #include "WebRange.h" 40 41 #include "WebTestDelegate.h" 41 42 #include "WebTestInterfaces.h" 43 #include "WebTestRunner.h" 42 44 #include "platform/WebCString.h" 45 #include <wtf/StringExtras.h> 43 46 44 47 using namespace WebKit; … … 46 49 47 50 namespace WebTestRunner { 51 52 namespace { 53 54 void printNodeDescription(WebTestDelegate* delegate, const WebNode& node, int exception) 55 { 56 if (exception) { 57 delegate->printMessage("ERROR"); 58 return; 59 } 60 if (node.isNull()) { 61 delegate->printMessage("(null)"); 62 return; 63 } 64 delegate->printMessage(node.nodeName().utf8().data()); 65 const WebNode& parent = node.parentNode(); 66 if (!parent.isNull()) { 67 delegate->printMessage(" > "); 68 printNodeDescription(delegate, parent, 0); 69 } 70 } 71 72 void printRangeDescription(WebTestDelegate* delegate, const WebRange& range) 73 { 74 if (range.isNull()) { 75 delegate->printMessage("(null)"); 76 return; 77 } 78 char buffer[100]; 79 snprintf(buffer, sizeof(buffer), "range from %d of ", range.startOffset()); 80 delegate->printMessage(buffer); 81 int exception = 0; 82 WebNode startNode = range.startContainer(exception); 83 printNodeDescription(delegate, startNode, exception); 84 snprintf(buffer, sizeof(buffer), " to %d of ", range.endOffset()); 85 delegate->printMessage(buffer); 86 WebNode endNode = range.endContainer(exception); 87 printNodeDescription(delegate, endNode, exception); 88 } 89 90 string editingActionDescription(WebEditingAction action) 91 { 92 switch (action) { 93 case WebKit::WebEditingActionTyped: 94 return "WebViewInsertActionTyped"; 95 case WebKit::WebEditingActionPasted: 96 return "WebViewInsertActionPasted"; 97 case WebKit::WebEditingActionDropped: 98 return "WebViewInsertActionDropped"; 99 } 100 return "(UNKNOWN ACTION)"; 101 } 102 103 string textAffinityDescription(WebTextAffinity affinity) 104 { 105 switch (affinity) { 106 case WebKit::WebTextAffinityUpstream: 107 return "NSSelectionAffinityUpstream"; 108 case WebKit::WebTextAffinityDownstream: 109 return "NSSelectionAffinityDownstream"; 110 } 111 return "(UNKNOWN AFFINITY)"; 112 } 113 114 } 48 115 49 116 WebTestProxyBase::WebTestProxyBase() … … 198 265 199 266 if (m_testInterfaces->accessibilityController()->shouldLogAccessibilityEvents()) { 200 st d::string message("AccessibilityNotification - ");267 string message("AccessibilityNotification - "); 201 268 message += notificationName; 202 269 … … 221 288 } 222 289 223 } 290 // The output from these methods in layout test mode should match that 291 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. 292 293 // FIXME: Remove the 0 checks for m_testInterfaces->testRunner() once the 294 // TestInterfaces class owns the TestRunner. 295 296 bool WebTestProxyBase::shouldBeginEditing(const WebRange& range) 297 { 298 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) { 299 m_delegate->printMessage("EDITING DELEGATE: shouldBeginEditingInDOMRange:"); 300 printRangeDescription(m_delegate, range); 301 m_delegate->printMessage("\n"); 302 } 303 return true; 304 } 305 306 bool WebTestProxyBase::shouldEndEditing(const WebRange& range) 307 { 308 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) { 309 m_delegate->printMessage("EDITING DELEGATE: shouldEndEditingInDOMRange:"); 310 printRangeDescription(m_delegate, range); 311 m_delegate->printMessage("\n"); 312 } 313 return true; 314 } 315 316 bool WebTestProxyBase::shouldInsertNode(const WebNode& node, const WebRange& range, WebEditingAction action) 317 { 318 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) { 319 m_delegate->printMessage("EDITING DELEGATE: shouldInsertNode:"); 320 printNodeDescription(m_delegate, node, 0); 321 m_delegate->printMessage(" replacingDOMRange:"); 322 printRangeDescription(m_delegate, range); 323 printf(" givenAction:%s\n", editingActionDescription(action).c_str()); 324 } 325 return true; 326 } 327 328 bool WebTestProxyBase::shouldInsertText(const WebString& text, const WebRange& range, WebEditingAction action) 329 { 330 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) { 331 m_delegate->printMessage(string("EDITING DELEGATE: shouldInsertText:") + text.utf8().data() + " replacingDOMRange:"); 332 printRangeDescription(m_delegate, range); 333 m_delegate->printMessage(string(" givenAction:") + editingActionDescription(action) + "\n"); 334 } 335 return true; 336 } 337 338 bool WebTestProxyBase::shouldChangeSelectedRange( 339 const WebRange& fromRange, const WebRange& toRange, WebTextAffinity affinity, bool stillSelecting) 340 { 341 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) { 342 m_delegate->printMessage("EDITING DELEGATE: shouldChangeSelectedDOMRange:"); 343 printRangeDescription(m_delegate, fromRange); 344 m_delegate->printMessage(" toDOMRange:"); 345 printRangeDescription(m_delegate, toRange); 346 m_delegate->printMessage(string(" affinity:") + textAffinityDescription(affinity) + " stillSelecting:" + (stillSelecting ? "TRUE" : "FALSE") + "\n"); 347 } 348 return true; 349 } 350 351 bool WebTestProxyBase::shouldDeleteRange(const WebRange& range) 352 { 353 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) { 354 m_delegate->printMessage("EDITING DELEGATE: shouldDeleteDOMRange:"); 355 printRangeDescription(m_delegate, range); 356 m_delegate->printMessage("\n"); 357 } 358 return true; 359 } 360 361 bool WebTestProxyBase::shouldApplyStyle(const WebString& style, const WebRange& range) 362 { 363 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) { 364 m_delegate->printMessage(string("EDITING DELEGATE: shouldApplyStyle:") + style.utf8().data() + " toElementsInDOMRange:"); 365 printRangeDescription(m_delegate, range); 366 m_delegate->printMessage("\n"); 367 } 368 return true; 369 } 370 371 void WebTestProxyBase::didBeginEditing() 372 { 373 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) 374 m_delegate->printMessage("EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification\n"); 375 } 376 377 void WebTestProxyBase::didChangeSelection(bool isEmptySelection) 378 { 379 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) 380 m_delegate->printMessage("EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n"); 381 } 382 383 void WebTestProxyBase::didChangeContents() 384 { 385 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) 386 m_delegate->printMessage("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n"); 387 } 388 389 void WebTestProxyBase::didEndEditing() 390 { 391 if (m_testInterfaces->testRunner() && m_testInterfaces->testRunner()->shouldDumpEditingCallbacks()) 392 m_delegate->printMessage("EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification\n"); 393 } 394 395 } -
trunk/Tools/DumpRenderTree/chromium/TestShell.cpp
r137710 r137993 164 164 m_testInterfaces = adoptPtr(new WebTestInterfaces()); 165 165 m_testRunner = adoptPtr(new DRTTestRunner(this)); 166 m_testInterfaces->setTestRunner(m_testRunner.get()); 166 167 #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) 167 168 m_notificationPresenter = adoptPtr(new NotificationPresenter(this)); … … 752 753 WebViewHost* TestShell::createNewWindow(const WebKit::WebURL& url, DRTDevToolsAgent* devToolsAgent) 753 754 { 754 WebTest Runner::WebTestProxy<WebViewHost, TestShell*>* host = new WebTestRunner::WebTestProxy<WebViewHost, TestShell*>(this);755 WebTestProxy<WebViewHost, TestShell*>* host = new WebTestProxy<WebViewHost, TestShell*>(this); 755 756 host->setInterfaces(m_testInterfaces.get()); 756 757 if (m_webViewHost) -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.cpp
r137921 r137993 204 204 } 205 205 206 static void printRangeDescription(const WebRange& range)207 {208 if (range.isNull()) {209 fputs("(null)", stdout);210 return;211 }212 printf("range from %d of ", range.startOffset());213 int exception = 0;214 WebNode startNode = range.startContainer(exception);215 printNodeDescription(startNode, exception);216 printf(" to %d of ", range.endOffset());217 WebNode endNode = range.endContainer(exception);218 printNodeDescription(endNode, exception);219 }220 221 static string editingActionDescription(WebEditingAction action)222 {223 switch (action) {224 case WebKit::WebEditingActionTyped:225 return "WebViewInsertActionTyped";226 case WebKit::WebEditingActionPasted:227 return "WebViewInsertActionPasted";228 case WebKit::WebEditingActionDropped:229 return "WebViewInsertActionDropped";230 }231 return "(UNKNOWN ACTION)";232 }233 234 static string textAffinityDescription(WebTextAffinity affinity)235 {236 switch (affinity) {237 case WebKit::WebTextAffinityUpstream:238 return "NSSelectionAffinityUpstream";239 case WebKit::WebTextAffinityDownstream:240 return "NSSelectionAffinityDownstream";241 }242 return "(UNKNOWN AFFINITY)";243 }244 245 206 // WebViewClient ------------------------------------------------------------- 246 207 … … 326 287 } 327 288 328 // The output from these methods in layout test mode should match that329 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree.330 331 289 bool WebViewHost::shouldBeginEditing(const WebRange& range) 332 290 { 333 if (testRunner()->shouldDumpEditingCallbacks()) {334 fputs("EDITING DELEGATE: shouldBeginEditingInDOMRange:", stdout);335 printRangeDescription(range);336 fputs("\n", stdout);337 }338 291 return true; 339 292 } … … 341 294 bool WebViewHost::shouldEndEditing(const WebRange& range) 342 295 { 343 if (testRunner()->shouldDumpEditingCallbacks()) {344 fputs("EDITING DELEGATE: shouldEndEditingInDOMRange:", stdout);345 printRangeDescription(range);346 fputs("\n", stdout);347 }348 296 return true; 349 297 } … … 351 299 bool WebViewHost::shouldInsertNode(const WebNode& node, const WebRange& range, WebEditingAction action) 352 300 { 353 if (testRunner()->shouldDumpEditingCallbacks()) {354 fputs("EDITING DELEGATE: shouldInsertNode:", stdout);355 printNodeDescription(node, 0);356 fputs(" replacingDOMRange:", stdout);357 printRangeDescription(range);358 printf(" givenAction:%s\n", editingActionDescription(action).c_str());359 }360 301 return true; 361 302 } … … 363 304 bool WebViewHost::shouldInsertText(const WebString& text, const WebRange& range, WebEditingAction action) 364 305 { 365 if (testRunner()->shouldDumpEditingCallbacks()) {366 printf("EDITING DELEGATE: shouldInsertText:%s replacingDOMRange:", text.utf8().data());367 printRangeDescription(range);368 printf(" givenAction:%s\n", editingActionDescription(action).c_str());369 }370 306 return true; 371 307 } … … 374 310 const WebRange& fromRange, const WebRange& toRange, WebTextAffinity affinity, bool stillSelecting) 375 311 { 376 if (testRunner()->shouldDumpEditingCallbacks()) {377 fputs("EDITING DELEGATE: shouldChangeSelectedDOMRange:", stdout);378 printRangeDescription(fromRange);379 fputs(" toDOMRange:", stdout);380 printRangeDescription(toRange);381 printf(" affinity:%s stillSelecting:%s\n",382 textAffinityDescription(affinity).c_str(),383 (stillSelecting ? "TRUE" : "FALSE"));384 }385 312 return true; 386 313 } … … 388 315 bool WebViewHost::shouldDeleteRange(const WebRange& range) 389 316 { 390 if (testRunner()->shouldDumpEditingCallbacks()) {391 fputs("EDITING DELEGATE: shouldDeleteDOMRange:", stdout);392 printRangeDescription(range);393 fputs("\n", stdout);394 }395 317 return true; 396 318 } … … 398 320 bool WebViewHost::shouldApplyStyle(const WebString& style, const WebRange& range) 399 321 { 400 if (testRunner()->shouldDumpEditingCallbacks()) {401 printf("EDITING DELEGATE: shouldApplyStyle:%s toElementsInDOMRange:", style.utf8().data());402 printRangeDescription(range);403 fputs("\n", stdout);404 }405 322 return true; 406 323 } … … 414 331 { 415 332 return m_selectTrailingWhitespaceEnabled; 416 }417 418 void WebViewHost::didBeginEditing()419 {420 if (!testRunner()->shouldDumpEditingCallbacks())421 return;422 fputs("EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification\n", stdout);423 }424 425 void WebViewHost::didChangeSelection(bool isEmptySelection)426 {427 if (testRunner()->shouldDumpEditingCallbacks())428 fputs("EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification\n", stdout);429 // No need to update clipboard with the selected text in DRT.430 }431 432 void WebViewHost::didChangeContents()433 {434 if (!testRunner()->shouldDumpEditingCallbacks())435 return;436 fputs("EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification\n", stdout);437 }438 439 void WebViewHost::didEndEditing()440 {441 if (!testRunner()->shouldDumpEditingCallbacks())442 return;443 fputs("EDITING DELEGATE: webViewDidEndEditing:WebViewDidEndEditingNotification\n", stdout);444 333 } 445 334 -
trunk/Tools/DumpRenderTree/chromium/WebViewHost.h
r137921 r137993 179 179 virtual bool isSmartInsertDeleteEnabled(); 180 180 virtual bool isSelectTrailingWhitespaceEnabled(); 181 virtual void didBeginEditing();182 virtual void didChangeSelection(bool isSelectionEmpty);183 virtual void didChangeContents();184 virtual void didEndEditing();185 181 virtual bool handleCurrentKeyboardEvent(); 186 182 virtual void runModalAlertDialog(WebKit::WebFrame*, const WebKit::WebString&);
Note: See TracChangeset
for help on using the changeset viewer.