[webkit-reviews] review requested: [Bug 20534] DumpRenderTree needs a way to override settings on a per-test basis : [Attachment 23105] Possible patch to issue 20534

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Sep 1 15:34:24 PDT 2008


Glenn Wilson <wilsong at gmail.com> has asked  for review:
Bug 20534: DumpRenderTree needs a way to override settings on a per-test basis
https://bugs.webkit.org/show_bug.cgi?id=20534

Attachment 23105: Possible patch to issue 20534
https://bugs.webkit.org/attachment.cgi?id=23105&action=edit

------- Additional Comments from Glenn Wilson <wilsong at gmail.com>
Ok, here's the patch with additional support for resetting default values after
each test.

Changes from earlier patch:
1.  DumpRenderTree now calls a method on IWebPreferences called
"resetToDefaults".  

2.  Added "resetToDefaults" method to WebPreferences.  "resetToDefaults" will
go through all of the preferences set in its internal dictionary and replace
them with the default values, but _ONLY_ if some value was overridden.	If no
value was overridden, this method simply returns.

3.  Changed overridePreference to take a string value instead of just boolean. 
Although starting simple with just boolean support seemed right initially, I
didn't take into account that any positive string value (such as "true", "yes",
"lfaijweofij") would be interpreted as true.  Any empty value (such as false,
0, maybe ""?) would be interpreted as false.  So this way, the method can now
support overriding both boolean values and string values in the preferences.

4.  More layout tests were added.  One was added to test the overriding of
string values.	Another was added specifically to test that preferences were
being reset after every value. 

But wait, there's more!  WebPreferences resets after every test by default. 
But now you can also specifically override a flag to tell WebPreferences NOT to
reset.	That is:
layoutTestController.overridePreference("WebKitDefaultPreferencesOverridden",
false);
will make WebPreferences think that it hasn't been overriden, and so it won't
reset until you call:
layoutTestController.overridePreference("WebKitDefaultPreferencesOverridden",
true);

This means that you can specifically override a preference in the first test of
a long series of tests, tell the preferences not to reset after that test, then
tell the preferences to reset after the last test needing the overrides.  So
you don't need to override the same preference over and over in a long line of
tests.	....Whether this is useful or not is up for debate :)

Thanks to Eric for his feedback on this!


More information about the webkit-reviews mailing list