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

Side by Side Diff: content/browser/media/webrtc_getusermedia_browsertest.cc

Issue 635833002: Refactor WebRTC getUserMedia tests to be more explicit and clear. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarified TODO Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/test/data/media/getusermedia.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/debug/trace_event_impl.h" 6 #include "base/debug/trace_event_impl.h"
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/test/trace_event_analyzer.h" 9 #include "base/test/trace_event_analyzer.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 const std::string& measure_filter, 119 const std::string& measure_filter,
120 const std::string& graph_name) { 120 const std::string& graph_name) {
121 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 121 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
122 122
123 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); 123 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
124 NavigateToURL(shell(), url); 124 NavigateToURL(shell(), url);
125 125
126 // Put getUserMedia to work and let it run for a couple of seconds. 126 // Put getUserMedia to work and let it run for a couple of seconds.
127 DCHECK(time_to_sample_secs); 127 DCHECK(time_to_sample_secs);
128 ExecuteJavascriptAndWaitForOk( 128 ExecuteJavascriptAndWaitForOk(
129 base::StringPrintf("%s({video: true});", 129 base::StringPrintf("%s({video: true}, 'myStreamName');",
130 kGetUserMediaAndGetStreamUp)); 130 kGetUserMediaAndGetStreamUp));
131 131
132 // Now the stream is up and running, start collecting traces. 132 // Now the stream is up and running, start collecting traces.
133 StartTracing(); 133 StartTracing();
134 134
135 // Let the stream run for a while in javascript.
136 ExecuteJavascriptAndWaitForOk( 135 ExecuteJavascriptAndWaitForOk(
137 base::StringPrintf("waitAndStopVideoTrack(%d);", time_to_sample_secs)); 136 base::StringPrintf("waitAndStopVideoTrack(window['myStreamName'], %d);",
137 time_to_sample_secs));
138 138
139 // Wait until the page title changes to "OK". Do not sleep() here since that 139 // Wait until the page title changes to "OK". Do not sleep() here since that
140 // would stop both this code and the browser underneath. 140 // would stop both this code and the browser underneath.
141 StopTracing(); 141 StopTracing();
142 142
143 scoped_ptr<TraceAnalyzer> analyzer(CreateTraceAnalyzer()); 143 scoped_ptr<TraceAnalyzer> analyzer(CreateTraceAnalyzer());
144 analyzer->AssociateBeginEndEvents(); 144 analyzer->AssociateBeginEndEvents();
145 trace_analyzer::TraceEventVector events; 145 trace_analyzer::TraceEventVector events;
146 DCHECK(measure_filter.size()); 146 DCHECK(measure_filter.size());
147 analyzer->FindEvents( 147 analyzer->FindEvents(
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 {640, 640, 360, 360, 10, 30}, 638 {640, 640, 360, 360, 10, 30},
639 {640, 640, 480, 480, 10, 30}, 639 {640, 640, 480, 480, 10, 30},
640 {960, 960, 720, 720, 10, 30}, 640 {960, 960, 720, 720, 10, 30},
641 {1280, 1280, 720, 720, 10, 30}}; 641 {1280, 1280, 720, 720, 10, 30}};
642 642
643 INSTANTIATE_TEST_CASE_P(UserMedia, 643 INSTANTIATE_TEST_CASE_P(UserMedia,
644 WebRtcConstraintsBrowserTest, 644 WebRtcConstraintsBrowserTest,
645 testing::ValuesIn(kAllUserMediaSizes)); 645 testing::ValuesIn(kAllUserMediaSizes));
646 646
647 } // namespace content 647 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/data/media/getusermedia.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698