DumpRenderTree should clear WTFLogChannelState::OnWithAccumulation state set by testRunner.accummulateLogsForChannel
https://bugs.webkit.org/show_bug.cgi?id=203024
Reviewed by Alex Christensen.
Source/WebCore:
* platform/LogInitialization.h:
* platform/Logging.cpp:
(WebCore::clearAllLogChannelsToAccumulate): Added.
* platform/Logging.h:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::clearAllLogChannelsToAccumulate): Added.
* testing/js/WebCoreTestSupport.h:
Tools:
If a test case calls testRunner.accummulateLogsForChannel("IndexedDB"),
all subsequent IndexedDB tests also dump the log.
This is unnecessarily bloating DumpRenderTree log because
DumpRenderTree is run with --debug-rwt-logging switch on Buildbot.
Add a function to clear WTFLogChannelState::OnWithAccumulation
state, and call it for every test execution.
* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
* DumpRenderTree/win/DumpRenderTree.cpp:
(resetWebViewToConsistentStateBeforeTesting):
Call WebCoreTestSupport::clearAllLogChannelsToAccumulate.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@251193 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index a948555..79be63a 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2019-10-16 Fujii Hironori <Hironori.Fujii@sony.com>
+
+ DumpRenderTree should clear WTFLogChannelState::OnWithAccumulation state set by testRunner.accummulateLogsForChannel
+ https://bugs.webkit.org/show_bug.cgi?id=203024
+
+ Reviewed by Alex Christensen.
+
+ * platform/LogInitialization.h:
+ * platform/Logging.cpp:
+ (WebCore::clearAllLogChannelsToAccumulate): Added.
+ * platform/Logging.h:
+ * testing/js/WebCoreTestSupport.cpp:
+ (WebCoreTestSupport::clearAllLogChannelsToAccumulate): Added.
+ * testing/js/WebCoreTestSupport.h:
+
2019-10-16 Youenn Fablet <youenn@apple.com>
WebAudioSourceProviderAVFObjC::provideInput should set its WebAudioBufferList parameters correctly
diff --git a/Source/WebCore/platform/LogInitialization.h b/Source/WebCore/platform/LogInitialization.h
index 999160d..b5927c4 100644
--- a/Source/WebCore/platform/LogInitialization.h
+++ b/Source/WebCore/platform/LogInitialization.h
@@ -37,6 +37,7 @@
String logLevelString();
bool isLogChannelEnabled(const String& name);
WEBCORE_EXPORT void setLogChannelToAccumulate(const String& name);
+WEBCORE_EXPORT void clearAllLogChannelsToAccumulate();
WEBCORE_EXPORT void initializeLogChannelsIfNecessary(Optional<String> = WTF::nullopt);
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
diff --git a/Source/WebCore/platform/Logging.cpp b/Source/WebCore/platform/Logging.cpp
index 899141c..eef8b3a 100644
--- a/Source/WebCore/platform/Logging.cpp
+++ b/Source/WebCore/platform/Logging.cpp
@@ -27,6 +27,7 @@
#include "Logging.h"
#include "LogInitialization.h"
+#include <wtf/LoggingAccumulator.h>
#include <wtf/StdLibExtras.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
@@ -69,6 +70,17 @@
logChannelsNeedInitialization = true;
}
+void clearAllLogChannelsToAccumulate()
+{
+ resetAccumulatedLogs();
+ for (auto* channel : logChannels) {
+ if (channel->state == WTFLogChannelState::OnWithAccumulation)
+ channel->state = WTFLogChannelState::Off;
+ }
+
+ logChannelsNeedInitialization = true;
+}
+
void initializeLogChannelsIfNecessary(Optional<String> logChannelString)
{
if (!logChannelsNeedInitialization && !logChannelString)
diff --git a/Source/WebCore/platform/Logging.h b/Source/WebCore/platform/Logging.h
index 22b5c04..2cc7777 100644
--- a/Source/WebCore/platform/Logging.h
+++ b/Source/WebCore/platform/Logging.h
@@ -119,7 +119,6 @@
String logLevelString();
bool isLogChannelEnabled(const String& name);
-WEBCORE_EXPORT void setLogChannelToAccumulate(const String& name);
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
diff --git a/Source/WebCore/testing/js/WebCoreTestSupport.cpp b/Source/WebCore/testing/js/WebCoreTestSupport.cpp
index 9050113..0bb2459 100644
--- a/Source/WebCore/testing/js/WebCoreTestSupport.cpp
+++ b/Source/WebCore/testing/js/WebCoreTestSupport.cpp
@@ -120,6 +120,13 @@
#endif
}
+void clearAllLogChannelsToAccumulate()
+{
+#if !LOG_DISABLED
+ WebCore::clearAllLogChannelsToAccumulate();
+#endif
+}
+
void initializeLogChannelsIfNecessary()
{
#if !LOG_DISABLED || !RELEASE_LOG_DISABLED
diff --git a/Source/WebCore/testing/js/WebCoreTestSupport.h b/Source/WebCore/testing/js/WebCoreTestSupport.h
index a6f9601..bb71f01 100644
--- a/Source/WebCore/testing/js/WebCoreTestSupport.h
+++ b/Source/WebCore/testing/js/WebCoreTestSupport.h
@@ -51,6 +51,7 @@
void clearWheelEventTestMonitor(WebCore::Frame&) TEST_SUPPORT_EXPORT;
void setLogChannelToAccumulate(const WTF::String& name) TEST_SUPPORT_EXPORT;
+void clearAllLogChannelsToAccumulate() TEST_SUPPORT_EXPORT;
void initializeLogChannelsIfNecessary() TEST_SUPPORT_EXPORT;
void setAllowsAnySSLCertificate(bool) TEST_SUPPORT_EXPORT;
diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index c8ba794..9c9c500 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,24 @@
+2019-10-16 Fujii Hironori <Hironori.Fujii@sony.com>
+
+ DumpRenderTree should clear WTFLogChannelState::OnWithAccumulation state set by testRunner.accummulateLogsForChannel
+ https://bugs.webkit.org/show_bug.cgi?id=203024
+
+ Reviewed by Alex Christensen.
+
+ If a test case calls testRunner.accummulateLogsForChannel("IndexedDB"),
+ all subsequent IndexedDB tests also dump the log.
+ This is unnecessarily bloating DumpRenderTree log because
+ DumpRenderTree is run with --debug-rwt-logging switch on Buildbot.
+
+ Add a function to clear WTFLogChannelState::OnWithAccumulation
+ state, and call it for every test execution.
+
+ * DumpRenderTree/mac/DumpRenderTree.mm:
+ (resetWebViewToConsistentStateBeforeTesting):
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (resetWebViewToConsistentStateBeforeTesting):
+ Call WebCoreTestSupport::clearAllLogChannelsToAccumulate.
+
2019-10-16 Wenson Hsieh <wenson_hsieh@apple.com>
Remove an API test workaround that is no longer needed
diff --git a/Tools/DumpRenderTree/mac/DumpRenderTree.mm b/Tools/DumpRenderTree/mac/DumpRenderTree.mm
index 14f820f..ecfa487 100644
--- a/Tools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/Tools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -93,7 +93,6 @@
#import <getopt.h>
#import <wtf/Assertions.h>
#import <wtf/FastMalloc.h>
-#import <wtf/LoggingAccumulator.h>
#import <wtf/ObjCRuntimeExtras.h>
#import <wtf/ProcessPrivilege.h>
#import <wtf/RetainPtr.h>
@@ -1945,7 +1944,7 @@
[LayoutTestSpellChecker uninstallAndReset];
#endif
- resetAccumulatedLogs();
+ WebCoreTestSupport::clearAllLogChannelsToAccumulate();
WebCoreTestSupport::initializeLogChannelsIfNecessary();
}
diff --git a/Tools/DumpRenderTree/win/DumpRenderTree.cpp b/Tools/DumpRenderTree/win/DumpRenderTree.cpp
index a2deb81..688486a 100644
--- a/Tools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/Tools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -1052,6 +1052,9 @@
COMPtr<IWebViewPrivate5> webViewPrivate5(Query, webView);
webViewPrivate5->exitFullscreenIfNeeded();
+
+ WebCoreTestSupport::clearAllLogChannelsToAccumulate();
+ WebCoreTestSupport::initializeLogChannelsIfNecessary();
}
static void sizeWebViewForCurrentTest()