Changeset 142165 in webkit
- Timestamp:
- Feb 7, 2013 12:58:25 PM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 31 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r142156 r142165 1 2013-02-07 Jochen Eisinger <jochen@chromium.org> 2 3 [chromium] turn TestRunner library into a component build 4 https://bugs.webkit.org/show_bug.cgi?id=108466 5 6 Reviewed by Adam Barth. 7 8 To achieve this, we need to drop all dependencies on WTF. 9 10 * DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp: 11 * DumpRenderTree/DumpRenderTree.gypi: 12 * DumpRenderTree/chromium/TestRunner/public/WebPreferences.h: 13 * DumpRenderTree/chromium/TestRunner/public/WebTask.h: 14 * DumpRenderTree/chromium/TestRunner/public/WebTestCommon.h: Copied from Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h. 15 * DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h: 16 * DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h: 17 * DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp: 18 (WebTestRunner::AccessibilityUIElement::AccessibilityUIElement): 19 (WebTestRunner::AccessibilityUIElementList::getOrCreate): 20 (WebTestRunner::AccessibilityUIElementList::createRoot): 21 * DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h: 22 (AccessibilityUIElementList): 23 * DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp: 24 (WebTestRunner::CppBoundClass::~CppBoundClass): 25 (WebTestRunner::CppBoundClass::invoke): 26 (WebTestRunner::CppBoundClass::getProperty): 27 (WebTestRunner::CppBoundClass::setProperty): 28 (WebTestRunner::CppBoundClass::bindCallback): 29 (WebTestRunner::CppBoundClass::bindGetterCallback): 30 (WebTestRunner::CppBoundClass::bindProperty): 31 (WebTestRunner::CppBoundClass::getAsCppVariant): 32 * DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h: 33 (WebTestRunner): 34 (CppBoundClass): 35 (WebTestRunner::CppBoundClass::bindProperty): 36 (WebTestRunner::CppBoundClass::bindFallbackCallback): 37 (WebTestRunner::CppBoundClass::bindFallbackMethod): 38 * DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp: 39 (WebTestRunner::CppVariant::toString): 40 (WebTestRunner::CppVariant::toInt32): 41 (WebTestRunner::CppVariant::toDouble): 42 (WebTestRunner::CppVariant::toBoolean): 43 (WebTestRunner::CppVariant::toStringVector): 44 (WebTestRunner::CppVariant::invoke): 45 (WebTestRunner::CppVariant::invokeDefault): 46 * DumpRenderTree/chromium/TestRunner/src/CppVariant.h: 47 (CppVariant): 48 * DumpRenderTree/chromium/TestRunner/src/EventSender.cpp: 49 (WebTestRunner): 50 (WebTestRunner::EventSender::EventSender): 51 (WebTestRunner::EventSender::reset): 52 (WebTestRunner::EventSender::mouseDown): 53 (WebTestRunner::EventSender::mouseUp): 54 (WebTestRunner::EventSender::mouseMoveTo): 55 (WebTestRunner::EventSender::keyDown): 56 (WebTestRunner::EventSender::dispatchMessage): 57 (WebTestRunner::EventSender::leapForward): 58 (WebTestRunner::EventSender::replaySavedEvents): 59 (WebTestRunner::makeMenuItemStringsFor): 60 (WebTestRunner::EventSender::contextClick): 61 (WebTestRunner::EventSender::beginDragWithFiles): 62 (WebTestRunner::EventSender::addTouchPoint): 63 (WebTestRunner::EventSender::releaseTouchPoint): 64 (WebTestRunner::EventSender::updateTouchPoint): 65 (WebTestRunner::EventSender::cancelTouchPoint): 66 (WebTestRunner::EventSender::sendCurrentTouchEvent): 67 (WebTestRunner::EventSender::gestureEvent): 68 * DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp: 69 (WebTestRunner::NativeKeyCodeForWindowsKeyCode): 70 * DumpRenderTree/chromium/TestRunner/src/MockGrammarCheck.cpp: 71 (WebTestRunner::MockGrammarCheck::checkGrammarOfString): 72 (WebTestRunner): 73 * DumpRenderTree/chromium/TestRunner/src/MockGrammarCheck.h: 74 (WebTestRunner): 75 (MockGrammarCheck): 76 * DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp: 77 (WebTestRunner::MockSpellCheck::spellCheckWord): 78 (WebTestRunner::MockSpellCheck::initializeIfNeeded): 79 (WebTestRunner): 80 * DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h: 81 (MockSpellCheck): 82 * DumpRenderTree/chromium/TestRunner/src/SpellCheckClient.cpp: 83 (WebTestRunner::SpellCheckClient::checkTextOfParagraph): 84 (WebTestRunner::SpellCheckClient::finishLastTextCheck): 85 * DumpRenderTree/chromium/TestRunner/src/TestCommon.h: Copied from Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h. 86 (isASCIIAlpha): 87 (isNotASCIIAlpha): 88 * DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp: 89 (WebTestRunner::TestInterfaces::TestInterfaces): 90 * DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h: 91 (TestInterfaces): 92 * DumpRenderTree/chromium/TestRunner/src/TestPlugin.cpp: 93 (WebTestRunner::TestPlugin::TestPlugin): 94 (WebTestRunner::TestPlugin::initialize): 95 (WebTestRunner::TestPlugin::destroy): 96 (WebTestRunner::TestPlugin::parsePrimitive): 97 (WebTestRunner::TestPlugin::parseColor): 98 (WebTestRunner::TestPlugin::initProgram): 99 (WebTestRunner::TestPlugin::initPrimitive): 100 (WebTestRunner::TestPlugin::drawPrimitive): 101 (WebTestRunner::TestPlugin::loadShader): 102 (WebTestRunner::TestPlugin::loadProgram): 103 (WebTestRunner::TestPlugin::handleDragStatusUpdate): 104 * DumpRenderTree/chromium/TestRunner/src/TestPlugin.h: 105 (TestPlugin): 106 * DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp: 107 (WebTestRunner::TestRunner::WorkQueue::processWorkSoon): 108 (WebTestRunner::TestRunner::WorkQueue::processWork): 109 (WebTestRunner::TestRunner::WorkQueue::reset): 110 (WebTestRunner::TestRunner::WorkQueue::addWork): 111 (WebTestRunner::TestRunner::TestRunner): 112 (WebTestRunner::TestRunner::reset): 113 (WebTestRunner::TestRunner::policyDelegateDone): 114 (WebTestRunner::TestRunner::findString): 115 (WebTestRunner::TestRunner::setTextSubpixelPositioning): 116 (WebTestRunner::TestRunner::overridePreference): 117 (WebTestRunner::TestRunner::deliverWebIntent): 118 (WebTestRunner::TestRunner::setBackingScaleFactor): 119 (WebTestRunner::TestRunner::simulateLegacyWebNotificationClick): 120 (WebTestRunner::TestRunner::setMockSpeechInputDumpRect): 121 (WebTestRunner::TestRunner::wasMockSpeechRecognitionAborted): 122 (WebTestRunner::TestRunner::setPointerLockWillFailSynchronously): 123 * DumpRenderTree/chromium/TestRunner/src/TestRunner.h: 124 (WebTestRunner::TestRunner::WorkQueue::isEmpty): 125 (TestRunner): 126 * DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp: 127 (WebTestRunner::TextInputController::markedRange): 128 (WebTestRunner::TextInputController::selectedRange): 129 (WebTestRunner::TextInputController::firstRectForCharacterRange): 130 * DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp: 131 (WebTestRunner::WebPreferences::reset): 132 * DumpRenderTree/chromium/TestRunner/src/WebTask.cpp: 133 (WebTestRunner::WebTaskList::~WebTaskList): 134 (WebTestRunner::WebTaskList::registerTask): 135 (WebTestRunner::WebTaskList::unregisterTask): 136 (WebTestRunner::WebTaskList::revokeAll): 137 * DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp: 138 (WebTestRunner::WebTestInterfaces::WebTestInterfaces): 139 (WebTestRunner::WebTestInterfaces::~WebTestInterfaces): 140 (WebTestRunner::WebTestInterfaces::testInterfaces): 141 * DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp: 142 (WebTestRunner::WebTestProxyBase::~WebTestProxyBase): 143 (WebTestRunner::WebTestProxyBase::spellCheckClient): 144 (WebTestRunner::WebTestProxyBase::registerIntentService): 145 (WebTestRunner::WebTestProxyBase::dispatchIntent): 146 (WebTestRunner::WebTestProxyBase::assignIdentifierToRequest): 147 * DumpRenderTree/chromium/TestRunner/src/config.h: Copied from Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h. 148 1 149 2013-02-07 Eunmi Lee <eunmi15.lee@samsung.com> 2 150 -
trunk/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
r142109 r142165 84 84 'TestRunner_resources', 85 85 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', 86 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_wtf_support',87 86 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_test_support', 88 '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf',89 '<(chromium_src_dir)/webkit/support/webkit_support.gyp:webkit_support',90 87 ], 91 88 'include_dirs': [ … … 107 104 ], 108 105 'conditions': [ 106 ['inside_chromium_build == 1', { 107 'type': '<(component)', 108 'conditions': [ 109 ['component=="shared_library"', { 110 'defines': [ 111 'WEBTESTRUNNER_DLL', 112 'WEBTESTRUNNER_IMPLEMENTATION=1', 113 ], 114 'dependencies': [ 115 '<(chromium_src_dir)/base/base.gyp:base', 116 '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', 117 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', 118 ], 119 'direct_dependent_settings': { 120 'defines': [ 121 'WEBTESTRUNNER_DLL', 122 ], 123 }, 124 'export_dependent_settings': [ 125 '<(chromium_src_dir)/build/temp_gyp/googleurl.gyp:googleurl', 126 '<(chromium_src_dir)/v8/tools/gyp/v8.gyp:v8', 127 ], 128 'msvs_settings': { 129 'VCLinkerTool': { 130 'conditions': [ 131 ['incremental_chrome_dll==1', { 132 'UseLibraryDependencyInputs': 'true', 133 }], 134 ], 135 }, 136 }, 137 }], 138 ], 139 }], 109 140 ['toolkit_uses_gtk == 1', { 110 141 'defines': [ … … 196 227 '<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources', 197 228 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', 229 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_wtf_support', 198 230 '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', 199 231 '<(chromium_src_dir)/base/base.gyp:test_support_base', -
trunk/Tools/DumpRenderTree/DumpRenderTree.gypi
r142109 r142165 58 58 'chromium/TestRunner/public/WebPreferences.h', 59 59 'chromium/TestRunner/public/WebTask.h', 60 'chromium/TestRunner/public/WebTestCommon.h', 60 61 'chromium/TestRunner/public/WebTestInterfaces.h', 61 62 'chromium/TestRunner/public/WebTestProxy.h', … … 81 82 'chromium/TestRunner/src/SpellCheckClient.cpp', 82 83 'chromium/TestRunner/src/SpellCheckClient.h', 84 'chromium/TestRunner/src/TestCommon.h', 83 85 'chromium/TestRunner/src/TestInterfaces.cpp', 84 86 'chromium/TestRunner/src/TestInterfaces.h', -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebPreferences.h
r142109 r142165 35 35 #include "Platform/chromium/public/WebURL.h" 36 36 #include "WebKit/chromium/public/WebSettings.h" 37 #include "WebTestCommon.h" 37 38 38 39 namespace WebKit { … … 42 43 namespace WebTestRunner { 43 44 44 struct W ebPreferences {45 struct WEBTESTRUNNER_EXPORT WebPreferences { 45 46 WebKit::WebString standardFontFamily; 46 47 WebKit::WebString fixedFontFamily; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTask.h
r142109 r142165 32 32 #define WebTask_h 33 33 34 #include "WebTestCommon.h" 35 #include <vector> 36 34 37 namespace WebTestRunner { 35 38 … … 38 41 // WebTask represents a task which can run by WebTestDelegate::postTask() or 39 42 // WebTestDelegate::postDelayedTask(). 40 class W ebTask {43 class WEBTESTRUNNER_EXPORT WebTask { 41 44 public: 42 45 explicit WebTask(WebTaskList*); … … 52 55 }; 53 56 54 class W ebTaskList {57 class WEBTESTRUNNER_EXPORT WebTaskList { 55 58 public: 56 59 WebTaskList(); … … 61 64 62 65 private: 63 class Private; 64 Private* m_private; 66 std::vector<WebTask*> m_tasks; 65 67 }; 66 68 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestCommon.h
r142164 r142165 1 1 /* 2 * Copyright (C) 201 2Google Inc. All rights reserved.2 * Copyright (C) 2013 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #ifndef WebTest Interfaces_h32 #define WebTest Interfaces_h31 #ifndef WebTestCommon_h 32 #define WebTestCommon_h 33 33 34 namespace WebKit { 35 class WebFrame; 36 class WebView; 37 } 34 // ----------------------------------------------------------------------------- 35 // Default configuration 38 36 39 namespace WebTestRunner { 37 #if !defined(WEBTESTRUNNER_IMPLEMENTATION) 38 #define WEBTESTRUNNER_IMPLEMENTATION 0 39 #endif 40 40 41 class TestInterfaces; 42 class WebTestDelegate; 43 class WebTestRunner; 41 // ----------------------------------------------------------------------------- 42 // Exported symbols need to be annotated with WEBTESTRUNNER_EXPORT 44 43 45 class WebTestInterfaces { 46 public: 47 WebTestInterfaces(); 48 ~WebTestInterfaces(); 44 #if defined(WEBTESTRUNNER_DLL) 49 45 50 void setWebView(WebKit::WebView*); 51 void setDelegate(WebTestDelegate*); 52 void bindTo(WebKit::WebFrame*); 53 void resetAll(); 54 void setTestIsRunning(bool); 46 #if defined(WIN32) 47 #if WEBTESTRUNNER_IMPLEMENTATION 48 #define WEBTESTRUNNER_EXPORT __declspec(dllexport) 49 #else 50 #define WEBTESTRUNNER_EXPORT __declspec(dllimport) 51 #endif 55 52 56 WebKit::WebView* webView() const; 57 WebTestRunner* testRunner(); 53 #else // defined(WIN32) 58 54 59 55 #if WEBTESTRUNNER_IMPLEMENTATION 60 TestInterfaces* testInterfaces(); 56 #define WEBTESTRUNNER_EXPORT __attribute__((visibility("default"))) 57 #else 58 #define WEBTESTRUNNER_EXPORT 61 59 #endif 62 60 63 private: 64 TestInterfaces* m_interfaces; 65 }; 61 #endif 66 62 67 } 63 #else // defined(WEBTESTRUNNER_DLL) 68 64 69 #endif // WebTestInterfaces_h 65 #define WEBTESTRUNNER_EXPORT 66 67 #endif 68 69 #endif // WebTestCommon_h -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h
r142109 r142165 32 32 #define WebTestInterfaces_h 33 33 34 #include "WebTestCommon.h" 35 #include <memory> 36 34 37 namespace WebKit { 35 38 class WebFrame; … … 43 46 class WebTestRunner; 44 47 45 class W ebTestInterfaces {48 class WEBTESTRUNNER_EXPORT WebTestInterfaces { 46 49 public: 47 50 WebTestInterfaces(); … … 62 65 63 66 private: 64 TestInterfaces*m_interfaces;67 std::auto_ptr<TestInterfaces> m_interfaces; 65 68 }; 66 69 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestProxy.h
r142109 r142165 43 43 #include "WebKit/chromium/public/WebTextAffinity.h" 44 44 #include "WebKit/chromium/public/WebTextDirection.h" 45 #include "WebTestCommon.h" 45 46 #include <map> 47 #include <memory> 46 48 #include <string> 47 49 … … 80 82 class WebTestRunner; 81 83 82 class W ebTestProxyBase {84 class WEBTESTRUNNER_EXPORT WebTestProxyBase { 83 85 public: 84 86 void setInterfaces(WebTestInterfaces*); … … 166 168 WebTestDelegate* m_delegate; 167 169 168 SpellCheckClient*m_spellcheck;170 std::auto_ptr<SpellCheckClient> m_spellcheck; 169 171 170 172 WebKit::WebRect m_paintRect; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.cpp
r142109 r142165 32 32 #include "AccessibilityUIElementChromium.h" 33 33 34 #include "TestCommon.h" 34 35 #include "WebAccessibilityObject.h" 35 36 #include <public/WebCString.h> … … 37 38 #include <public/WebRect.h> 38 39 #include <public/WebString.h> 39 #include <wtf/Assertions.h>40 #include <wtf/StringExtras.h>41 40 42 41 using namespace WebKit; … … 369 368 { 370 369 371 ASSERT(factory);370 WEBKIT_ASSERT(factory); 372 371 373 372 // … … 1026 1025 1027 1026 AccessibilityUIElement* element = new AccessibilityUIElement(object, this); 1028 m_elements. append(element);1027 m_elements.push_back(element); 1029 1028 return element; 1030 1029 } … … 1033 1032 { 1034 1033 AccessibilityUIElement* element = new RootAccessibilityUIElement(object, this); 1035 m_elements. append(element);1034 m_elements.push_back(element); 1036 1035 return element; 1037 1036 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/AccessibilityUIElementChromium.h
r142109 r142165 35 35 #include "WebAccessibilityObject.h" 36 36 #include <vector> 37 #include <wtf/Vector.h>38 37 39 38 namespace WebTestRunner { … … 169 168 170 169 private: 171 typedef Vector<AccessibilityUIElement*> ElementList;170 typedef std::vector<AccessibilityUIElement*> ElementList; 172 171 ElementList m_elements; 173 172 }; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.cpp
r142109 r142165 43 43 #include "CppBoundClass.h" 44 44 45 #include "TestCommon.h" 45 46 #include "WebBindings.h" 46 47 #include "WebFrame.h" 48 #include <memory> 47 49 #include <public/WebString.h> 48 #include <wtf/Assertions.h>49 #include <wtf/OwnPtr.h>50 50 51 51 using namespace WebKit; … … 78 78 class GetterPropertyCallback : public CppBoundClass::PropertyCallback { 79 79 public: 80 GetterPropertyCallback( PassOwnPtr<CppBoundClass::GetterCallback> callback)80 GetterPropertyCallback(auto_ptr<CppBoundClass::GetterCallback> callback) 81 81 : m_callback(callback) 82 82 { … … 92 92 93 93 private: 94 OwnPtr<CppBoundClass::GetterCallback> m_callback;94 auto_ptr<CppBoundClass::GetterCallback> m_callback; 95 95 }; 96 96 … … 210 210 { 211 211 for (MethodList::iterator i = m_methods.begin(); i != m_methods.end(); ++i) 212 delete i-> value;212 delete i->second; 213 213 214 214 for (PropertyList::iterator i = m_properties.begin(); i != m_properties.end(); ++i) 215 delete i-> value;215 delete i->second; 216 216 217 217 // Unregister ourselves if we were bound to a frame. … … 244 244 callback = m_fallbackCallback.get(); 245 245 } else 246 callback = (*method). value;246 callback = (*method).second; 247 247 248 248 // Build a CppArgumentList argument vector from the NPVariants coming in. … … 267 267 268 268 CppVariant cppValue; 269 if (!callback-> value->getValue(&cppValue))269 if (!callback->second->getValue(&cppValue)) 270 270 return false; 271 271 cppValue.copyToNPVariant(result); … … 281 281 CppVariant cppValue; 282 282 cppValue.set(*value); 283 return (*callback). value->setValue(cppValue);283 return (*callback).second->setValue(cppValue); 284 284 } 285 285 … … 289 289 MethodList::iterator oldCallback = m_methods.find(ident); 290 290 if (oldCallback != m_methods.end()) { 291 delete oldCallback-> value;291 delete oldCallback->second; 292 292 if (!callback) { 293 m_methods. remove(oldCallback);293 m_methods.erase(oldCallback); 294 294 return; 295 295 } 296 296 } 297 297 298 m_methods .set(ident, callback);299 } 300 301 void CppBoundClass::bindGetterCallback(const string& name, PassOwnPtr<GetterCallback> callback)302 { 303 PropertyCallback* propertyCallback = callback ? new GetterPropertyCallback(callback) : 0;298 m_methods[ident] = callback; 299 } 300 301 void CppBoundClass::bindGetterCallback(const string& name, auto_ptr<GetterCallback> callback) 302 { 303 PropertyCallback* propertyCallback = callback.get() ? new GetterPropertyCallback(callback) : 0; 304 304 bindProperty(name, propertyCallback); 305 305 } … … 316 316 PropertyList::iterator oldCallback = m_properties.find(ident); 317 317 if (oldCallback != m_properties.end()) { 318 delete oldCallback-> value;318 delete oldCallback->second; 319 319 if (!callback) { 320 m_properties. remove(oldCallback);320 m_properties.erase(oldCallback); 321 321 return; 322 322 } 323 323 } 324 324 325 m_properties .set(ident, callback);325 m_properties[ident] = callback; 326 326 } 327 327 … … 345 345 WebBindings::releaseObject(npObj); // CppVariant takes the reference. 346 346 } 347 ASSERT(m_selfVariant.isObject());347 WEBKIT_ASSERT(m_selfVariant.isObject()); 348 348 return &m_selfVariant; 349 349 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/CppBoundClass.h
r142109 r142165 45 45 46 46 #include "CppVariant.h" 47 #include <wtf/HashMap.h> 48 #include <wtf/Noncopyable.h> 49 #include <wtf/OwnPtr.h> 50 #include <wtf/PassOwnPtr.h> 51 #include <wtf/Vector.h> 47 #include <map> 48 #include <memory> 49 #include <vector> 52 50 53 51 namespace WebKit { … … 58 56 namespace WebTestRunner { 59 57 60 typedef Vector<CppVariant> CppArgumentList;58 typedef std::vector<CppVariant> CppArgumentList; 61 59 62 60 // CppBoundClass lets you map Javascript method calls and property accesses 63 61 // directly to C++ method calls and CppVariant* variable access. 64 62 class CppBoundClass { 65 WTF_MAKE_NONCOPYABLE(CppBoundClass);66 63 public: 67 64 class PropertyCallback { … … 165 162 // Bind Javascript property |name| to the C++ getter callback |callback|. 166 163 // This can be used to create read-only properties. 167 void bindGetterCallback(const std::string&, PassOwnPtr<GetterCallback>);164 void bindGetterCallback(const std::string&, std::auto_ptr<GetterCallback>); 168 165 169 166 // A wrapper for BindGetterCallback, to simplify the common case of binding a … … 173 170 void bindProperty(const std::string& name, void (T::*method)(CppVariant*)) 174 171 { 175 OwnPtr<GetterCallback> callback = adoptPtr(new MemberGetterCallback<T>(static_cast<T*>(this), method));176 bindGetterCallback(name, callback .release());172 std::auto_ptr<GetterCallback> callback(new MemberGetterCallback<T>(static_cast<T*>(this), method)); 173 bindGetterCallback(name, callback); 177 174 } 178 175 … … 194 191 // fallback always returns true when checked for a method's 195 192 // existence). 196 void bindFallbackCallback( PassOwnPtr<Callback> fallbackCallback)193 void bindFallbackCallback(std::auto_ptr<Callback> fallbackCallback) 197 194 { 198 195 m_fallbackCallback = fallbackCallback; … … 206 203 void bindFallbackMethod(void (T::*method)(const CppArgumentList&, CppVariant*)) 207 204 { 208 if (method) { 209 OwnPtr<Callback> callback = adoptPtr(new MemberCallback<T>(static_cast<T*>(this), method)); 210 bindFallbackCallback(callback.release()); 211 } else 212 bindFallbackCallback(nullptr); 205 if (method) 206 bindFallbackCallback(std::auto_ptr<Callback>(new MemberCallback<T>(static_cast<T*>(this), method))); 207 else 208 bindFallbackCallback(std::auto_ptr<Callback>()); 213 209 } 214 210 … … 216 212 // but otherwise they should be considered private. 217 213 218 typedef HashMap<NPIdentifier, PropertyCallback*> PropertyList;219 typedef HashMap<NPIdentifier, Callback*> MethodList;214 typedef std::map<NPIdentifier, PropertyCallback*> PropertyList; 215 typedef std::map<NPIdentifier, Callback*> MethodList; 220 216 // These maps associate names with property and method pointers to be 221 217 // exposed to JavaScript. … … 224 220 225 221 // The callback gets invoked when a call is made to an nonexistent method. 226 OwnPtr<Callback> m_fallbackCallback;222 std::auto_ptr<Callback> m_fallbackCallback; 227 223 228 224 private: … … 243 239 // be unregistered with V8 when we delete it. 244 240 bool m_boundToFrame; 241 242 private: 243 CppBoundClass(CppBoundClass&); 244 CppBoundClass& operator=(const CppBoundClass&); 245 245 }; 246 246 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.cpp
r142109 r142165 32 32 #include "CppVariant.h" 33 33 34 #include "TestCommon.h" 34 35 #include "WebBindings.h" 35 36 #include <limits> 36 #include <wtf/Assertions.h>37 #include <wtf/StringExtras.h>38 37 39 38 using namespace WebKit; … … 221 220 string CppVariant::toString() const 222 221 { 223 ASSERT(isString());222 WEBKIT_ASSERT(isString()); 224 223 return string(value.stringValue.UTF8Characters, 225 224 value.stringValue.UTF8Length); … … 232 231 if (isDouble()) 233 232 return static_cast<int32_t>(value.doubleValue); 234 ASSERT_NOT_REACHED();233 WEBKIT_ASSERT_NOT_REACHED(); 235 234 return 0; 236 235 } … … 242 241 if (isDouble()) 243 242 return value.doubleValue; 244 ASSERT_NOT_REACHED();243 WEBKIT_ASSERT_NOT_REACHED(); 245 244 return 0; 246 245 } … … 248 247 bool CppVariant::toBoolean() const 249 248 { 250 ASSERT(isBool());249 WEBKIT_ASSERT(isBool()); 251 250 return value.boolValue; 252 251 } 253 252 254 Vector<string> CppVariant::toStringVector() const255 { 256 257 ASSERT(isObject());258 Vector<string> stringVector;253 vector<string> CppVariant::toStringVector() const 254 { 255 256 WEBKIT_ASSERT(isObject()); 257 vector<string> stringVector; 259 258 NPObject* npValue = value.objectValue; 260 259 NPIdentifier lengthId = WebBindings::getStringIdentifier("length"); … … 291 290 string item(NPVARIANT_TO_STRING(indexValue).UTF8Characters, 292 291 NPVARIANT_TO_STRING(indexValue).UTF8Length); 293 stringVector. append(item);292 stringVector.push_back(item); 294 293 } 295 294 WebBindings::releaseVariantValue(&indexValue); … … 301 300 uint32_t argumentCount, CppVariant& result) const 302 301 { 303 ASSERT(isObject());302 WEBKIT_ASSERT(isObject()); 304 303 NPIdentifier methodName = WebBindings::getStringIdentifier(method.c_str()); 305 304 NPObject* npObject = value.objectValue; … … 315 314 CppVariant& result) const 316 315 { 317 ASSERT(isObject());316 WEBKIT_ASSERT(isObject()); 318 317 NPObject* npObject = value.objectValue; 319 318 NPVariant r; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/CppVariant.h
r142109 r142165 45 45 #include "WebBindings.h" 46 46 #include <string> 47 #include < wtf/Vector.h>47 #include <vector> 48 48 49 49 namespace WebTestRunner { … … 121 121 // Returns a vector of strings for the specified argument. This is useful 122 122 // for converting a JavaScript array of strings into a vector of strings. 123 Vector<std::string> toStringVector() const;123 std::vector<std::string> toStringVector() const; 124 124 125 125 // Invoke method of the given name on an object with the supplied arguments. -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/EventSender.cpp
r142109 r142165 46 46 #include "KeyCodeMapping.h" 47 47 #include "MockSpellCheck.h" 48 #include "TestCommon.h" 48 49 #include "WebContextMenuData.h" 49 50 #include "WebDragOperation.h" … … 51 52 #include "WebTouchPoint.h" 52 53 #include "WebView.h" 54 #include <deque> 53 55 #include <public/WebDragData.h> 54 56 #include <public/WebPoint.h> 55 57 #include <public/WebString.h> 56 58 #include <public/WebVector.h> 57 #include <wtf/Deque.h> 58 #include <wtf/StringExtras.h> 59 60 #if OS(WINDOWS) 59 60 #ifdef WIN32 61 61 #include "win/WebInputEventFactory.h" 62 62 #endif … … 98 98 WebDragOperationsMask currentDragEffectsAllowed; 99 99 bool replayingSavedEvents = false; 100 Deque<SavedEvent> mouseEventQueue;100 deque<SavedEvent> mouseEventQueue; 101 101 int touchModifiers; 102 Vector<WebTouchPoint> touchPoints;102 vector<WebTouchPoint> touchPoints; 103 103 104 104 // Time and place of the last mouse up event. … … 156 156 const char* characters = modifierName.c_str(); 157 157 if (!strcmp(characters, "ctrlKey") 158 #if !OS(MAC_OS_X)158 #ifndef __APPLE__ 159 159 || !strcmp(characters, "addSelectionKey") 160 160 #endif … … 165 165 else if (!strcmp(characters, "altKey")) { 166 166 event->modifiers |= WebInputEvent::AltKey; 167 #if !OS(MAC_OS_X)167 #ifndef __APPLE__ 168 168 // On Windows all keys with Alt modifier will be marked as system key. 169 169 // We keep the same behavior on Linux and everywhere non-Mac, see: … … 173 173 isSystemKey = true; 174 174 #endif 175 #if OS(MAC_OS_X)175 #ifdef __APPLE__ 176 176 } else if (!strcmp(characters, "metaKey") || !strcmp(characters, "addSelectionKey")) { 177 177 event->modifiers |= WebInputEvent::MetaKey; … … 192 192 bool isSystemKey = false; 193 193 if (argument->isObject()) { 194 Vector<string> modifiers = argument->toStringVector();195 for ( Vector<string>::const_iterator i = modifiers.begin(); i != modifiers.end(); ++i)194 vector<string> modifiers = argument->toStringVector(); 195 for (vector<string>::const_iterator i = modifiers.begin(); i != modifiers.end(); ++i) 196 196 isSystemKey |= applyKeyModifier(*i, event); 197 197 } else if (argument->isString()) … … 205 205 bool getEditCommand(const WebKeyboardEvent& event, string* name) 206 206 { 207 #if OS(MAC_OS_X)207 #ifdef __APPLE__ 208 208 // We only cares about Left,Right,Up,Down keys with Command or Command+Shift 209 209 // modifiers. These key events correspond to some special movement and … … 308 308 // events so we can simulate drag & drop. 309 309 bindProperty("dragMode", &dragMode); 310 #if OS(WINDOWS)310 #ifdef WIN32 311 311 bindProperty("WM_KEYDOWN", &wmKeyDown); 312 312 bindProperty("WM_KEYUP", &wmKeyUp); … … 323 323 { 324 324 // The test should have finished a drag and the mouse button state. 325 ASSERT(currentDragData.isNull());325 WEBKIT_ASSERT(currentDragData.isNull()); 326 326 currentDragData.reset(); 327 327 currentDragEffect = WebKit::WebDragOperationNone; … … 329 329 pressedButton = WebMouseEvent::ButtonNone; 330 330 dragMode.set(true); 331 #if OS(WINDOWS)331 #ifdef WIN32 332 332 wmKeyDown.set(WM_KEYDOWN); 333 333 wmKeyUp.set(WM_KEYUP); … … 419 419 420 420 int buttonNumber = getButtonNumberFromSingleArg(arguments); 421 ASSERT(buttonNumber != -1);421 WEBKIT_ASSERT(buttonNumber != -1); 422 422 423 423 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumber); … … 441 441 442 442 int buttonNumber = getButtonNumberFromSingleArg(arguments); 443 ASSERT(buttonNumber != -1);443 WEBKIT_ASSERT(buttonNumber != -1); 444 444 445 445 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumber); … … 449 449 savedEvent.type = SavedEvent::MouseUp; 450 450 savedEvent.buttonType = buttonType; 451 mouseEventQueue. append(savedEvent);451 mouseEventQueue.push_back(savedEvent); 452 452 replaySavedEvents(); 453 453 } else { … … 506 506 savedEvent.type = SavedEvent::MouseMove; 507 507 savedEvent.pos = mousePos; 508 mouseEventQueue. append(savedEvent);508 mouseEventQueue.push_back(savedEvent); 509 509 } else { 510 510 WebMouseEvent event; … … 599 599 if (!code) { 600 600 WebString webCodeStr = WebString::fromUTF8(codeStr.data(), codeStr.size()); 601 ASSERT(webCodeStr.length() == 1);601 WEBKIT_ASSERT(webCodeStr.length() == 1); 602 602 text = code = webCodeStr.data()[0]; 603 603 needsShiftKeyModifier = needsShiftModifier(code); … … 617 617 eventDown.modifiers = 0; 618 618 eventDown.windowsKeyCode = code; 619 #if OS(LINUX) && USE(GTK)619 #if defined(__linux__) && USE(GTK) 620 620 eventDown.nativeKeyCode = NativeKeyCodeForWindowsKeyCode(code); 621 621 #endif … … 679 679 result->setNull(); 680 680 681 #if OS(WINDOWS)681 #ifdef WIN32 682 682 if (arguments.size() == 3) { 683 683 // Grab the message id to see if we need to dispatch it. … … 695 695 webview()->handleInputEvent(WebInputEventFactory::keyboardEvent(0, msg, arguments[1].toInt32(), lparam)); 696 696 } else 697 ASSERT_NOT_REACHED();697 WEBKIT_ASSERT_NOT_REACHED(); 698 698 #endif 699 699 } … … 719 719 savedEvent.type = SavedEvent::LeapForward; 720 720 savedEvent.milliseconds = milliseconds; 721 mouseEventQueue. append(savedEvent);721 mouseEventQueue.push_back(savedEvent); 722 722 } else 723 723 doLeapForward(milliseconds); … … 780 780 { 781 781 replayingSavedEvents = true; 782 while (!mouseEventQueue.isEmpty()) { 783 SavedEvent e = mouseEventQueue.takeFirst(); 782 while (!mouseEventQueue.empty()) { 783 SavedEvent e = mouseEventQueue.front(); 784 mouseEventQueue.pop_front(); 784 785 785 786 switch (e.type) { … … 800 801 } 801 802 default: 802 ASSERT_NOT_REACHED();803 WEBKIT_ASSERT_NOT_REACHED(); 803 804 } 804 805 } … … 814 815 // - Some test even checks actual string content. So providing it would be also helpful. 815 816 // 816 static Vector<WebString> makeMenuItemStringsFor(WebContextMenuData* contextMenu, WebTestDelegate* delegate)817 static vector<WebString> makeMenuItemStringsFor(WebContextMenuData* contextMenu, WebTestDelegate* delegate) 817 818 { 818 819 // These constants are based on Safari's context menu because tests are made for it. … … 822 823 // This is possible because mouse events are cancelleable. 823 824 if (!contextMenu) 824 return Vector<WebString>();825 826 Vector<WebString> strings;825 return vector<WebString>(); 826 827 vector<WebString> strings; 827 828 828 829 if (contextMenu->isEditable) { 829 830 for (const char** item = editableMenuStrings; *item; ++item) 830 strings. append(WebString::fromUTF8(*item));831 strings.push_back(WebString::fromUTF8(*item)); 831 832 WebVector<WebString> suggestions; 832 833 MockSpellCheck::fillSuggestionList(contextMenu->misspelledWord, &suggestions); 833 834 for (size_t i = 0; i < suggestions.size(); ++i) 834 strings. append(suggestions[i]);835 strings.push_back(suggestions[i]); 835 836 } else { 836 837 for (const char** item = nonEditableMenuStrings; *item; ++item) 837 strings. append(WebString::fromUTF8(*item));838 strings.push_back(WebString::fromUTF8(*item)); 838 839 } 839 840 … … 860 861 webview()->handleInputEvent(event); 861 862 862 #if OS(WINDOWS)863 #ifdef WIN32 863 864 initMouseEvent(WebInputEvent::MouseUp, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); 864 865 webview()->handleInputEvent(event); … … 917 918 { 918 919 currentDragData.initialize(); 919 Vector<string> files = arguments[0].toStringVector();920 vector<string> files = arguments[0].toStringVector(); 920 921 WebVector<WebString> absoluteFilenames(files.size()); 921 922 for (size_t i = 0; i < files.size(); ++i) { … … 956 957 } 957 958 touchPoint.id = lowestId; 958 touchPoints. append(touchPoint);959 touchPoints.push_back(touchPoint); 959 960 } 960 961 … … 970 971 971 972 const unsigned index = arguments[0].toInt32(); 972 ASSERT(index < touchPoints.size());973 WEBKIT_ASSERT(index < touchPoints.size()); 973 974 974 975 WebTouchPoint* touchPoint = &touchPoints[index]; … … 1002 1003 1003 1004 const unsigned index = arguments[0].toInt32(); 1004 ASSERT(index < touchPoints.size());1005 WEBKIT_ASSERT(index < touchPoints.size()); 1005 1006 1006 1007 WebPoint position(arguments[1].toInt32(), arguments[2].toInt32()); … … 1016 1017 1017 1018 const unsigned index = arguments[0].toInt32(); 1018 ASSERT(index < touchPoints.size());1019 WEBKIT_ASSERT(index < touchPoints.size()); 1019 1020 1020 1021 WebTouchPoint* touchPoint = &touchPoints[index]; … … 1024 1025 void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type) 1025 1026 { 1026 ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touchPoints.size());1027 WEBKIT_ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touchPoints.size()); 1027 1028 webview()->layout(); 1028 1029 … … 1039 1040 WebTouchPoint* touchPoint = &touchPoints[i]; 1040 1041 if (touchPoint->state == WebTouchPoint::StateReleased) { 1041 touchPoints. remove(i);1042 touchPoints.erase(touchPoints.begin() + i); 1042 1043 --i; 1043 1044 } else … … 1266 1267 break; 1267 1268 default: 1268 ASSERT_NOT_REACHED();1269 WEBKIT_ASSERT_NOT_REACHED(); 1269 1270 } 1270 1271 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp
r142109 r142165 32 32 #include "KeyCodeMapping.h" 33 33 34 #include <wtf/UnusedParam.h>35 36 34 namespace WebTestRunner { 37 35 38 36 int NativeKeyCodeForWindowsKeyCode(int keysym) 39 37 { 40 #if OS(LINUX) && USE(GTK)38 #if defined(__linux__) && USE(GTK) 41 39 // See /usr/share/X11/xkb/keycodes/* 42 40 static const int asciiToKeyCode[] = { … … 241 239 } 242 240 #else 243 UNUSED_PARAM(keysym); 244 return 0; 241 return keysym - keysym; 245 242 #endif 246 243 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockGrammarCheck.cpp
r142109 r142165 32 32 #include "MockGrammarCheck.h" 33 33 34 #include "Platform/chromium/public/WebCString.h" 34 35 #include "Platform/chromium/public/WebString.h" 36 #include "TestCommon.h" 35 37 #include "WebTextCheckingResult.h" 36 37 #include <wtf/ASCIICType.h> 38 #include <wtf/Assertions.h> 39 #include <wtf/text/WTFString.h> 38 #include <algorithm> 40 39 41 40 using namespace WebKit; 41 using namespace std; 42 42 43 bool MockGrammarCheck::checkGrammarOfString(const WebString& text, Vector<WebTextCheckingResult>* results) 43 namespace WebTestRunner { 44 45 bool MockGrammarCheck::checkGrammarOfString(const WebString& text, vector<WebTextCheckingResult>* results) 44 46 { 45 ASSERT(results);46 WTF::String stringText(text.data(), text.length());47 if ( stringText.find(isASCIIAlpha) == static_cast<size_t>(-1))47 WEBKIT_ASSERT(results); 48 string16 stringText = text; 49 if (find_if(stringText.begin(), stringText.end(), isASCIIAlpha) == stringText.end()) 48 50 return true; 49 51 … … 70 72 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(grammarErrors); ++i) { 71 73 int offset = 0; 72 while ((offset = stringText.find(grammarErrors[i].text, offset)) != -1) { 73 results->append(WebTextCheckingResult(WebTextCheckingTypeGrammar, offset + grammarErrors[i].location, grammarErrors[i].length)); 74 string16 error(grammarErrors[i].text, grammarErrors[i].text + strlen(grammarErrors[i].text)); 75 while ((offset = stringText.find(error, offset)) != string16::npos) { 76 results->push_back(WebTextCheckingResult(WebTextCheckingTypeGrammar, offset + grammarErrors[i].location, grammarErrors[i].length)); 74 77 offset += grammarErrors[i].length; 75 78 } … … 77 80 return false; 78 81 } 82 83 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockGrammarCheck.h
r142109 r142165 32 32 #define MockGrammarCheck_h 33 33 34 #include <wtf/Vector.h> 35 #include <wtf/text/WTFString.h> 34 #include <vector> 36 35 37 36 namespace WebKit { … … 42 41 } 43 42 43 namespace WebTestRunner { 44 44 45 // A mock implementation of a grammar-checker used for WebKit tests. This class 45 46 // only implements the minimal functionarities required by WebKit tests, i.e. … … 49 50 class MockGrammarCheck { 50 51 public: 51 static bool checkGrammarOfString(const WebKit::WebString&, Vector<WebKit::WebTextCheckingResult>*);52 static bool checkGrammarOfString(const WebKit::WebString&, std::vector<WebKit::WebTextCheckingResult>*); 52 53 }; 53 54 55 } 56 54 57 #endif // MockSpellCheck_h -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.cpp
r142109 r142165 32 32 #include "MockSpellCheck.h" 33 33 34 #include <wtf/ASCIICType.h> 35 #include <wtf/Assertions.h> 36 #include <wtf/text/WTFString.h> 34 #include "TestCommon.h" 35 #include <public/WebCString.h> 37 36 38 37 using namespace WebKit; 38 using namespace std; 39 39 40 static void append(WebVector<WebString>* data, const WebString& item) 40 namespace WebTestRunner { 41 42 namespace { 43 44 void append(WebVector<WebString>* data, const WebString& item) 41 45 { 42 46 WebVector<WebString> result(data->size() + 1); … … 47 51 } 48 52 53 } 54 49 55 MockSpellCheck::MockSpellCheck() 50 56 : m_initialized(false) { } … … 52 58 MockSpellCheck::~MockSpellCheck() { } 53 59 54 static bool isNotASCIIAlpha(UChar ch) { return !isASCIIAlpha(ch); }55 56 60 bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset, int* misspelledLength) 57 61 { 58 ASSERT(misspelledOffset);59 ASSERT(misspelledLength);62 WEBKIT_ASSERT(misspelledOffset); 63 WEBKIT_ASSERT(misspelledLength); 60 64 61 65 // Initialize this spellchecker. … … 66 70 *misspelledLength = 0; 67 71 68 // Convert to a String because we store Stringinstances in72 // Convert to a string16 because we store string16 instances in 69 73 // m_misspelledWords and WebString has no find(). 70 String stringText(text.data(), text.length());74 string16 stringText = text; 71 75 int skippedLength = 0; 72 76 73 while (!stringText. isEmpty()) {77 while (!stringText.empty()) { 74 78 // Extract the first possible English word from the given string. 75 79 // The given string may include non-ASCII characters or numbers. So, we … … 79 83 // If the given string doesn't include any ASCII characters, we can treat the 80 84 // string as valid one. 81 int wordOffset = stringText.find(isASCIIAlpha);82 if ( wordOffset == -1)85 string16::iterator firstChar = find_if(stringText.begin(), stringText.end(), isASCIIAlpha); 86 if (firstChar == stringText.end()) 83 87 return true; 88 int wordOffset = distance(stringText.begin(), firstChar); 84 89 int maxWordLength = static_cast<int>(stringText.length()) - wordOffset; 85 90 int wordLength; 86 Stringword;91 string16 word; 87 92 88 93 // Look up our misspelled-word table to check if the extracted word is a … … 93 98 for (size_t i = 0; i < m_misspelledWords.size(); ++i) { 94 99 wordLength = static_cast<int>(m_misspelledWords.at(i).length()) > maxWordLength ? maxWordLength : static_cast<int>(m_misspelledWords.at(i).length()); 95 word = stringText.substr ing(wordOffset, wordLength);100 word = stringText.substr(wordOffset, wordLength); 96 101 if (word == m_misspelledWords.at(i) && (static_cast<int>(stringText.length()) == wordOffset + wordLength || isNotASCIIAlpha(stringText[wordOffset + wordLength]))) { 97 102 *misspelledOffset = wordOffset + skippedLength; … … 104 109 break; 105 110 106 int wordEnd = stringText.find(isNotASCIIAlpha, wordOffset); 107 wordLength = wordEnd == -1 ? static_cast<int>(stringText.length()) - wordOffset : wordEnd - wordOffset; 111 string16::iterator lastChar = find_if(stringText.begin() + wordOffset, stringText.end(), isNotASCIIAlpha); 112 if (lastChar == stringText.end()) 113 wordLength = static_cast<int>(stringText.length()) - wordOffset; 114 else 115 wordLength = distance(firstChar, lastChar); 108 116 109 ASSERT(0 < wordOffset + wordLength);110 stringText = stringText.substr ing(wordOffset + wordLength);117 WEBKIT_ASSERT(0 < wordOffset + wordLength); 118 stringText = stringText.substr(wordOffset + wordLength); 111 119 skippedLength += wordOffset + wordLength; 112 120 } … … 171 179 m_misspelledWords.clear(); 172 180 for (size_t i = 0; i < arraysize(misspelledWords); ++i) 173 m_misspelledWords. append(String::fromUTF8(misspelledWords[i]));181 m_misspelledWords.push_back(string16(misspelledWords[i], misspelledWords[i] + strlen(misspelledWords[i]))); 174 182 175 183 // Mark as initialized to prevent this object from being initialized twice … … 181 189 return false; 182 190 } 191 192 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/MockSpellCheck.h
r142109 r142165 34 34 #include "Platform/chromium/public/WebString.h" 35 35 #include "Platform/chromium/public/WebVector.h" 36 #include <wtf/Vector.h> 37 #include <wtf/text/WTFString.h> 36 #include <vector> 37 38 namespace WebTestRunner { 38 39 39 40 // A mock implementation of a spell-checker used for WebKit tests. … … 71 72 72 73 // A table that consists of misspelled words. 73 Vector<String> m_misspelledWords;74 std::vector<string16> m_misspelledWords; 74 75 75 76 // A flag representing whether or not this object is initialized. … … 77 78 }; 78 79 80 } 81 79 82 #endif // MockSpellCheck_h -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/SpellCheckClient.cpp
r142109 r142165 38 38 39 39 using namespace WebKit; 40 using namespace std; 40 41 41 42 namespace WebTestRunner { … … 82 83 void SpellCheckClient::checkTextOfParagraph(const WebString& text, WebTextCheckingTypeMask mask, WebVector<WebTextCheckingResult>* webResults) 83 84 { 84 Vector<WebTextCheckingResult> results;85 vector<WebTextCheckingResult> results; 85 86 if (mask & WebTextCheckingTypeSpelling) { 86 87 size_t offset = 0; … … 97 98 result.location = offset + misspelledPosition; 98 99 result.length = misspelledLength; 99 results. append(result);100 results.push_back(result); 100 101 offset += misspelledPosition + misspelledLength; 101 102 } … … 121 122 void SpellCheckClient::finishLastTextCheck() 122 123 { 123 Vector<WebTextCheckingResult> results;124 vector<WebTextCheckingResult> results; 124 125 int offset = 0; 125 String text(m_lastRequestedTextCheckString.data(), m_lastRequestedTextCheckString.length());126 string16 text = m_lastRequestedTextCheckString; 126 127 while (text.length()) { 127 128 int misspelledPosition = 0; 128 129 int misspelledLength = 0; 129 m_spellcheck.spellCheckWord(WebString(text .characters(), text.length()), &misspelledPosition, &misspelledLength);130 m_spellcheck.spellCheckWord(WebString(text), &misspelledPosition, &misspelledLength); 130 131 if (!misspelledLength) 131 132 break; 132 133 WebVector<WebString> suggestions; 133 m_spellcheck.fillSuggestionList(WebString(text. characters() + misspelledPosition, misspelledLength), &suggestions);134 results. append(WebTextCheckingResult(WebTextCheckingTypeSpelling, offset + misspelledPosition, misspelledLength, suggestions.isEmpty() ? WebString() : suggestions[0]));135 text = text.substr ing(misspelledPosition + misspelledLength);134 m_spellcheck.fillSuggestionList(WebString(text.substr(misspelledPosition, misspelledLength)), &suggestions); 135 results.push_back(WebTextCheckingResult(WebTextCheckingTypeSpelling, offset + misspelledPosition, misspelledLength, suggestions.isEmpty() ? WebString() : suggestions[0])); 136 text = text.substr(misspelledPosition + misspelledLength); 136 137 offset += misspelledPosition + misspelledLength; 137 138 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestCommon.h
r142164 r142165 1 1 /* 2 * Copyright (C) 201 2Google Inc. All rights reserved.2 * Copyright (C) 2013 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #ifndef WebTestInterfaces_h32 #define WebTestInterfaces_h31 #ifndef TestCommon_h 32 #define TestCommon_h 33 33 34 namespace WebKit { 35 class WebFrame; 36 class WebView; 37 } 34 #include <base/compiler_specific.h> 35 #include <public/WebCommon.h> 36 #include <stdio.h> 38 37 39 namespace WebTestRunner { 40 41 class TestInterfaces; 42 class WebTestDelegate; 43 class WebTestRunner; 44 45 class WebTestInterfaces { 46 public: 47 WebTestInterfaces(); 48 ~WebTestInterfaces(); 49 50 void setWebView(WebKit::WebView*); 51 void setDelegate(WebTestDelegate*); 52 void bindTo(WebKit::WebFrame*); 53 void resetAll(); 54 void setTestIsRunning(bool); 55 56 WebKit::WebView* webView() const; 57 WebTestRunner* testRunner(); 58 59 #if WEBTESTRUNNER_IMPLEMENTATION 60 TestInterfaces* testInterfaces(); 38 #if defined(WIN32) 39 #define snprintf(str, size, ...) _snprintf_s(str, size, size, __VA_ARGS__) 61 40 #endif 62 41 63 private: 64 TestInterfaces* m_interfaces; 65 }; 42 inline bool isASCIIAlpha(char ch) { return (ch | 0x20) >= 'a' && (ch | 0x20) <= 'z'; } 66 43 67 }44 inline bool isNotASCIIAlpha(char ch) { return !isASCIIAlpha(ch); } 68 45 69 #endif // WebTestInterfaces_h46 #endif // TestCommon_h -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.cpp
r142109 r142165 46 46 47 47 TestInterfaces::TestInterfaces() 48 : m_webView(0) 48 : m_accessibilityController(new AccessibilityController()) 49 , m_eventSender(new EventSender()) 50 , m_gamepadController(new GamepadController()) 51 , m_textInputController(new TextInputController()) 52 , m_testRunner(new TestRunner()) 53 , m_webView(0) 49 54 { 50 m_accessibilityController = adoptPtr(new AccessibilityController());51 m_eventSender = adoptPtr(new EventSender());52 m_gamepadController = adoptPtr(new GamepadController());53 m_textInputController = adoptPtr(new TextInputController());54 m_testRunner = adoptPtr(new TestRunner());55 55 } 56 56 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestInterfaces.h
r142109 r142165 32 32 #define TestInterfaces_h 33 33 34 #include < wtf/OwnPtr.h>34 #include <memory> 35 35 36 36 namespace WebKit { … … 66 66 67 67 private: 68 OwnPtr<AccessibilityController> m_accessibilityController;69 OwnPtr<EventSender> m_eventSender;70 OwnPtr<GamepadController> m_gamepadController;71 OwnPtr<TextInputController> m_textInputController;72 OwnPtr<TestRunner> m_testRunner;68 std::auto_ptr<AccessibilityController> m_accessibilityController; 69 std::auto_ptr<EventSender> m_eventSender; 70 std::auto_ptr<GamepadController> m_gamepadController; 71 std::auto_ptr<TextInputController> m_textInputController; 72 std::auto_ptr<TestRunner> m_testRunner; 73 73 WebKit::WebView* m_webView; 74 74 }; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestPlugin.cpp
r142109 r142165 27 27 #include "TestPlugin.h" 28 28 29 #include "TestCommon.h" 29 30 #include "WebFrame.h" 30 31 #include "WebInputEvent.h" … … 36 37 #include <public/WebCompositorSupport.h> 37 38 #include <public/WebGraphicsContext3D.h> 38 #include <wtf/Assertions.h>39 #include <wtf/PassOwnPtr.h>40 #include <wtf/StringExtras.h>41 #include <wtf/text/CString.h>42 39 43 40 using namespace WebKit; 41 using namespace std; 44 42 45 43 namespace WebTestRunner { … … 100 98 } 101 99 102 ASSERT_NOT_REACHED();100 WEBKIT_ASSERT_NOT_REACHED(); 103 101 return 0; 104 102 } … … 135 133 WebPluginContainer::TouchEventRequestType parseTouchEventRequestType(const WebString& string) 136 134 { 137 DEFINE_STATIC_LOCAL(const WebString, kPrimitiveRaw, (WebString::fromUTF8("raw"))); 138 DEFINE_STATIC_LOCAL(const WebString, kPrimitiveSynthetic, (WebString::fromUTF8("synthetic"))); 139 140 if (string == kPrimitiveRaw) 135 if (string == WebString::fromUTF8("raw")) 141 136 return WebPluginContainer::TouchEventRequestTypeRaw; 142 if (string == kPrimitiveSynthetic)137 if (string == WebString::fromUTF8("synthetic")) 143 138 return WebPluginContainer::TouchEventRequestTypeSynthesizedMouse; 144 139 return WebPluginContainer::TouchEventRequestTypeNone; … … 169 164 static const WebString kAttributePrintUserGestureStatus = WebString::fromUTF8("print-user-gesture-status"); 170 165 171 ASSERT(params.attributeNames.size() == params.attributeValues.size());166 WEBKIT_ASSERT(params.attributeNames.size() == params.attributeValues.size()); 172 167 size_t size = params.attributeNames.size(); 173 168 for (size_t i = 0; i < size; ++i) { … … 213 208 return false; 214 209 215 m_layer = a doptPtr(Platform::current()->compositorSupport()->createExternalTextureLayer(this));210 m_layer = auto_ptr<WebExternalTextureLayer>(Platform::current()->compositorSupport()->createExternalTextureLayer(this)); 216 211 m_container = container; 217 212 m_container->setWebLayer(m_layer->layer()); … … 229 224 if (m_container) 230 225 m_container->setWebLayer(0); 231 m_layer. clear();226 m_layer.reset(); 232 227 destroyScene(); 233 228 … … 276 271 primitive = PrimitiveTriangle; 277 272 else 278 ASSERT_NOT_REACHED();273 WEBKIT_ASSERT_NOT_REACHED(); 279 274 return primitive; 280 275 } … … 295 290 color[2] = 255; 296 291 else 297 ASSERT_NOT_REACHED();292 WEBKIT_ASSERT_NOT_REACHED(); 298 293 } 299 294 … … 362 357 bool TestPlugin::initProgram() 363 358 { 364 const CString vertexSource(359 const string vertexSource( 365 360 "attribute vec4 position; \n" 366 361 "void main() { \n" … … 369 364 ); 370 365 371 const CString fragmentSource(366 const string fragmentSource( 372 367 "precision mediump float; \n" 373 368 "uniform vec4 color; \n" … … 388 383 bool TestPlugin::initPrimitive() 389 384 { 390 ASSERT(m_scene.primitive == PrimitiveTriangle);385 WEBKIT_ASSERT(m_scene.primitive == PrimitiveTriangle); 391 386 392 387 m_scene.vbo = m_context->createBuffer(); … … 406 401 void TestPlugin::drawPrimitive() 407 402 { 408 ASSERT(m_scene.primitive == PrimitiveTriangle);409 ASSERT(m_scene.vbo);410 ASSERT(m_scene.program);403 WEBKIT_ASSERT(m_scene.primitive == PrimitiveTriangle); 404 WEBKIT_ASSERT(m_scene.vbo); 405 WEBKIT_ASSERT(m_scene.program); 411 406 412 407 m_context->useProgram(m_scene.program); … … 424 419 } 425 420 426 unsigned TestPlugin::loadShader(unsigned type, const CString& source)421 unsigned TestPlugin::loadShader(unsigned type, const string& source) 427 422 { 428 423 unsigned shader = m_context->createShader(type); … … 441 436 } 442 437 443 unsigned TestPlugin::loadProgram(const CString& vertexSource, const CString& fragmentSource)438 unsigned TestPlugin::loadProgram(const string& vertexSource, const string& fragmentSource) 444 439 { 445 440 unsigned vertexShader = loadShader(GL_VERTEX_SHADER, vertexSource); … … 534 529 break; 535 530 case WebDragStatusUnknown: 536 ASSERT_NOT_REACHED();531 WEBKIT_ASSERT_NOT_REACHED(); 537 532 } 538 533 m_delegate->printMessage(std::string("Plugin received event: ") + dragStatusName + "\n"); -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestPlugin.h
r142109 r142165 29 29 #include "WebPlugin.h" 30 30 #include "WebPluginContainer.h" 31 #include <memory> 31 32 #include <public/WebExternalTextureLayer.h> 32 33 #include <public/WebExternalTextureLayerClient.h> 33 #include < wtf/OwnPtr.h>34 #include <string> 34 35 35 36 namespace WebTestRunner { … … 125 126 bool initPrimitive(); 126 127 void drawPrimitive(); 127 unsigned loadShader(unsigned type, const WTF::CString& source);128 unsigned loadProgram(const WTF::CString& vertexSource, const WTF::CString& fragmentSource);128 unsigned loadShader(unsigned type, const std::string& source); 129 unsigned loadProgram(const std::string& vertexSource, const std::string& fragmentSource); 129 130 130 131 WebKit::WebFrame* m_frame; … … 137 138 unsigned m_framebuffer; 138 139 Scene m_scene; 139 OwnPtr<WebKit::WebExternalTextureLayer> m_layer;140 std::auto_ptr<WebKit::WebExternalTextureLayer> m_layer; 140 141 141 142 WebKit::WebPluginContainer::TouchEventRequestType m_touchEventRequest; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.cpp
r142109 r142165 56 56 #include "WebWorkerInfo.h" 57 57 #include "v8/include/v8.h" 58 #include <limits> 59 #include <memory> 58 60 #include <public/WebData.h> 59 61 #include <public/WebPoint.h> 60 #include <wtf/OwnArrayPtr.h> 61 #include <wtf/text/WTFString.h> 62 63 #if OS(LINUX) || OS(ANDROID) 62 63 #if defined(__linux__) || defined(ANDROID) 64 64 #include "linux/WebFontRendering.h" 65 65 #endif … … 84 84 class InvokeCallbackTask : public WebMethodTask<TestRunner> { 85 85 public: 86 InvokeCallbackTask(TestRunner* object, PassOwnArrayPtr<CppVariant> callbackArguments, uint32_t numberOfArguments)86 InvokeCallbackTask(TestRunner* object, auto_ptr<CppVariant> callbackArguments) 87 87 : WebMethodTask<TestRunner>(object) 88 88 , m_callbackArguments(callbackArguments) 89 , m_numberOfArguments(numberOfArguments)90 89 { 91 90 } … … 94 93 { 95 94 CppVariant invokeResult; 96 m_callbackArguments [0].invokeDefault(m_callbackArguments.get(), m_numberOfArguments, invokeResult);95 m_callbackArguments->invokeDefault(m_callbackArguments.get(), 1, invokeResult); 97 96 } 98 97 99 98 private: 100 OwnArrayPtr<CppVariant> m_callbackArguments; 101 uint32_t m_numberOfArguments; 99 auto_ptr<CppVariant> m_callbackArguments; 102 100 }; 103 101 … … 114 112 return; 115 113 116 if (!m_queue. isEmpty()) {114 if (!m_queue.empty()) { 117 115 // We delay processing queued work to avoid recursion problems. 118 116 m_controller->m_delegate->postTask(new WorkQueueTask(this)); … … 124 122 { 125 123 // Quit doing work once a load is in progress. 126 while (!m_queue.isEmpty()) { 127 bool startedLoad = m_queue.first()->run(m_controller->m_delegate, m_controller->m_webView); 128 delete m_queue.takeFirst(); 124 while (!m_queue.empty()) { 125 bool startedLoad = m_queue.front()->run(m_controller->m_delegate, m_controller->m_webView); 126 delete m_queue.front(); 127 m_queue.pop_front(); 129 128 if (startedLoad) 130 129 return; … … 138 137 { 139 138 m_frozen = false; 140 while (!m_queue.isEmpty()) 141 delete m_queue.takeFirst(); 139 while (!m_queue.empty()) { 140 delete m_queue.front(); 141 m_queue.pop_front(); 142 } 142 143 } 143 144 … … 148 149 return; 149 150 } 150 m_queue. append(work);151 m_queue.push_back(work); 151 152 } 152 153 … … 157 158 , m_delegate(0) 158 159 , m_webView(0) 159 , m_intentClient( adoptPtr(new EmptyWebDeliveredIntentClient))160 , m_webPermissions( adoptPtr(new WebPermissions))160 , m_intentClient(new EmptyWebDeliveredIntentClient) 161 , m_webPermissions(new WebPermissions) 161 162 { 162 163 // Initialize the map that associates methods of this class with the names … … 216 217 bindMethod("setSelectTrailingWhitespaceEnabled", &TestRunner::setSelectTrailingWhitespaceEnabled); 217 218 bindMethod("setMockDeviceOrientation", &TestRunner::setMockDeviceOrientation); 218 #if ENABLE(POINTER_LOCK)219 219 bindMethod("didAcquirePointerLock", &TestRunner::didAcquirePointerLock); 220 220 bindMethod("didLosePointerLock", &TestRunner::didLosePointerLock); … … 222 222 bindMethod("setPointerLockWillRespondAsynchronously", &TestRunner::setPointerLockWillRespondAsynchronously); 223 223 bindMethod("setPointerLockWillFailSynchronously", &TestRunner::setPointerLockWillFailSynchronously); 224 #endif225 224 226 225 // The following modify WebPreferences. … … 274 273 bindMethod("setWillSendRequestReturnsNullOnRedirect", &TestRunner::setWillSendRequestReturnsNullOnRedirect); 275 274 276 #if ENABLE(WEB_INTENTS)277 275 // The following methods interact with the WebTestProxy. 276 #if ENABLE_WEB_INTENTS 278 277 bindMethod("sendWebIntentResponse", &TestRunner::sendWebIntentResponse); 279 278 bindMethod("deliverWebIntent", &TestRunner::deliverWebIntent); … … 295 294 bindMethod("setMockGeolocationPositionUnavailableError", &TestRunner::setMockGeolocationPositionUnavailableError); 296 295 bindMethod("setMockGeolocationPosition", &TestRunner::setMockGeolocationPosition); 297 #if ENABLE(NOTIFICATIONS)298 296 bindMethod("grantWebNotificationPermission", &TestRunner::grantWebNotificationPermission); 299 297 bindMethod("simulateLegacyWebNotificationClick", &TestRunner::simulateLegacyWebNotificationClick); 300 #endif301 #if ENABLE(INPUT_SPEECH)302 298 bindMethod("addMockSpeechInputResult", &TestRunner::addMockSpeechInputResult); 303 299 bindMethod("setMockSpeechInputDumpRect", &TestRunner::setMockSpeechInputDumpRect); 304 #endif305 #if ENABLE(SCRIPTED_SPEECH)306 300 bindMethod("addMockSpeechRecognitionResult", &TestRunner::addMockSpeechRecognitionResult); 307 301 bindMethod("setMockSpeechRecognitionError", &TestRunner::setMockSpeechRecognitionError); 308 302 bindMethod("wasMockSpeechRecognitionAborted", &TestRunner::wasMockSpeechRecognitionAborted); 309 #endif310 303 bindMethod("display", &TestRunner::display); 311 304 bindMethod("displayInvalidatedRegion", &TestRunner::displayInvalidatedRegion); … … 322 315 // The following are stubs. 323 316 bindMethod("dumpDatabaseCallbacks", &TestRunner::notImplemented); 324 #if ENABLE(NOTIFICATIONS)325 317 bindMethod("denyWebNotificationPermission", &TestRunner::notImplemented); 326 318 bindMethod("removeAllWebNotificationPermissions", &TestRunner::notImplemented); 327 319 bindMethod("simulateWebNotificationClick", &TestRunner::notImplemented); 328 #endif329 320 bindMethod("setIconDatabaseEnabled", &TestRunner::notImplemented); 330 321 bindMethod("setScrollbarPolicy", &TestRunner::notImplemented); … … 367 358 m_webView->setZoomLevel(false, 0); 368 359 m_webView->setTabKeyCyclesThroughElements(true); 369 #if ! OS(DARWIN) && !OS(WINDOWS) // Actually, TOOLKIT_GTK360 #if !defined(__APPLE__) && !defined(WIN32) // Actually, TOOLKIT_GTK 370 361 // (Constants copied because we can't depend on the header that defined 371 362 // them from this file.) … … 382 373 383 374 WebSecurityPolicy::resetOriginAccessWhitelists(); 384 #if OS(LINUX) || OS(ANDROID)375 #if defined(__linux__) || defined(ANDROID) 385 376 WebFontRendering::setSubpixelPositioning(false); 386 377 #endif … … 421 412 m_willSendRequestShouldReturnNull = false; 422 413 m_smartInsertDeleteEnabled = true; 423 #if OS(WINDOWS)414 #ifdef WIN32 424 415 m_selectTrailingWhitespaceEnabled = true; 425 416 #else … … 637 628 void TestRunner::policyDelegateDone() 638 629 { 639 ASSERT(m_waitUntilDone);630 WEBKIT_ASSERT(m_waitUntilDone); 640 631 m_delegate->testFinished(); 641 632 m_waitUntilDone = false; … … 1332 1323 bool wrapAround = false; 1333 1324 if (arguments.size() >= 2) { 1334 Vector<std::string> optionsArray = arguments[1].toStringVector();1325 vector<string> optionsArray = arguments[1].toStringVector(); 1335 1326 findOptions.matchCase = true; 1336 1327 … … 1412 1403 void TestRunner::setTextSubpixelPositioning(const CppArgumentList& arguments, CppVariant* result) 1413 1404 { 1414 #if OS(LINUX) || OS(ANDROID)1405 #if defined(__linux__) || defined(ANDROID) 1415 1406 // Since FontConfig doesn't provide a variable to control subpixel positioning, we'll fall back 1416 1407 // to setting it globally for all fonts. … … 1681 1672 prefs->shouldRespectImageOrientation = cppVariantToBool(value); 1682 1673 else if (key == "WebKitWebAudioEnabled") 1683 ASSERT(cppVariantToBool(value));1674 WEBKIT_ASSERT(cppVariantToBool(value)); 1684 1675 else { 1685 1676 string message("Invalid name for preference: "); … … 1726 1717 } 1727 1718 1728 #if ENABLE (WEB_INTENTS)1719 #if ENABLE_WEB_INTENTS 1729 1720 void TestRunner::sendWebIntentResponse(const CppArgumentList& arguments, CppVariant* result) 1730 1721 { … … 1834 1825 m_delegate->setDeviceScaleFactor(value); 1835 1826 1836 OwnArrayPtr<CppVariant> callbackArguments = adoptArrayPtr(new CppVariant[1]);1837 callbackArguments [0].set(arguments[1]);1838 result->setNull(); 1839 m_delegate->postTask(new InvokeCallbackTask(this, callbackArguments .release(), 1));1827 auto_ptr<CppVariant> callbackArguments(new CppVariant()); 1828 callbackArguments->set(arguments[1]); 1829 result->setNull(); 1830 m_delegate->postTask(new InvokeCallbackTask(this, callbackArguments)); 1840 1831 } 1841 1832 … … 1878 1869 } 1879 1870 1880 #if ENABLE(NOTIFICATIONS)1881 1871 void TestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result) 1882 1872 { … … 1897 1887 result->set(m_delegate->simulateLegacyWebNotificationClick(arguments[0].toString())); 1898 1888 } 1899 #endif 1900 1901 #if ENABLE(INPUT_SPEECH) 1889 1902 1890 void TestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result) 1903 1891 { … … 1917 1905 m_delegate->setMockSpeechInputDumpRect(arguments[0].toBoolean()); 1918 1906 } 1919 #endif 1920 1921 #if ENABLE(SCRIPTED_SPEECH) 1907 1922 1908 void TestRunner::addMockSpeechRecognitionResult(const CppArgumentList& arguments, CppVariant* result) 1923 1909 { … … 1942 1928 result->set(m_delegate->wasMockSpeechRecognitionAborted()); 1943 1929 } 1944 #endif1945 1930 1946 1931 void TestRunner::display(const CppArgumentList& arguments, CppVariant* result) … … 2122 2107 } 2123 2108 2124 #if ENABLE(POINTER_LOCK)2125 2109 void TestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result) 2126 2110 { … … 2152 2136 result->setNull(); 2153 2137 } 2154 #endif 2155 2156 } 2138 2139 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
r142109 r142165 35 35 36 36 #include "CppBoundClass.h" 37 #include "TestCommon.h" 37 38 #include "WebArrayBufferView.h" 38 39 #include "WebDeliveredIntentClient.h" … … 40 41 #include "WebTestRunner.h" 41 42 #include "WebTextDirection.h" 43 #include <deque> 44 #include <memory> 42 45 #include <public/WebURL.h> 43 46 #include <set> 44 47 #include <string> 45 #include <wtf/Deque.h>46 48 47 49 namespace WebKit { … … 142 144 143 145 void setFrozen(bool frozen) { m_frozen = frozen; } 144 bool isEmpty() { return m_queue. isEmpty(); }146 bool isEmpty() { return m_queue.empty(); } 145 147 WebTaskList* taskList() { return &m_taskList; } 146 148 … … 154 156 155 157 WebTaskList m_taskList; 156 Deque<WorkItem*> m_queue;158 std::deque<WorkItem*> m_queue; 157 159 bool m_frozen; 158 160 TestRunner* m_controller; … … 276 278 void setMockDeviceOrientation(const CppArgumentList&, CppVariant*); 277 279 278 #if ENABLE(POINTER_LOCK)279 280 void didAcquirePointerLock(const CppArgumentList&, CppVariant*); 280 281 void didNotAcquirePointerLock(const CppArgumentList&, CppVariant*); … … 282 283 void setPointerLockWillFailSynchronously(const CppArgumentList&, CppVariant*); 283 284 void setPointerLockWillRespondAsynchronously(const CppArgumentList&, CppVariant*); 284 #endif285 285 286 286 /////////////////////////////////////////////////////////////////////////// … … 421 421 // Methods interacting with the WebTestProxy 422 422 423 #if ENABLE (WEB_INTENTS)423 #if ENABLE_WEB_INTENTS 424 424 // Expects one string argument for sending successful result, zero 425 425 // arguments for sending a failure result. … … 469 469 void setMockGeolocationPositionUnavailableError(const CppArgumentList&, CppVariant*); 470 470 471 #if ENABLE(NOTIFICATIONS)472 471 // Grants permission for desktop notifications to an origin 473 472 void grantWebNotificationPermission(const CppArgumentList&, CppVariant*); 474 473 // Simulates a click on a desktop notification. 475 474 void simulateLegacyWebNotificationClick(const CppArgumentList&, CppVariant*); 476 #endif477 475 478 476 // Speech input related functions. 479 #if ENABLE(INPUT_SPEECH)480 477 void addMockSpeechInputResult(const CppArgumentList&, CppVariant*); 481 478 void setMockSpeechInputDumpRect(const CppArgumentList&, CppVariant*); 482 #endif483 #if ENABLE(SCRIPTED_SPEECH)484 479 void addMockSpeechRecognitionResult(const CppArgumentList&, CppVariant*); 485 480 void setMockSpeechRecognitionError(const CppArgumentList&, CppVariant*); 486 481 void wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant*); 487 #endif488 482 489 483 void display(const CppArgumentList&, CppVariant*); … … 683 677 684 678 // Mock object for testing delivering web intents. 685 OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient;679 std::auto_ptr<WebKit::WebDeliveredIntentClient> m_intentClient; 686 680 687 681 // WebPermissionClient mock object. 688 OwnPtr<WebPermissions> m_webPermissions;682 std::auto_ptr<WebPermissions> m_webPermissions; 689 683 }; 690 684 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp
r142109 r142165 32 32 #include "TextInputController.h" 33 33 34 #include "TestCommon.h" 34 35 #include "WebBindings.h" 35 36 #include "WebCompositionUnderline.h" … … 41 42 #include <public/WebVector.h> 42 43 #include <string> 43 #include <wtf/StringExtras.h>44 44 45 45 using namespace WebKit; 46 using namespace std; 46 47 47 48 namespace WebTestRunner { … … 147 148 148 149 WebRange range = mainFrame->markedRange(); 149 Vector<int> intArray(2);150 vector<int> intArray(2); 150 151 intArray[0] = range.startOffset(); 151 152 intArray[1] = range.endOffset(); … … 162 163 163 164 WebRange range = mainFrame->selectionRange(); 164 Vector<int> intArray(2);165 vector<int> intArray(2); 165 166 intArray[0] = range.startOffset(); 166 167 intArray[1] = range.endOffset(); … … 183 184 return; 184 185 185 Vector<int> intArray(4);186 vector<int> intArray(4); 186 187 intArray[0] = rect.x; 187 188 intArray[1] = rect.y; -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebPreferences.cpp
r142109 r142165 41 41 void WebPreferences::reset() 42 42 { 43 #if OS(MAC_OS_X)43 #ifdef __APPLE__ 44 44 cursiveFontFamily = WebString::fromUTF8("Apple Chancery"); 45 45 fantasyFontFamily = WebString::fromUTF8("Papyrus"); … … 107 107 allowUniversalAccessFromFileURLs = true; 108 108 109 #if OS(DARWIN)109 #ifdef __APPLE__ 110 110 editingBehavior = WebSettings::EditingBehaviorMac; 111 111 #else -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTask.cpp
r142109 r142165 33 33 34 34 #include "WebKit.h" 35 #include <wtf/Vector.h> 35 #include <algorithm> 36 37 using namespace std; 36 38 37 39 namespace WebTestRunner { … … 49 51 } 50 52 51 class WebTaskList::Private : public Vector<WebTask*> {52 };53 54 53 WebTaskList::WebTaskList() 55 : m_private(new Private)56 54 { 57 55 } … … 60 58 { 61 59 revokeAll(); 62 delete m_private;63 60 } 64 61 65 62 void WebTaskList::registerTask(WebTask* task) 66 63 { 67 m_ private->append(task);64 m_tasks.push_back(task); 68 65 } 69 66 70 67 void WebTaskList::unregisterTask(WebTask* task) 71 68 { 72 size_t index = m_private->find(task);73 if (i ndex != notFound)74 m_ private->remove(index);69 vector<WebTask*>::iterator iter = find(m_tasks.begin(), m_tasks.end(), task); 70 if (iter != m_tasks.end()) 71 m_tasks.erase(iter); 75 72 } 76 73 77 74 void WebTaskList::revokeAll() 78 75 { 79 while (!m_ private->isEmpty())80 (*m_private)[0]->cancel();76 while (!m_tasks.empty()) 77 m_tasks[0]->cancel(); 81 78 } 82 79 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestInterfaces.cpp
r142109 r142165 40 40 41 41 WebTestInterfaces::WebTestInterfaces() 42 : m_interfaces(new TestInterfaces()) 42 43 { 43 m_interfaces = new TestInterfaces;44 44 } 45 45 46 46 WebTestInterfaces::~WebTestInterfaces() 47 47 { 48 delete m_interfaces;49 48 } 50 49 … … 86 85 TestInterfaces* WebTestInterfaces::testInterfaces() 87 86 { 88 return m_interfaces ;87 return m_interfaces.get(); 89 88 } 90 89 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/WebTestProxy.cpp
r142109 r142165 35 35 #include "EventSender.h" 36 36 #include "SpellCheckClient.h" 37 #include "TestCommon.h" 37 38 #include "TestInterfaces.h" 38 39 #include "TestPlugin.h" … … 59 60 #include <public/WebURLRequest.h> 60 61 #include <public/WebURLResponse.h> 61 #include <wtf/StringExtras.h>62 62 63 63 using namespace WebKit; … … 213 213 size_t pos = url.rfind('/'); 214 214 if (pos == string::npos) { 215 #if OS(WINDOWS)215 #ifdef WIN32 216 216 pos = url.rfind('\\'); 217 217 if (pos == string::npos) … … 268 268 WebTestProxyBase::~WebTestProxyBase() 269 269 { 270 delete m_spellcheck;271 270 } 272 271 … … 291 290 WebSpellCheckClient* WebTestProxyBase::spellCheckClient() const 292 291 { 293 return m_spellcheck ;292 return m_spellcheck.get(); 294 293 } 295 294 … … 557 556 void WebTestProxyBase::registerIntentService(WebFrame*, const WebIntentServiceInfo& service) 558 557 { 559 #if ENABLE (WEB_INTENTS)558 #if ENABLE_WEB_INTENTS 560 559 m_delegate->printMessage(string("Registered Web Intent Service: action=") + service.action().utf8().data() + " type=" + service.type().utf8().data() + " title=" + service.title().utf8().data() + " url=" + service.url().spec().data() + " disposition=" + service.disposition().utf8().data() + "\n"); 561 560 #endif … … 564 563 void WebTestProxyBase::dispatchIntent(WebFrame* source, const WebIntentRequest& request) 565 564 { 566 #if ENABLE (WEB_INTENTS)565 #if ENABLE_WEB_INTENTS 567 566 m_delegate->printMessage(string("Received Web Intent: action=") + request.intent().action().utf8().data() + " type=" + request.intent().type().utf8().data() + "\n"); 568 567 WebMessagePortChannelArray* ports = request.intent().messagePortChannelsRelease(); … … 779 778 { 780 779 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { 781 ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.end());780 WEBKIT_ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.end()); 782 781 m_resourceIdentifierMap[identifier] = descriptionSuitableForTestResult(request.url().spec()); 783 782 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/config.h
r142164 r142165 1 1 /* 2 * Copyright (C) 201 2Google Inc. All rights reserved.2 * Copyright (C) 2013 Google Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 */ 30 30 31 #ifndef WebTestInterfaces_h32 #define WebTestInterfaces_h31 #ifndef config_h 32 #define config_h 33 33 34 namespace WebKit { 35 class WebFrame; 36 class WebView; 37 } 34 #define USE(feature) (defined WTF_USE_##feature && WTF_USE_##feature) 38 35 39 namespace WebTestRunner { 40 41 class TestInterfaces; 42 class WebTestDelegate; 43 class WebTestRunner; 44 45 class WebTestInterfaces { 46 public: 47 WebTestInterfaces(); 48 ~WebTestInterfaces(); 49 50 void setWebView(WebKit::WebView*); 51 void setDelegate(WebTestDelegate*); 52 void bindTo(WebKit::WebFrame*); 53 void resetAll(); 54 void setTestIsRunning(bool); 55 56 WebKit::WebView* webView() const; 57 WebTestRunner* testRunner(); 58 59 #if WEBTESTRUNNER_IMPLEMENTATION 60 TestInterfaces* testInterfaces(); 61 #endif 62 63 private: 64 TestInterfaces* m_interfaces; 65 }; 66 67 } 68 69 #endif // WebTestInterfaces_h 36 #endif // config_h
Note: See TracChangeset
for help on using the changeset viewer.