Changeset 66834 in webkit
- Timestamp:
- Sep 6, 2010 9:14:36 AM (14 years ago)
- Location:
- trunk/WebKitTools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKitTools/ChangeLog
r66829 r66834 1 2010-09-06 Martin Robinson <mrobinson@igalia.com> 2 3 Reviewed by Xan Lopez. 4 5 [GTK] Small code cleanup in DumpRenderTreeGtk.cpp 6 https://bugs.webkit.org/show_bug.cgi?id=45213 7 8 * DumpRenderTree/gtk/DumpRenderTree.cpp: 9 (initializeFonts): Made this function do nothing for non-X11 platforms, so we don't 10 have to surround the invocation with #ifdefs. 11 (useLongRunningServerMode): Added. 12 (runTestingServerLoop): Added. 13 (initializeGlobalsFromCommandLineOptions): Added. 14 (runTest): Removed ifdefs. 15 (main): Use new helper functions. 16 1 17 2010-09-06 Martin Robinson <mrobinson@igalia.com> 2 18 -
trunk/WebKitTools/DumpRenderTree/gtk/DumpRenderTree.cpp
r64082 r66834 97 97 const unsigned historyItemIndent = 8; 98 98 99 static void runTest(const string& testPathOrURL); 100 99 101 static bool shouldLogFrameLoadDelegates(const string& pathOrURL) 100 102 { … … 129 131 } 130 132 133 static void initializeFonts() 134 { 131 135 #if PLATFORM(X11) 132 static void initializeFonts()133 {134 136 static int numFonts = -1; 137 138 FcInit(); 135 139 136 140 // Some tests may add or remove fonts via the @font-face rule. … … 161 165 appFontSet = FcConfigGetFonts(config, FcSetApplication); 162 166 numFonts = appFontSet->nfont; 163 }164 167 #endif 168 } 165 169 166 170 static gchar* dumpFramesAsText(WebKitWebFrame* frame) … … 358 362 } 359 363 364 static bool useLongRunningServerMode(int argc, char *argv[]) 365 { 366 // This assumes you've already called getopt_long 367 return (argc == optind+1 && !strcmp(argv[optind], "-")); 368 } 369 370 static void runTestingServerLoop() 371 { 372 // When DumpRenderTree runs in server mode, we just wait around for file names 373 // to be passed to us and read each in turn, passing the results back to the client 374 char filenameBuffer[2048]; 375 while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { 376 char* newLineCharacter = strchr(filenameBuffer, '\n'); 377 if (newLineCharacter) 378 *newLineCharacter = '\0'; 379 380 if (!strlen(filenameBuffer)) 381 continue; 382 383 runTest(filenameBuffer); 384 } 385 } 386 387 static void initializeGlobalsFromCommandLineOptions(int argc, char *argv[]) 388 { 389 struct option options[] = { 390 {"notree", no_argument, &dumpTree, false}, 391 {"pixel-tests", no_argument, &dumpPixels, true}, 392 {"tree", no_argument, &dumpTree, true}, 393 {NULL, 0, NULL, 0} 394 }; 395 396 int option; 397 while ((option = getopt_long(argc, (char * const *)argv, "", options, NULL)) != -1) { 398 switch (option) { 399 case '?': // unknown or ambiguous option 400 case ':': // missing argument 401 exit(1); 402 break; 403 } 404 } 405 } 406 407 360 408 void dump() 361 409 { … … 517 565 g_object_ref(prevTestBFItem); 518 566 519 #if PLATFORM(X11)520 567 initializeFonts(); 521 #endif522 568 523 569 // Focus the web view before loading the test to avoid focusing problems … … 942 988 g_log_set_default_handler(logHandler, 0); 943 989 944 #if PLATFORM(X11) 945 FcInit(); 990 initializeGlobalsFromCommandLineOptions(argc, argv); 946 991 initializeFonts(); 947 #endif948 949 struct option options[] = {950 {"notree", no_argument, &dumpTree, false},951 {"pixel-tests", no_argument, &dumpPixels, true},952 {"tree", no_argument, &dumpTree, true},953 {NULL, 0, NULL, 0}954 };955 956 int option;957 while ((option = getopt_long(argc, (char* const*)argv, "", options, NULL)) != -1)958 switch (option) {959 case '?': // unknown or ambiguous option960 case ':': // missing argument961 exit(1);962 break;963 }964 992 965 993 window = gtk_window_new(GTK_WINDOW_POPUP); … … 981 1009 axController = new AccessibilityController(); 982 1010 983 if (argc == optind+1 && strcmp(argv[optind], "-") == 0) { 984 char filenameBuffer[2048]; 1011 if (useLongRunningServerMode(argc, argv)) { 985 1012 printSeparators = true; 986 while (fgets(filenameBuffer, sizeof(filenameBuffer), stdin)) { 987 char* newLineCharacter = strchr(filenameBuffer, '\n'); 988 if (newLineCharacter) 989 *newLineCharacter = '\0'; 990 991 if (strlen(filenameBuffer) == 0) 992 continue; 993 994 runTest(filenameBuffer); 995 } 1013 runTestingServerLoop(); 996 1014 } else { 997 1015 printSeparators = (optind < argc-1 || (dumpPixels && dumpTree));
Note: See TracChangeset
for help on using the changeset viewer.