Title: [281461] trunk/Tools
Revision
281461
Author
peng.l...@apple.com
Date
2021-08-23 12:04:25 -0700 (Mon, 23 Aug 2021)

Log Message

Add a new option '--show-window' to run-webkit-tests
https://bugs.webkit.org/show_bug.cgi?id=229253

Reviewed by Simon Fraser.

Add the new option so that we can let WKTR show a window with webview.

* Scripts/webkitpy/layout_tests/run_webkit_tests.py:
(parse_args):
* Scripts/webkitpy/port/driver.py:
(Driver.cmd_line):
* WebKitTestRunner/Options.cpp:
(WTR::handleOptionShowWindow):
(WTR::OptionsHandler::OptionsHandler):
(WTR::handleOptionShowWebView): Deleted.
* WebKitTestRunner/TestOptions.cpp:
(WTR::TestOptions::defaults):
(WTR::TestOptions::keyTypeMapping):
* WebKitTestRunner/TestOptions.h:
(WTR::TestOptions::shouldShowWindow const):
(WTR::TestOptions::shouldShowWebView const): Deleted.
* WebKitTestRunner/cocoa/TestControllerCocoa.mm:
(WTR::TestController::finishCreatingPlatformWebView):
* WebKitTestRunner/mac/PlatformWebViewMac.mm:
(WTR::PlatformWebView::PlatformWebView):
* WebKitTestRunner/win/PlatformWebViewWin.cpp:
(WTR::PlatformWebView::setWindowFrame):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (281460 => 281461)


--- trunk/Tools/ChangeLog	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/ChangeLog	2021-08-23 19:04:25 UTC (rev 281461)
@@ -1,3 +1,33 @@
+2021-08-23  Peng Liu  <peng.l...@apple.com>
+
+        Add a new option '--show-window' to run-webkit-tests
+        https://bugs.webkit.org/show_bug.cgi?id=229253
+
+        Reviewed by Simon Fraser.
+
+        Add the new option so that we can let WKTR show a window with webview.
+
+        * Scripts/webkitpy/layout_tests/run_webkit_tests.py:
+        (parse_args):
+        * Scripts/webkitpy/port/driver.py:
+        (Driver.cmd_line):
+        * WebKitTestRunner/Options.cpp:
+        (WTR::handleOptionShowWindow):
+        (WTR::OptionsHandler::OptionsHandler):
+        (WTR::handleOptionShowWebView): Deleted.
+        * WebKitTestRunner/TestOptions.cpp:
+        (WTR::TestOptions::defaults):
+        (WTR::TestOptions::keyTypeMapping):
+        * WebKitTestRunner/TestOptions.h:
+        (WTR::TestOptions::shouldShowWindow const):
+        (WTR::TestOptions::shouldShowWebView const): Deleted.
+        * WebKitTestRunner/cocoa/TestControllerCocoa.mm:
+        (WTR::TestController::finishCreatingPlatformWebView):
+        * WebKitTestRunner/mac/PlatformWebViewMac.mm:
+        (WTR::PlatformWebView::PlatformWebView):
+        * WebKitTestRunner/win/PlatformWebViewWin.cpp:
+        (WTR::PlatformWebView::setWindowFrame):
+
 2021-08-23  Jonathan Bedard  <jbed...@apple.com>
 
         [Cygwin] Support Python 3 in run-webkit-tests

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py (281460 => 281461)


--- trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/run_webkit_tests.py	2021-08-23 19:04:25 UTC (rev 281461)
@@ -343,6 +343,7 @@
         optparse.make_option(
             "--prefer-integrated-gpu", action="" default=False,
             help=("Prefer using the lower-power integrated GPU on a dual-GPU system. Note that other running applications and the tests themselves can override this request.")),
