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

Unified Diff: chrome/browser/media/webrtc_browsertest_common.cc

Issue 1061473002: Make WebRtcWebcamBrowserTest fail faster. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix issue in js code and improve logging of constraints Created 5 years, 8 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
Index: chrome/browser/media/webrtc_browsertest_common.cc
diff --git a/chrome/browser/media/webrtc_browsertest_common.cc b/chrome/browser/media/webrtc_browsertest_common.cc
index 34298f2a061a9cbcbaf34604d4ccd99b3330d83a..635b8182678ebc4973602f7a0e33e2a45ef2ebbb 100644
--- a/chrome/browser/media/webrtc_browsertest_common.cc
+++ b/chrome/browser/media/webrtc_browsertest_common.cc
@@ -6,6 +6,7 @@
#include "base/files/file_util.h"
#include "base/path_service.h"
+#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/test/test_timeouts.h"
#include "base/time/time.h"
@@ -38,6 +39,10 @@ static const char kAdviseOnGclientSolution[] =
const int kDefaultPollIntervalMsec = 250;
+bool IsErrorResult(const std::string& result) {
+ return StartsWithASCII(result, "failed-", false);
+}
+
base::FilePath GetReferenceFilesDir() {
base::FilePath test_data_dir;
PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
@@ -133,8 +138,12 @@ bool PollingWaitUntil(const std::string& javascript,
return false;
}
- if (evaluates_to == result)
+ if (evaluates_to == result) {
return true;
+ } else if (IsErrorResult(result)) {
+ LOG(ERROR) << "|" << javascript << "| returned an error: " << result;
+ return false;
+ }
// Sleep a bit here to keep this loop from spinlocking too badly.
if (!SleepInJavascript(tab_contents, poll_interval_msec)) {

Powered by Google App Engine
This is Rietveld 408576698