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

Unified Diff: chrome/browser/media/webrtc/webrtc_browsertest_base.cc

Issue 2534633002: Preparation CL for WebRTC performance test using promise-based getStats (Closed)
Patch Set: Created 4 years 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/webrtc_browsertest_base.cc
diff --git a/chrome/browser/media/webrtc/webrtc_browsertest_base.cc b/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
index ec41b87a5229ac0072d721e8985317ff4111099b..57d0d59d1dbfef45b2234adb59ec07fd346bd579 100644
--- a/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
+++ b/chrome/browser/media/webrtc/webrtc_browsertest_base.cc
@@ -494,6 +494,21 @@ std::vector<std::string> WebRtcTestBase::VerifyStatsGeneratedPromise(
return JsonArrayToVectorOfStrings(result.substr(3));
}
+scoped_refptr<content::RTCStatsReportDictionary>
+WebRtcTestBase::GetStatsReportDictionary(content::WebContents* tab) const {
+ std::string result = ExecuteJavascript("getStatsAsDictionary()", tab);
hbos_chromium 2016/11/30 11:30:56 nit: I'll rename this to getStatsReportDictionary
+ EXPECT_TRUE(base::StartsWith(result, "ok-", base::CompareCase::SENSITIVE));
+ std::unique_ptr<base::Value> parsed_json = base::JSONReader::Read(
+ result.substr(3));
+ base::DictionaryValue* dictionary;
+ CHECK(parsed_json);
+ CHECK(parsed_json->GetAsDictionary(&dictionary));
+ ignore_result(parsed_json.release());
+ return scoped_refptr<content::RTCStatsReportDictionary>(
+ new content::RTCStatsReportDictionary(
+ std::unique_ptr<base::DictionaryValue>(dictionary)));
+}
+
std::vector<std::string> WebRtcTestBase::GetWhitelistedStatsTypes(
content::WebContents* tab) const {
return JsonArrayToVectorOfStrings(

Powered by Google App Engine
This is Rietveld 408576698