Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5182)

Unified Diff: chrome/test/base/web_ui_browser_test.cc

Issue 2034393004: Allow multiple logging::LogMessage{Handler,Listener}s Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/base/web_ui_browser_test.h ('k') | chrome/test/chromedriver/logging.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/web_ui_browser_test.cc
diff --git a/chrome/test/base/web_ui_browser_test.cc b/chrome/test/base/web_ui_browser_test.cc
index c50a43458e417ea7807b06f0105ac1e20acec35d..833867cdeeaacfb4372733f7b3cb725704bdddb9 100644
--- a/chrome/test/base/web_ui_browser_test.cc
+++ b/chrome/test/base/web_ui_browser_test.cc
@@ -53,20 +53,6 @@ namespace {
base::LazyInstance<std::vector<std::string> > error_messages_ =
LAZY_INSTANCE_INITIALIZER;
-// Intercepts all log messages.
-bool LogHandler(int severity,
- const char* file,
- int line,
- size_t message_start,
- const std::string& str) {
- if (severity == logging::LOG_ERROR && file &&
- std::string("CONSOLE") == file) {
- error_messages_.Get().push_back(str);
- }
-
- return false;
-}
-
class WebUIJsInjectionReadyObserver : public content::WebContentsObserver {
public:
WebUIJsInjectionReadyObserver(content::WebContents* web_contents,
@@ -91,6 +77,18 @@ class WebUIJsInjectionReadyObserver : public content::WebContentsObserver {
} // namespace
+// Intercepts all log messages.
+void WebUILogMessageListener::OnMessage(int severity,
+ const char* file,
+ int line,
+ size_t message_start,
+ const std::string& str) {
+ if (severity == logging::LOG_ERROR && file &&
+ std::string("CONSOLE") == file) {
+ error_messages_.Get().push_back(str);
+ }
+}
+
WebUIBrowserTest::~WebUIBrowserTest() {
}
@@ -383,8 +381,6 @@ base::LazyInstance<MockWebUIProvider> mock_provider_ =
void WebUIBrowserTest::SetUpOnMainThread() {
JavaScriptBrowserTest::SetUpOnMainThread();
- logging::SetLogMessageHandler(&LogHandler);
-
AddLibrary(base::FilePath(kA11yAuditLibraryJSPath));
content::WebUIControllerFactory::UnregisterFactoryForTesting(
@@ -401,8 +397,6 @@ void WebUIBrowserTest::SetUpOnMainThread() {
}
void WebUIBrowserTest::TearDownOnMainThread() {
- logging::SetLogMessageHandler(NULL);
-
test_factory_->RemoveFactoryOverride(GURL(kDummyURL).host());
content::WebUIControllerFactory::UnregisterFactoryForTesting(
test_factory_.get());
« no previous file with comments | « chrome/test/base/web_ui_browser_test.h ('k') | chrome/test/chromedriver/logging.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698