| Index: chrome/browser/media/webrtc_browsertest_base.cc
|
| diff --git a/chrome/browser/media/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc_browsertest_base.cc
|
| index 2213da9f1c64c33f069546e4b51c8d60692b5003..88bb86104fcd03fe516f8444da6a9125eabbd7b4 100644
|
| --- a/chrome/browser/media/webrtc_browsertest_base.cc
|
| +++ b/chrome/browser/media/webrtc_browsertest_base.cc
|
| @@ -63,27 +63,6 @@ namespace {
|
| base::LazyInstance<bool> hit_javascript_errors_ =
|
| LAZY_INSTANCE_INITIALIZER;
|
|
|
| -// Intercepts all log messages. We always attach this handler but only look at
|
| -// the results if the test requests so. Note that this will only work if the
|
| -// WebrtcTestBase-inheriting test cases do not run in parallel (if they did they
|
| -// would race to look at the log, which is global to all tests).
|
| -bool JavascriptErrorDetectingLogHandler(int severity,
|
| - const char* file,
|
| - int line,
|
| - size_t message_start,
|
| - const std::string& str) {
|
| - if (file == NULL || std::string("CONSOLE") != file)
|
| - return false;
|
| -
|
| - bool contains_uncaught = str.find("\"Uncaught ") != std::string::npos;
|
| - if (severity == logging::LOG_ERROR ||
|
| - (severity == logging::LOG_INFO && contains_uncaught)) {
|
| - hit_javascript_errors_.Get() = true;
|
| - }
|
| -
|
| - return false;
|
| -}
|
| -
|
| // PermissionRequestObserver ---------------------------------------------------
|
|
|
| // Used to observe the creation of permission prompt without responding.
|
| @@ -122,10 +101,24 @@ class PermissionRequestObserver : public PermissionRequestManager::Observer {
|
|
|
| } // namespace
|
|
|
| +// Intercepts all log messages. We always attach this listener but only look at
|
| +// the results if the test requests so.
|
| +void JavascriptErrorDetectingListener::OnMessage(int severity,
|
| + const char* file,
|
| + int line,
|
| + size_t message_start,
|
| + const std::string& str) {
|
| + if (file == NULL || std::string("CONSOLE") != file)
|
| + return;
|
| +
|
| + bool contains_uncaught = str.find("\"Uncaught ") != std::string::npos;
|
| + if (severity == logging::LOG_ERROR ||
|
| + (severity == logging::LOG_INFO && contains_uncaught)) {
|
| + hit_javascript_errors_.Get() = true;
|
| + }
|
| +}
|
| +
|
| WebRtcTestBase::WebRtcTestBase(): detect_errors_in_javascript_(false) {
|
| - // The handler gets set for each test method, but that's fine since this
|
| - // set operation is idempotent.
|
| - logging::SetLogMessageHandler(&JavascriptErrorDetectingLogHandler);
|
| hit_javascript_errors_.Get() = false;
|
|
|
| EnablePixelOutput();
|
|
|