Changeset 183651 in webkit


Ignore:
Timestamp:
Apr 30, 2015 4:13:52 PM (9 years ago)
Author:
Brent Fulgham
Message:

Provide a runtime flag to run-webkit-tests that shows the test view
https://bugs.webkit.org/show_bug.cgi?id=144079.

Reviewed by Dean Jackson.

Add a new flag (--show-webview) that causes DumpRenderTree and WebKitTestRunner to display
their WebViews on-screen. This can be used when running tests via the "--additional-drt-flag"
option:

--additional-drt-flag="--show-webview"

  • DumpRenderTree/mac/DumpRenderTree.mm:

(createWebViewAndOffscreenWindow): Use an on-screen window rect if the user passed the
'--show-webview' flag.
(initializeGlobalsFromCommandLineOptions): Recognize the "--show-webview" option.

  • WebKitTestRunner/Options.cpp:

(WTR::Options::Options):
(WTR::handleOptionShowWebView):
(WTR::OptionsHandler::OptionsHandler): Recognize the new "--show-webview" option.

  • WebKitTestRunner/Options.h:
  • WebKitTestRunner/TestController.cpp:

(WTR::TestController::TestController):
(WTR::TestController::initialize): Use value of 'shouldShowWebView' from the Options bundle.

  • WebKitTestRunner/TestController.h:

(WTR::TestController::shouldShowWebView):

  • WebKitTestRunner/mac/PlatformWebViewMac.mm:

(WTR::PlatformWebView::PlatformWebView): Retrieve the value of the 'ShouldShowWebView' key from the
options dictionary. If it is true, display the web view while running the test.