+        optparse.make_option('--show-window', action="" default=False, help="Make the test runner window visible during testing."),
     ]))
 
     option_group_definitions.append(("Web Platform Test Server Options", [

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (281460 => 281461)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2021-08-23 19:04:25 UTC (rev 281461)
@@ -537,6 +537,8 @@
             cmd.append('--no-timeout')
         if self._port.get_option('show_touches'):
             cmd.append('--show-touches')
+        if self._port.get_option('show_window'):
+            cmd.append('--show-window')
         if self._port.get_option('accessibility_isolated_tree'):
             cmd.append('--accessibility-isolated-tree')
 

Modified: trunk/Tools/WebKitTestRunner/Options.cpp (281460 => 281461)


--- trunk/Tools/WebKitTestRunner/Options.cpp	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/WebKitTestRunner/Options.cpp	2021-08-23 19:04:25 UTC (rev 281461)
@@ -76,9 +76,9 @@
     return true;
 }
 
-static bool handleOptionShowWebView(Options& options, const char*, const char*)
+static bool handleOptionShowWindow(Options& options, const char*, const char*)
 {
-    options.features.boolTestRunnerFeatures.insert_or_assign("shouldShowWebView", true);
+    options.features.boolTestRunnerFeatures.insert_or_assign("shouldShowWindow", true);
     return true;
 }
 
@@ -165,7 +165,8 @@
     optionList.append(Option("--remote-layer-tree", "Use remote layer tree.", handleOptionRemoteLayerTree));
     optionList.append(Option("--allowed-host", "Allows access to the specified host from tests.", handleOptionAllowedHost, true));
     optionList.append(Option("--allow-any-certificate-for-allowed-hosts", "Allows any HTTPS certificate for an allowed host.", handleOptionAllowAnyHTTPSCertificateForAllowedHosts));
-    optionList.append(Option("--show-webview", "Show the WebView during test runs (for debugging)", handleOptionShowWebView));
+    optionList.append(Option("--show-webview", "DEPRECATED. Same as --show-window", handleOptionShowWindow));
+    optionList.append(Option("--show-window", "Make the test runner window visible during testing", handleOptionShowWindow));
     optionList.append(Option("--show-touches", "Show the touches during test runs (for debugging)", handleOptionShowTouches));
     optionList.append(Option("--world-leaks", "Check for leaks of world objects (currently, documents)", handleOptionCheckForWorldLeaks));
     optionList.append(Option("--no-enable-all-experimental-features", "Do not enable all experimental features by default", handleOptionNoEnableAllExperimentalFeatures));

Modified: trunk/Tools/WebKitTestRunner/TestOptions.cpp (281460 => 281461)


--- trunk/Tools/WebKitTestRunner/TestOptions.cpp	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/WebKitTestRunner/TestOptions.cpp	2021-08-23 19:04:25 UTC (rev 281461)
@@ -148,7 +148,7 @@
             { "shouldHandleRunOpenPanel", true },
             { "shouldPresentPopovers", true },
             { "shouldShowTouches", false },
-            { "shouldShowWebView", false },
+            { "shouldShowWindow", false },
             { "spellCheckingDots", false },
             { "textInteractionEnabled", true },
             { "useCharacterSelectionGranularity", false },
@@ -202,7 +202,7 @@
         { "shouldHandleRunOpenPanel", TestHeaderKeyType::BoolTestRunner },
         { "shouldPresentPopovers", TestHeaderKeyType::BoolTestRunner },
         { "shouldShowTouches", TestHeaderKeyType::BoolTestRunner },
-        { "shouldShowWebView", TestHeaderKeyType::BoolTestRunner },
+        { "shouldShowWindow", TestHeaderKeyType::BoolTestRunner },
         { "spellCheckingDots", TestHeaderKeyType::BoolTestRunner },
         { "textInteractionEnabled", TestHeaderKeyType::BoolTestRunner },
         { "useCharacterSelectionGranularity", TestHeaderKeyType::BoolTestRunner },

Modified: trunk/Tools/WebKitTestRunner/TestOptions.h (281460 => 281461)


--- trunk/Tools/WebKitTestRunner/TestOptions.h	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/WebKitTestRunner/TestOptions.h	2021-08-23 19:04:25 UTC (rev 281461)
@@ -65,7 +65,7 @@
     bool shouldPresentPopovers() const { return boolTestRunnerFeatureValue("shouldPresentPopovers"); }
     bool shouldShowSpellCheckingDots() const { return boolTestRunnerFeatureValue("spellCheckingDots"); }
     bool shouldShowTouches() const { return boolTestRunnerFeatureValue("shouldShowTouches"); }
-    bool shouldShowWebView() const { return boolTestRunnerFeatureValue("shouldShowWebView"); }
+    bool shouldShowWindow() const { return boolTestRunnerFeatureValue("shouldShowWindow"); }
     bool textInteractionEnabled() const { return boolTestRunnerFeatureValue("textInteractionEnabled"); }
     bool useCharacterSelectionGranularity() const { return boolTestRunnerFeatureValue("useCharacterSelectionGranularity"); }
     bool useDataDetection() const { return boolTestRunnerFeatureValue("useDataDetection"); }

Modified: trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm (281460 => 281461)


--- trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/WebKitTestRunner/cocoa/TestControllerCocoa.mm	2021-08-23 19:04:25 UTC (rev 281461)
@@ -217,7 +217,7 @@
 void TestController::finishCreatingPlatformWebView(PlatformWebView* view, const TestOptions& options)
 {
 #if PLATFORM(MAC)
-    if (options.shouldShowWebView())
+    if (options.shouldShowWindow())
         [view->platformWindow() orderFront:nil];
     else
         [view->platformWindow() orderBack:nil];

Modified: trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm (281460 => 281461)


--- trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/WebKitTestRunner/mac/PlatformWebViewMac.mm	2021-08-23 19:04:25 UTC (rev 281461)
@@ -73,7 +73,7 @@
     [m_view _setWindowOcclusionDetectionEnabled:NO];
 
     NSScreen *firstScreen = [[NSScreen screens] objectAtIndex:0];
-    NSRect windowRect = m_options.shouldShowWebView() ? NSOffsetRect(rect, 100, 100) : NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
+    NSRect windowRect = m_options.shouldShowWindow() ? NSOffsetRect(rect, 100, 100) : NSOffsetRect(rect, -10000, [firstScreen frame].size.height - rect.size.height + 10000);
     m_window = [[WebKitTestRunnerWindow alloc] initWithContentRect:windowRect styleMask:NSWindowStyleMaskBorderless backing:(NSBackingStoreType)_NSBackingStoreUnbuffered defer:YES];
     m_window.platformWebView = this;
     [m_window setColorSpace:[firstScreen colorSpace]];

Modified: trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp (281460 => 281461)


--- trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp	2021-08-23 18:59:07 UTC (rev 281460)
+++ trunk/Tools/WebKitTestRunner/win/PlatformWebViewWin.cpp	2021-08-23 19:04:25 UTC (rev 281461)
@@ -145,7 +145,7 @@
         SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS);
 
     UINT flags = SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS;
-    if (m_options.shouldShowWebView())
+    if (m_options.shouldShowWindow())
         flags |= SWP_NOMOVE;
     ::SetWindowPos(
         m_window,
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to