Changeset 92095 in webkit


Ignore:
Timestamp:
Jul 31, 2011 8:32:07 PM (13 years ago)
Author:
andersca@apple.com
Message:

Fix SpacebarScrolling WebKit2 API test
https://bugs.webkit.org/show_bug.cgi?id=65431

Reviewed by Sam Weinig.

Add a way to do platform-specific bundle initialization, and use it to disable smooth
scrolling. Also make it possible for a test to load the injected bundle without actually running
a test from it.

  • TestWebKitAPI/InjectedBundleController.cpp:

(TestWebKitAPI::InjectedBundleController::initialize):

  • TestWebKitAPI/InjectedBundleController.h:
  • TestWebKitAPI/PlatformUtilities.cpp:

(TestWebKitAPI::Util::createContextWithInjectedBundle):

  • TestWebKitAPI/PlatformUtilities.h:
  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/mac/InjectedBundleControllerMac.mm: Added.

(TestWebKitAPI::InjectedBundleController::platformInitialize):

  • TestWebKitAPI/win/InjectedBundleControllerWin.cpp: Added.

(TestWebKitAPI::InjectedBundleController::platformInitialize):

  • TestWebKitAPI/win/TestWebKitAPI.vcproj:
Location:
trunk/Tools
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r92087 r92095  
     12011-07-31  Anders Carlsson  <andersca@apple.com>
     2
     3        Fix SpacebarScrolling WebKit2 API test
     4        https://bugs.webkit.org/show_bug.cgi?id=65431
     5
     6        Reviewed by Sam Weinig.
     7
     8        Add a way to do platform-specific bundle initialization, and use it to disable smooth
     9        scrolling. Also make it possible for a test to load the injected bundle without actually running
     10        a test from it.
     11
     12        * TestWebKitAPI/InjectedBundleController.cpp:
     13        (TestWebKitAPI::InjectedBundleController::initialize):
     14        * TestWebKitAPI/InjectedBundleController.h:
     15        * TestWebKitAPI/PlatformUtilities.cpp:
     16        (TestWebKitAPI::Util::createContextWithInjectedBundle):
     17        * TestWebKitAPI/PlatformUtilities.h:
     18        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
     19        * TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp:
     20        (TestWebKitAPI::TEST):
     21        * TestWebKitAPI/mac/InjectedBundleControllerMac.mm: Added.
     22        (TestWebKitAPI::InjectedBundleController::platformInitialize):
     23        * TestWebKitAPI/win/InjectedBundleControllerWin.cpp: Added.
     24        (TestWebKitAPI::InjectedBundleController::platformInitialize):
     25        * TestWebKitAPI/win/TestWebKitAPI.vcproj:
     26
    1272011-07-31  Dimitri Glazkov  <dglazkov@chromium.org>
    228
  • trunk/Tools/TestWebKitAPI/InjectedBundleController.cpp

    r73066 r92095  
    4848void InjectedBundleController::initialize(WKBundleRef bundle, WKTypeRef initializationUserData)
    4949{
     50    platformInitialize();
     51
    5052    m_bundle = bundle;
     53
     54    if (!initializationUserData)
     55        return;
    5156
    5257    WKBundleClient client = {
     
    6671
    6772    WKStringRef testName = static_cast<WKStringRef>(WKDictionaryGetItemForKey(initializationDictionary, WKStringCreateWithUTF8CString("TestName")));
     73
    6874    WKTypeRef userData = WKDictionaryGetItemForKey(initializationDictionary, WKStringCreateWithUTF8CString("UserData"));
    69    
    7075    initializeTestNamed(bundle, Util::toSTD(testName), userData);
    7176}
  • trunk/Tools/TestWebKitAPI/InjectedBundleController.h

    r79966 r92095  
    5353    ~InjectedBundleController();
    5454
     55    void platformInitialize();
     56
    5557    static void didCreatePage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
    5658    static void willDestroyPage(WKBundleRef, WKBundlePageRef, const void* clientInfo);
  • trunk/Tools/TestWebKitAPI/PlatformUtilities.cpp

    r86602 r92095  
    3131namespace TestWebKitAPI {
    3232namespace Util {
     33
     34WKContextRef createContextWithInjectedBundle()
     35{
     36    WKRetainPtr<WKStringRef> injectedBundlePath(AdoptWK, createInjectedBundlePath());
     37    WKContextRef context = WKContextCreateWithInjectedBundlePath(injectedBundlePath.get());
     38
     39    return context;
     40}
    3341
    3442WKContextRef createContextForInjectedBundleTest(const std::string& testName, WKTypeRef userData)
  • trunk/Tools/TestWebKitAPI/PlatformUtilities.h

    r86603 r92095  
    4545void sleep(double seconds);
    4646
     47WKContextRef createContextWithInjectedBundle();
    4748WKContextRef createContextForInjectedBundleTest(const std::string&, WKTypeRef userData = 0);
    4849
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r90813 r92095  
    1313                1ADBEFAE130C689C00D61D19 /* ForceRepaint.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */; };
    1414                1ADBEFE3130C6AA100D61D19 /* simple-accelerated-compositing.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */; };
     15                1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */; };
    1516                333B9CE21277F23100FEFCE3 /* PreventEmptyUserAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */; };
    1617                33BE5AF5137B5A6C00705813 /* MouseMoveAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */; };
     
    114115                1ADBEFAD130C689C00D61D19 /* ForceRepaint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ForceRepaint.cpp; sourceTree = "<group>"; };
    115116                1ADBEFBC130C6A0100D61D19 /* simple-accelerated-compositing.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-accelerated-compositing.html"; sourceTree = "<group>"; };
     117                1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InjectedBundleControllerMac.mm; sourceTree = "<group>"; };
    116118                333B9CE11277F23100FEFCE3 /* PreventEmptyUserAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PreventEmptyUserAgent.cpp; sourceTree = "<group>"; };
    117119                33BE5AF4137B5A6C00705813 /* MouseMoveAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MouseMoveAfterCrash.cpp; sourceTree = "<group>"; };
     
    348350                        isa = PBXGroup;
    349351                        children = (
     352                                1AEDE22413E5E7A000E62FE8 /* InjectedBundleControllerMac.mm */,
    350353                                BC131A9A1171316900B69727 /* main.mm */,
    351354                                BC131884117114B600B69727 /* PlatformUtilitiesMac.mm */,
     
    493496                                BC246D9C132F1FF000B56D7C /* CanHandleRequest_Bundle.cpp in Sources */,
    494497                                33BE5AF9137B5AAE00705813 /* MouseMoveAfterCrash_Bundle.cpp in Sources */,
     498                                1AEDE22613E5E7E700E62FE8 /* InjectedBundleControllerMac.mm in Sources */,
    495499                        );
    496500                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Tools/TestWebKitAPI/Tests/WebKit2/SpacebarScrolling.cpp

    r86602 r92095  
    4949TEST(WebKit2, SpacebarScrolling)
    5050{
    51     WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
     51    WKRetainPtr<WKContextRef> context(AdoptWK, Util::createContextWithInjectedBundle());
    5252    PlatformWebView webView(context.get());
    5353
  • trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj

    r90813 r92095  
    399399                        <File
    400400                                RelativePath=".\PlatformWebViewWin.cpp"
     401                                >
     402                        </File>
     403                        <File
     404                                RelativePath=".\InjectedBundleControllerWin.cpp"
    401405                                >
    402406                        </File>
Note: See TracChangeset for help on using the changeset viewer.