| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |