Changeset 141991 in webkit
- Timestamp:
- Feb 6, 2013 5:11:24 AM (11 years ago)
- Location:
- trunk/Tools
- Files:
-
- 31 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r141985 r141991 1 2013-02-06 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-06 Mike West <mkwst@chromium.org> 2 150 -
trunk/Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp
r139895 r141991 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 'direct_dependent_settings': { 115 'defines': [ 116 'WEBTESTRUNNER_DLL', 117 ], 118 }, 119 'msvs_settings': { 120 'VCLinkerTool': { 121 'conditions': [ 122 ['incremental_chrome_dll==1', { 123 'UseLibraryDependencyInputs': 'true', 124 }], 125 ], 126 }, 127 }, 128 }], 129 ], 130 }], 109 131 ['toolkit_uses_gtk == 1', { 110 132 'defines': [ … … 196 218 '<(source_dir)/WebKit/chromium/WebKit.gyp:inspector_resources', 197 219 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit', 220 '<(source_dir)/WebKit/chromium/WebKit.gyp:webkit_wtf_support', 198 221 '<(source_dir)/WTF/WTF.gyp/WTF.gyp:wtf', 199 222 '<(chromium_src_dir)/base/base.gyp:test_support_base', -
trunk/Tools/DumpRenderTree/DumpRenderTree.gypi
r141984 r141991 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
r141926 r141991 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
r132138 r141991 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
r141990 r141991 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 { 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(); 37 #if !defined(WEBTESTRUNNER_IMPLEMENTATION) 38 #define WEBTESTRUNNER_IMPLEMENTATION 0 61 39 #endif 62 40 63 private: 64 TestInterfaces* m_interfaces; 65 }; 41 // ----------------------------------------------------------------------------- 42 // Exported symbols need to be annotated with WEBTESTRUNNER_EXPORT 66 43 67 } 44 #if defined(WEBTESTRUNNER_DLL) 45 #if defined(WIN32) 46 #if WEBTESTRUNNER_IMPLEMENTATION 47 #define WEBTESTRUNNER_EXPORT __declspec(dllexport) 48 #else 49 #define WEBTESTRUNNER_EXPORT __declspec(dllimport) 50 #endif 51 #else 52 #define WEBTESTRUNNER_EXPORT __attribute__((visibility("default"))) 53 #endif 54 #else 55 #define WEBTESTRUNNER_EXPORT 56 #endif 68 57 69 #endif // WebTest Interfaces_h58 #endif // WebTestCommon_h -
trunk/Tools/DumpRenderTree/chromium/TestRunner/public/WebTestInterfaces.h
r141823 r141991 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
r141823 r141991 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
r140974 r141991 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
r138260 r141991 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
r140565 r141991 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
r134203 r141991 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
r134203 r141991 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
r134203 r141991 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
r141823 r141991 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) 176 } else if (!strcmp(characters, "metaKey") || !strcmp(characters, "addSelectionKey")) { 175 #ifdef __APPLE__ 177 176 event->modifiers |= WebInputEvent::MetaKey; 178 177 // On Mac only command key presses are marked as system key. … … 192 191 bool isSystemKey = false; 193 192 if (argument->isObject()) { 194 Vector<string> modifiers = argument->toStringVector();195 for ( Vector<string>::const_iterator i = modifiers.begin(); i != modifiers.end(); ++i)193 vector<string> modifiers = argument->toStringVector(); 194 for (vector<string>::const_iterator i = modifiers.begin(); i != modifiers.end(); ++i) 196 195 isSystemKey |= applyKeyModifier(*i, event); 197 196 } else if (argument->isString()) … … 205 204 bool getEditCommand(const WebKeyboardEvent& event, string* name) 206 205 { 207 #if OS(MAC_OS_X)206 #ifdef __APPLE__ 208 207 // We only cares about Left,Right,Up,Down keys with Command or Command+Shift 209 208 // modifiers. These key events correspond to some special movement and … … 307 306 // events so we can simulate drag & drop. 308 307 bindProperty("dragMode", &dragMode); 309 #if OS(WINDOWS)308 #ifdef WIN32 310 309 bindProperty("WM_KEYDOWN", &wmKeyDown); 311 310 bindProperty("WM_KEYUP", &wmKeyUp); … … 322 321 { 323 322 // The test should have finished a drag and the mouse button state. 324 ASSERT(currentDragData.isNull());323 WEBKIT_ASSERT(currentDragData.isNull()); 325 324 currentDragData.reset(); 326 325 currentDragEffect = WebKit::WebDragOperationNone; … … 328 327 pressedButton = WebMouseEvent::ButtonNone; 329 328 dragMode.set(true); 330 #if OS(WINDOWS)329 #ifdef WIN32 331 330 wmKeyDown.set(WM_KEYDOWN); 332 331 wmKeyUp.set(WM_KEYUP); … … 418 417 419 418 int buttonNumber = getButtonNumberFromSingleArg(arguments); 420 ASSERT(buttonNumber != -1);419 WEBKIT_ASSERT(buttonNumber != -1); 421 420 422 421 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumber); … … 440 439 441 440 int buttonNumber = getButtonNumberFromSingleArg(arguments); 442 ASSERT(buttonNumber != -1);441 WEBKIT_ASSERT(buttonNumber != -1); 443 442 444 443 WebMouseEvent::Button buttonType = getButtonTypeFromButtonNumber(buttonNumber); … … 448 447 savedEvent.type = SavedEvent::MouseUp; 449 448 savedEvent.buttonType = buttonType; 450 mouseEventQueue. append(savedEvent);449 mouseEventQueue.push_back(savedEvent); 451 450 replaySavedEvents(); 452 451 } else { … … 505 504 savedEvent.type = SavedEvent::MouseMove; 506 505 savedEvent.pos = mousePos; 507 mouseEventQueue. append(savedEvent);506 mouseEventQueue.push_back(savedEvent); 508 507 } else { 509 508 WebMouseEvent event; … … 598 597 if (!code) { 599 598 WebString webCodeStr = WebString::fromUTF8(codeStr.data(), codeStr.size()); 600 ASSERT(webCodeStr.length() == 1);599 WEBKIT_ASSERT(webCodeStr.length() == 1); 601 600 text = code = webCodeStr.data()[0]; 602 601 needsShiftKeyModifier = needsShiftModifier(code); … … 616 615 eventDown.modifiers = 0; 617 616 eventDown.windowsKeyCode = code; 618 #if OS(LINUX) && USE(GTK)617 #if defined(__linux__) && USE(GTK) 619 618 eventDown.nativeKeyCode = NativeKeyCodeForWindowsKeyCode(code); 620 619 #endif … … 678 677 result->setNull(); 679 678 680 #if OS(WINDOWS)679 #ifdef WIN32 681 680 if (arguments.size() == 3) { 682 681 // Grab the message id to see if we need to dispatch it. … … 694 693 webview()->handleInputEvent(WebInputEventFactory::keyboardEvent(0, msg, arguments[1].toInt32(), lparam)); 695 694 } else 696 ASSERT_NOT_REACHED();695 WEBKIT_ASSERT_NOT_REACHED(); 697 696 #endif 698 697 } … … 718 717 savedEvent.type = SavedEvent::LeapForward; 719 718 savedEvent.milliseconds = milliseconds; 720 mouseEventQueue. append(savedEvent);719 mouseEventQueue.push_back(savedEvent); 721 720 } else 722 721 doLeapForward(milliseconds); … … 779 778 { 780 779 replayingSavedEvents = true; 781 while (!mouseEventQueue.isEmpty()) { 782 SavedEvent e = mouseEventQueue.takeFirst(); 780 while (!mouseEventQueue.empty()) { 781 SavedEvent e = mouseEventQueue.front(); 782 mouseEventQueue.pop_front(); 783 783 784 784 switch (e.type) { … … 799 799 } 800 800 default: 801 ASSERT_NOT_REACHED();801 WEBKIT_ASSERT_NOT_REACHED(); 802 802 } 803 803 } … … 813 813 // - Some test even checks actual string content. So providing it would be also helpful. 814 814 // 815 static Vector<WebString> makeMenuItemStringsFor(WebContextMenuData* contextMenu, WebTestDelegate* delegate)815 static vector<WebString> makeMenuItemStringsFor(WebContextMenuData* contextMenu, WebTestDelegate* delegate) 816 816 { 817 817 // These constants are based on Safari's context menu because tests are made for it. … … 821 821 // This is possible because mouse events are cancelleable. 822 822 if (!contextMenu) 823 return Vector<WebString>();824 825 Vector<WebString> strings;823 return vector<WebString>(); 824 825 vector<WebString> strings; 826 826 827 827 if (contextMenu->isEditable) { 828 828 for (const char** item = editableMenuStrings; *item; ++item) 829 strings. append(WebString::fromUTF8(*item));829 strings.push_back(WebString::fromUTF8(*item)); 830 830 WebVector<WebString> suggestions; 831 831 MockSpellCheck::fillSuggestionList(contextMenu->misspelledWord, &suggestions); 832 832 for (size_t i = 0; i < suggestions.size(); ++i) 833 strings. append(suggestions[i]);833 strings.push_back(suggestions[i]); 834 834 } else { 835 835 for (const char** item = nonEditableMenuStrings; *item; ++item) 836 strings. append(WebString::fromUTF8(*item));836 strings.push_back(WebString::fromUTF8(*item)); 837 837 } 838 838 … … 859 859 webview()->handleInputEvent(event); 860 860 861 #if OS(WINDOWS)861 #ifdef WIN32 862 862 initMouseEvent(WebInputEvent::MouseUp, WebMouseEvent::ButtonRight, lastMousePos, &event, getCurrentEventTimeSec(m_delegate)); 863 863 webview()->handleInputEvent(event); … … 916 916 { 917 917 currentDragData.initialize(); 918 Vector<string> files = arguments[0].toStringVector();918 vector<string> files = arguments[0].toStringVector(); 919 919 WebVector<WebString> absoluteFilenames(files.size()); 920 920 for (size_t i = 0; i < files.size(); ++i) { … … 955 955 } 956 956 touchPoint.id = lowestId; 957 touchPoints. append(touchPoint);957 touchPoints.push_back(touchPoint); 958 958 } 959 959 … … 969 969 970 970 const unsigned index = arguments[0].toInt32(); 971 ASSERT(index < touchPoints.size());971 WEBKIT_ASSERT(index < touchPoints.size()); 972 972 973 973 WebTouchPoint* touchPoint = &touchPoints[index]; … … 1001 1001 1002 1002 const unsigned index = arguments[0].toInt32(); 1003 ASSERT(index < touchPoints.size());1003 WEBKIT_ASSERT(index < touchPoints.size()); 1004 1004 1005 1005 WebPoint position(arguments[1].toInt32(), arguments[2].toInt32()); … … 1015 1015 1016 1016 const unsigned index = arguments[0].toInt32(); 1017 ASSERT(index < touchPoints.size());1017 WEBKIT_ASSERT(index < touchPoints.size()); 1018 1018 1019 1019 WebTouchPoint* touchPoint = &touchPoints[index]; … … 1023 1023 void EventSender::sendCurrentTouchEvent(const WebInputEvent::Type type) 1024 1024 { 1025 ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touchPoints.size());1025 WEBKIT_ASSERT(static_cast<unsigned>(WebTouchEvent::touchesLengthCap) > touchPoints.size()); 1026 1026 webview()->layout(); 1027 1027 … … 1038 1038 WebTouchPoint* touchPoint = &touchPoints[i]; 1039 1039 if (touchPoint->state == WebTouchPoint::StateReleased) { 1040 touchPoints. remove(i);1040 touchPoints.erase(touchPoints.begin() + i); 1041 1041 --i; 1042 1042 } else … … 1258 1258 break; 1259 1259 default: 1260 ASSERT_NOT_REACHED();1260 WEBKIT_ASSERT_NOT_REACHED(); 1261 1261 } 1262 1262 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/KeyCodeMapping.cpp
r132781 r141991 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
r140621 r141991 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
r140396 r141991 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
r141519 r141991 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
r141471 r141991 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
r140396 r141991 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
r141990 r141991 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, format, ...) _vsnprintf_s(str, size, size, format, __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
r141823 r141991 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
r141823 r141991 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
r141785 r141991 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); … … 533 528 break; 534 529 case WebDragStatusUnknown: 535 ASSERT_NOT_REACHED();530 WEBKIT_ASSERT_NOT_REACHED(); 536 531 } 537 532 m_delegate->printMessage(std::string("Plugin received event: ") + dragStatusName + "\n"); -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestPlugin.h
r141785 r141991 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
r141849 r141991 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. 278 276 bindMethod("sendWebIntentResponse", &TestRunner::sendWebIntentResponse); 279 277 bindMethod("deliverWebIntent", &TestRunner::deliverWebIntent); 280 #endif281 278 282 279 // The following methods interact with the WebTestDelegate. … … 295 292 bindMethod("setMockGeolocationPositionUnavailableError", &TestRunner::setMockGeolocationPositionUnavailableError); 296 293 bindMethod("setMockGeolocationPosition", &TestRunner::setMockGeolocationPosition); 297 #if ENABLE(NOTIFICATIONS)298 294 bindMethod("grantWebNotificationPermission", &TestRunner::grantWebNotificationPermission); 299 295 bindMethod("simulateLegacyWebNotificationClick", &TestRunner::simulateLegacyWebNotificationClick); 300 #endif301 #if ENABLE(INPUT_SPEECH)302 296 bindMethod("addMockSpeechInputResult", &TestRunner::addMockSpeechInputResult); 303 297 bindMethod("setMockSpeechInputDumpRect", &TestRunner::setMockSpeechInputDumpRect); 304 #endif305 #if ENABLE(SCRIPTED_SPEECH)306 298 bindMethod("addMockSpeechRecognitionResult", &TestRunner::addMockSpeechRecognitionResult); 307 299 bindMethod("setMockSpeechRecognitionError", &TestRunner::setMockSpeechRecognitionError); 308 300 bindMethod("wasMockSpeechRecognitionAborted", &TestRunner::wasMockSpeechRecognitionAborted); 309 #endif310 301 bindMethod("display", &TestRunner::display); 311 302 bindMethod("displayInvalidatedRegion", &TestRunner::displayInvalidatedRegion); … … 322 313 // The following are stubs. 323 314 bindMethod("dumpDatabaseCallbacks", &TestRunner::notImplemented); 324 #if ENABLE(NOTIFICATIONS)325 315 bindMethod("denyWebNotificationPermission", &TestRunner::notImplemented); 326 316 bindMethod("removeAllWebNotificationPermissions", &TestRunner::notImplemented); 327 317 bindMethod("simulateWebNotificationClick", &TestRunner::notImplemented); 328 #endif329 318 bindMethod("setIconDatabaseEnabled", &TestRunner::notImplemented); 330 319 bindMethod("setScrollbarPolicy", &TestRunner::notImplemented); … … 367 356 m_webView->setZoomLevel(false, 0); 368 357 m_webView->setTabKeyCyclesThroughElements(true); 369 #if ! OS(DARWIN) && !OS(WINDOWS) // Actually, TOOLKIT_GTK358 #if !defined(__APPLE__) && !defined(WIN32) // Actually, TOOLKIT_GTK 370 359 // (Constants copied because we can't depend on the header that defined 371 360 // them from this file.) … … 382 371 383 372 WebSecurityPolicy::resetOriginAccessWhitelists(); 384 #if OS(LINUX) || OS(ANDROID)373 #if defined(__linux__) || defined(ANDROID) 385 374 WebFontRendering::setSubpixelPositioning(false); 386 375 #endif … … 421 410 m_willSendRequestShouldReturnNull = false; 422 411 m_smartInsertDeleteEnabled = true; 423 #if OS(WINDOWS)412 #ifdef WIN32 424 413 m_selectTrailingWhitespaceEnabled = true; 425 414 #else … … 637 626 void TestRunner::policyDelegateDone() 638 627 { 639 ASSERT(m_waitUntilDone);628 WEBKIT_ASSERT(m_waitUntilDone); 640 629 m_delegate->testFinished(); 641 630 m_waitUntilDone = false; … … 1332 1321 bool wrapAround = false; 1333 1322 if (arguments.size() >= 2) { 1334 Vector<std::string> optionsArray = arguments[1].toStringVector();1323 vector<string> optionsArray = arguments[1].toStringVector(); 1335 1324 findOptions.matchCase = true; 1336 1325 … … 1412 1401 void TestRunner::setTextSubpixelPositioning(const CppArgumentList& arguments, CppVariant* result) 1413 1402 { 1414 #if OS(LINUX) || OS(ANDROID)1403 #if defined(__linux__) || defined(ANDROID) 1415 1404 // Since FontConfig doesn't provide a variable to control subpixel positioning, we'll fall back 1416 1405 // to setting it globally for all fonts. … … 1681 1670 prefs->shouldRespectImageOrientation = cppVariantToBool(value); 1682 1671 else if (key == "WebKitWebAudioEnabled") 1683 ASSERT(cppVariantToBool(value));1672 WEBKIT_ASSERT(cppVariantToBool(value)); 1684 1673 else { 1685 1674 string message("Invalid name for preference: "); … … 1726 1715 } 1727 1716 1728 #if ENABLE(WEB_INTENTS)1729 1717 void TestRunner::sendWebIntentResponse(const CppArgumentList& arguments, CppVariant* result) 1730 1718 { … … 1768 1756 m_webView->mainFrame()->deliverIntent(intent, 0, m_intentClient.get()); 1769 1757 } 1770 #endif1771 1758 1772 1759 void TestRunner::showWebInspector(const CppArgumentList&, CppVariant* result) … … 1834 1821 m_delegate->setDeviceScaleFactor(value); 1835 1822 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));1823 auto_ptr<CppVariant> callbackArguments(new CppVariant()); 1824 callbackArguments->set(arguments[1]); 1825 result->setNull(); 1826 m_delegate->postTask(new InvokeCallbackTask(this, callbackArguments)); 1840 1827 } 1841 1828 … … 1878 1865 } 1879 1866 1880 #if ENABLE(NOTIFICATIONS)1881 1867 void TestRunner::grantWebNotificationPermission(const CppArgumentList& arguments, CppVariant* result) 1882 1868 { … … 1897 1883 result->set(m_delegate->simulateLegacyWebNotificationClick(arguments[0].toString())); 1898 1884 } 1899 #endif 1900 1901 #if ENABLE(INPUT_SPEECH) 1885 1902 1886 void TestRunner::addMockSpeechInputResult(const CppArgumentList& arguments, CppVariant* result) 1903 1887 { … … 1917 1901 m_delegate->setMockSpeechInputDumpRect(arguments[0].toBoolean()); 1918 1902 } 1919 #endif 1920 1921 #if ENABLE(SCRIPTED_SPEECH) 1903 1922 1904 void TestRunner::addMockSpeechRecognitionResult(const CppArgumentList& arguments, CppVariant* result) 1923 1905 { … … 1942 1924 result->set(m_delegate->wasMockSpeechRecognitionAborted()); 1943 1925 } 1944 #endif1945 1926 1946 1927 void TestRunner::display(const CppArgumentList& arguments, CppVariant* result) … … 2122 2103 } 2123 2104 2124 #if ENABLE(POINTER_LOCK)2125 2105 void TestRunner::didAcquirePointerLock(const CppArgumentList&, CppVariant* result) 2126 2106 { … … 2152 2132 result->setNull(); 2153 2133 } 2154 #endif 2155 2156 } 2134 2135 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TestRunner.h
r141899 r141991 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)424 423 // Expects one string argument for sending successful result, zero 425 424 // arguments for sending a failure result. … … 428 427 // Cause the web intent to be delivered to this context. 429 428 void deliverWebIntent(const CppArgumentList&, CppVariant*); 430 #endif431 429 432 430 /////////////////////////////////////////////////////////////////////////// … … 469 467 void setMockGeolocationPositionUnavailableError(const CppArgumentList&, CppVariant*); 470 468 471 #if ENABLE(NOTIFICATIONS)472 469 // Grants permission for desktop notifications to an origin 473 470 void grantWebNotificationPermission(const CppArgumentList&, CppVariant*); 474 471 // Simulates a click on a desktop notification. 475 472 void simulateLegacyWebNotificationClick(const CppArgumentList&, CppVariant*); 476 #endif477 473 478 474 // Speech input related functions. 479 #if ENABLE(INPUT_SPEECH)480 475 void addMockSpeechInputResult(const CppArgumentList&, CppVariant*); 481 476 void setMockSpeechInputDumpRect(const CppArgumentList&, CppVariant*); 482 #endif483 #if ENABLE(SCRIPTED_SPEECH)484 477 void addMockSpeechRecognitionResult(const CppArgumentList&, CppVariant*); 485 478 void setMockSpeechRecognitionError(const CppArgumentList&, CppVariant*); 486 479 void wasMockSpeechRecognitionAborted(const CppArgumentList&, CppVariant*); 487 #endif488 480 489 481 void display(const CppArgumentList&, CppVariant*); … … 683 675 684 676 // Mock object for testing delivering web intents. 685 OwnPtr<WebKit::WebDeliveredIntentClient> m_intentClient;677 std::auto_ptr<WebKit::WebDeliveredIntentClient> m_intentClient; 686 678 687 679 // WebPermissionClient mock object. 688 OwnPtr<WebPermissions> m_webPermissions;680 std::auto_ptr<WebPermissions> m_webPermissions; 689 681 }; 690 682 -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/TextInputController.cpp
r140565 r141991 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
r141926 r141991 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
r132138 r141991 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
r141823 r141991 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
r141878 r141991 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)560 558 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 #endif562 559 } 563 560 564 561 void WebTestProxyBase::dispatchIntent(WebFrame* source, const WebIntentRequest& request) 565 562 { 566 #if ENABLE(WEB_INTENTS)567 563 m_delegate->printMessage(string("Received Web Intent: action=") + request.intent().action().utf8().data() + " type=" + request.intent().type().utf8().data() + "\n"); 568 564 WebMessagePortChannelArray* ports = request.intent().messagePortChannelsRelease(); … … 587 583 for (size_t i = 0; i < suggestions.size(); ++i) 588 584 m_delegate->printMessage(string("Have suggestion ") + suggestions[i].spec().data() + "\n"); 589 #endif590 585 } 591 586 … … 779 774 { 780 775 if (m_testInterfaces->testRunner()->shouldDumpResourceLoadCallbacks()) { 781 ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.end());776 WEBKIT_ASSERT(m_resourceIdentifierMap.find(identifier) == m_resourceIdentifierMap.end()); 782 777 m_resourceIdentifierMap[identifier] = descriptionSuitableForTestResult(request.url().spec()); 783 778 } -
trunk/Tools/DumpRenderTree/chromium/TestRunner/src/config.h
r141990 r141991 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.