Location:
trunk/Tools
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r183641 r183651  
     12015-04-30  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Provide a runtime flag to run-webkit-tests that shows the test view
     4        https://bugs.webkit.org/show_bug.cgi?id=144079.
     5
     6        Reviewed by Dean Jackson.
     7
     8        Add a new flag (--show-webview) that causes DumpRenderTree and WebKitTestRunner to display
     9        their WebViews on-screen. This can be used when running tests via the "--additional-drt-flag"
     10        option:
     11       
     12        --additional-drt-flag="--show-webview"
     13
     14        * DumpRenderTree/mac/DumpRenderTree.mm:
     15        (createWebViewAndOffscreenWindow): Use an on-screen window rect if the user passed the
     16        '--show-webview' flag.
     17        (initializeGlobalsFromCommandLineOptions): Recognize the "--show-webview" option.
     18        * WebKitTestRunner/Options.cpp:
     19        (WTR::Options::Options):
     20        (WTR::handleOptionShowWebView):
     21        (WTR::OptionsHandler::OptionsHandler): Recognize the new "--show-webview" option.
     22        * WebKitTestRunner/Options.h:
     23        * WebKitTestRunner/TestController.cpp:
     24        (WTR::TestController::TestController):
     25        (WTR::TestController::initialize): Use value of 'shouldShowWebView' from the Options bundle.
     26        * WebKitTestRunner/TestController.h:
     27        (WTR::TestController::shouldShowWebView):
     28        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
     29        (WTR::PlatformWebView::PlatformWebView): Retrieve the value of the 'ShouldShowWebView' key from the
     30        options dictionary. If it is true, display the web view while running the test.
     31
    1322015-04-30  Alexey Proskuryakov  <ap@apple.com>
    233
  • trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm

    r183595 r183651  
    11/*
    2  * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005-2009, 2015 Apple Inc. All rights reserved.
    33 *           (C) 2007 Graham Dennis (graham.dennis@gmail.com)
    44 *
     
    206206static int useAcceleratedDrawing;
    207207static int gcBetweenTests;
     208static int showWebView = NO;
    208209static BOOL printSeparators;
    209210static RetainPtr<CFStringRef> persistentUserStyleSheetLocation;
     
    785786    // Put it at -10000, -10000 in "flipped coordinates", since WebCore and the DOM use flipped coordinates.
    786787    NSScreen *firstScreen = [[NSScreen screens] firstObject];
    787     NSRect windowRect = NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
     788    NSRect windowRect = (showWebView) ? NSOffsetRect(rect, 100, 100) : NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
    788789    DumpRenderTreeWindow *window = [[DumpRenderTreeWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
    789790
     
    791792    [window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
    792793    [[window contentView] addSubview:webView];
    793     [window orderBack:nil];
     794    if (showWebView)
     795        [window orderFront:nil];
     796    else
     797        [window orderBack:nil];
    794798    [window setAutodisplay:NO];
    795799
     
    11221126        {"no-timeout", no_argument, &useTimeoutWatchdog, NO},
    11231127        {"allowed-host", required_argument, nullptr, 'a'},
     1128        {"show-webview", no_argument, &showWebView, YES},
    11241129        {nullptr, 0, nullptr, 0}
    11251130    };
  • trunk/Tools/WebKitTestRunner/Options.cpp

    r182916 r183651  
    22 * Copyright (C) 2013 University of Szeged. All rights reserved.
    33 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
     4 * Copyright (C) 2015 Apple Inc. All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    4243    , shouldUseAcceleratedDrawing(false)
    4344    , shouldUseRemoteLayerTree(false)
     45    , shouldShowWebView(false)
    4446{
    4547}
     
    9496}
    9597
     98bool handleOptionShowWebView(Options& options, const char*, const char*)
     99{
     100    options.shouldShowWebView = true;
     101    return true;
     102}
     103
    96104bool handleOptionAllowedHost(Options& options, const char*, const char* host)
    97105{
     
    121129    optionList.append(Option("--remote-layer-tree", "Use remote layer tree.", handleOptionRemoteLayerTree));
    122130    optionList.append(Option("--allowed-host", "Allows access to the specified host from tests.", handleOptionAllowedHost, true));
     131    optionList.append(Option("--show-webview", "Show the WebView during test runs (for Debugging)", handleOptionShowWebView));
    123132
    124133    optionList.append(Option(0, 0, handleOptionUnmatched));
  • trunk/Tools/WebKitTestRunner/Options.h

    r182017 r183651  
    22 * Copyright (C) 2013 University of Szeged. All rights reserved.
    33 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
     4 * Copyright (C) 2015 Apple Inc. All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    4748    bool shouldUseAcceleratedDrawing;
    4849    bool shouldUseRemoteLayerTree;
     50    bool shouldShowWebView;
    4951    std::vector<std::string> paths;
    5052    std::vector<std::string> allowedHosts;
  • trunk/Tools/WebKitTestRunner/TestController.cpp

    r183595 r183651  
    11/*
    2  * Copyright (C) 2010, 2014 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2014-2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    126126    , m_shouldUseRemoteLayerTree(false)
    127127    , m_shouldLogHistoryClientCallbacks(false)
     128    , m_shouldShowWebView(false)
    128129{
    129130    initialize(argc, argv);
     
    329330    m_paths = options.paths;
    330331    m_allowedHosts = options.allowedHosts;
     332    m_shouldShowWebView = options.shouldShowWebView;
    331333
    332334    if (options.printSupportedFeatures) {
  • trunk/Tools/WebKitTestRunner/TestController.h

    r183572 r183651  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    7575    void runUntil(bool& done, double timeoutSeconds);
    7676    void notifyDone();
    77    
     77
     78    bool shouldShowWebView() const { return m_shouldShowWebView; }
     79
    7880    void configureViewForTest(const TestInvocation&);
    7981   
     
    270272
    271273    bool m_shouldLogHistoryClientCallbacks;
     274    bool m_shouldShowWebView;
    272275
    273276    std::unique_ptr<EventSenderProxy> m_eventSenderProxy;
  • trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm

    r181451 r183651  
    11/*
    2  * Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2013, 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    142142    [m_view setWindowOcclusionDetectionEnabled:NO];
    143143
     144    WKRetainPtr<WKStringRef> shouldShowWebViewKey(AdoptWK, WKStringCreateWithUTF8CString("ShouldShowWebView"));
     145    WKTypeRef shouldShowWebViewValue = options ? WKDictionaryGetItemForKey(options, shouldShowWebViewKey.get()) : NULL;
     146    bool shouldShowWebView = shouldShowWebViewValue && WKBooleanGetValue(static_cast<WKBooleanRef>(shouldShowWebViewValue));
     147
    144148    NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
    145     NSRect windowRect = NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
     149    NSRect windowRect = (shouldShowWebView) ? NSOffsetRect(rect, 100, 100) : NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
    146150    m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSBorderlessWindowMask backing:(NSBackingStoreType)_NSBackingStoreUnbuffered defer:YES];
    147151    m_window.platformWebView = this;
     
    149153    [m_window setCollectionBehavior:NSWindowCollectionBehaviorStationary];
    150154    [[m_window contentView] addSubview:m_view];
    151     [m_window orderBack:nil];
     155    if (shouldShowWebView)
     156        [m_window orderFront:nil];
     157    else
     158        [m_window orderBack:nil];
    152159    [m_window setReleasedWhenClosed:NO];
    153160}
Note: See TracChangeset for help on using the changeset viewer.