Changeset 189958 in webkit


Ignore:
Timestamp:
Sep 17, 2015 6:58:37 PM (9 years ago)
Author:
Simon Fraser
Message:

[iOS WK2] When loading viewport tests, use the normal web page viewport configuration
https://bugs.webkit.org/show_bug.cgi?id=149321

Reviewed by Tim Horton.

InjectedBundlePage::platformDidStartProvisionalLoadForFrame() unconditionally
enabled the "testing" viewport configuration, which disables page scaling.

If we're running viewport tests, we want the normal web page configuration.
Do that by passing a flag in the dictionary sent to InjectedBundle::beginTesting(),
based on whether the test is in a "viewport" directory.

  • WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:

(WTR::InjectedBundle::beginTesting):

  • WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm:

(WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame): Deleted.

  • WebKitTestRunner/TestInvocation.cpp:

(WTR::TestInvocation::shouldLogFrameLoadDelegates):
(WTR::TestInvocation::shouldLogHistoryClientCallbacks):
(WTR::TestInvocation::shouldMakeViewportFlexible):
(WTR::TestInvocation::invoke):

  • WebKitTestRunner/TestInvocation.h:
  • WebKitTestRunner/ios/TestControllerIOS.mm:

(WTR::TestController::platformConfigureViewForTest):
(WTR::shouldMakeViewportFlexible): Deleted.

Location:
trunk/Tools
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r189948 r189958  
     12015-09-17  Simon Fraser  <simon.fraser@apple.com>
     2
     3        [iOS WK2] When loading viewport tests, use the normal web page viewport configuration
     4        https://bugs.webkit.org/show_bug.cgi?id=149321
     5
     6        Reviewed by Tim Horton.
     7       
     8        InjectedBundlePage::platformDidStartProvisionalLoadForFrame() unconditionally
     9        enabled the "testing" viewport configuration, which disables page scaling.
     10       
     11        If we're running viewport tests, we want the normal web page configuration.
     12        Do that by passing a flag in the dictionary sent to InjectedBundle::beginTesting(),
     13        based on whether the test is in a "viewport" directory.
     14
     15        * WebKitTestRunner/InjectedBundle/InjectedBundle.cpp:
     16        (WTR::InjectedBundle::beginTesting):
     17        * WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm:
     18        (WTR::InjectedBundlePage::platformDidStartProvisionalLoadForFrame): Deleted.
     19        * WebKitTestRunner/TestInvocation.cpp:
     20        (WTR::TestInvocation::shouldLogFrameLoadDelegates):
     21        (WTR::TestInvocation::shouldLogHistoryClientCallbacks):
     22        (WTR::TestInvocation::shouldMakeViewportFlexible):
     23        (WTR::TestInvocation::invoke):
     24        * WebKitTestRunner/TestInvocation.h:
     25        * WebKitTestRunner/ios/TestControllerIOS.mm:
     26        (WTR::TestController::platformConfigureViewForTest):
     27        (WTR::shouldMakeViewportFlexible): Deleted.
     28
    1292015-09-17  Simon Fraser  <simon.fraser@apple.com>
    230
  • trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.cpp

    r189392 r189958  
    284284    WKBundlePageRemoveAllUserContent(page()->page());
    285285
     286#if PLATFORM(IOS)
     287    WKBundlePageSetUseTestingViewportConfiguration(page()->page(), !booleanForKey(settings, "UseFlexibleViewport"));
     288#endif
     289
    286290    m_testRunner->setShouldDumpFrameLoadCallbacks(booleanForKey(settings, "DumpFrameLoadDelegates"));
    287291    m_testRunner->setUserStyleSheetEnabled(false);
  • trunk/Tools/WebKitTestRunner/InjectedBundle/cocoa/InjectedBundlePageCocoa.mm

    r179409 r189958  
    4444
    4545    setCrashReportApplicationSpecificInformationToURL(InjectedBundle::singleton().testRunner()->testURL());
    46 
    47 #if PLATFORM(IOS)
    48     WKBundlePageSetUseTestingViewportConfiguration(page(), true);
    49 #endif
    5046}
    5147
  • trunk/Tools/WebKitTestRunner/TestInvocation.cpp

    r189908 r189958  
    133133}
    134134
    135 bool TestInvocation::shouldLogFrameLoadDelegates()
     135bool TestInvocation::shouldLogFrameLoadDelegates() const
    136136{
    137137    return urlContains("loading/");
    138138}
    139139
    140 bool TestInvocation::shouldLogHistoryClientCallbacks()
     140bool TestInvocation::shouldLogHistoryClientCallbacks() const
    141141{
    142142    return urlContains("globalhistory/");
     143}
     144
     145bool TestInvocation::shouldMakeViewportFlexible() const
     146{
     147    return urlContains("viewport/");
    143148}
    144149
     
    163168    WKRetainPtr<WKBooleanRef> dumpFrameLoadDelegatesValue = adoptWK(WKBooleanCreate(shouldLogFrameLoadDelegates()));
    164169    WKDictionarySetItem(beginTestMessageBody.get(), dumpFrameLoadDelegatesKey.get(), dumpFrameLoadDelegatesValue.get());
     170
     171    WKRetainPtr<WKStringRef> useFlexibleViewportKey = adoptWK(WKStringCreateWithUTF8CString("UseFlexibleViewport"));
     172    WKRetainPtr<WKBooleanRef> useFlexibleViewportValue = adoptWK(WKBooleanCreate(shouldMakeViewportFlexible()));
     173    WKDictionarySetItem(beginTestMessageBody.get(), useFlexibleViewportKey.get(), useFlexibleViewportValue.get());
    165174
    166175    WKRetainPtr<WKStringRef> dumpPixelsKey = adoptWK(WKStringCreateWithUTF8CString("DumpPixels"));
  • trunk/Tools/WebKitTestRunner/TestInvocation.h

    r189908 r189958  
    6161    void didRemoveSwipeSnapshot();
    6262
     63    bool shouldMakeViewportFlexible() const;
     64
    6365private:
    6466    void dumpResults();
     
    7173    static void forceRepaintDoneCallback(WKErrorRef, void* context);
    7274
    73     bool shouldLogFrameLoadDelegates();
    74     bool shouldLogHistoryClientCallbacks();
     75    bool shouldLogFrameLoadDelegates() const;
     76    bool shouldLogHistoryClientCallbacks() const;
    7577
    7678    WKRetainPtr<WKURLRef> m_url;
  • trunk/Tools/WebKitTestRunner/ios/TestControllerIOS.mm

    r189668 r189958  
    7575}
    7676
    77 static bool shouldMakeViewportFlexible(const TestInvocation& test)
    78 {
    79     return test.urlContains("viewport/");
    80 }
    81 
    8277void TestController::platformResetPreferencesToConsistentValues()
    8378{
     
    9489void TestController::platformConfigureViewForTest(const TestInvocation& test)
    9590{
    96     if (shouldMakeViewportFlexible(test)) {
     91    if (test.shouldMakeViewportFlexible()) {
    9792        const unsigned phoneViewHeight = 480;
    9893        const unsigned phoneViewWidth = 320;
    9994
    10095        mainWebView()->resizeTo(phoneViewWidth, phoneViewHeight);
    101         // FIXME: more viewport config to do here.
     96        // We also pass data to InjectedBundle::beginTesting() to have it call
     97        // WKBundlePageSetUseTestingViewportConfiguration(false).
    10298    }
    10399}
Note: See TracChangeset for help on using the changeset viewer.