| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "base/test/trace_event_analyzer.h" | 11 #include "base/test/trace_event_analyzer.h" |
| 12 #include "base/threading/thread_restrictions.h" |
| 12 #include "base/trace_event/trace_event_impl.h" | 13 #include "base/trace_event/trace_event_impl.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 15 #include "content/browser/media/webrtc/webrtc_internals.h" | 16 #include "content/browser/media/webrtc/webrtc_internals.h" |
| 16 #include "content/browser/web_contents/web_contents_impl.h" | 17 #include "content/browser/web_contents/web_contents_impl.h" |
| 17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/test/browser_test_utils.h" | 19 #include "content/public/test/browser_test_utils.h" |
| 19 #include "content/public/test/content_browser_test_utils.h" | 20 #include "content/public/test/content_browser_test_utils.h" |
| 20 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
| 21 #include "content/shell/browser/shell.h" | 22 #include "content/shell/browser/shell.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 trace_config.EnableSampling(); | 96 trace_config.EnableSampling(); |
| 96 trace_log_->SetEnabled(trace_config, | 97 trace_log_->SetEnabled(trace_config, |
| 97 base::trace_event::TraceLog::RECORDING_MODE); | 98 base::trace_event::TraceLog::RECORDING_MODE); |
| 98 // Check that we are indeed recording. | 99 // Check that we are indeed recording. |
| 99 EXPECT_EQ(trace_log_->GetNumTracesRecorded(), 1); | 100 EXPECT_EQ(trace_log_->GetNumTracesRecorded(), 1); |
| 100 } | 101 } |
| 101 | 102 |
| 102 void StopTracing() { | 103 void StopTracing() { |
| 103 CHECK(message_loop_runner_.get() == NULL) | 104 CHECK(message_loop_runner_.get() == NULL) |
| 104 << "Calling StopTracing more than once"; | 105 << "Calling StopTracing more than once"; |
| 105 trace_log_->SetDisabled(); | 106 |
| 107 { |
| 108 base::ThreadRestrictions::ScopedAllowIO allow_thread_join_caused_by_test; |
| 109 trace_log_->SetDisabled(); |
| 110 } |
| 111 |
| 106 message_loop_runner_ = new MessageLoopRunner; | 112 message_loop_runner_ = new MessageLoopRunner; |
| 107 trace_log_->Flush(base::Bind( | 113 trace_log_->Flush(base::Bind( |
| 108 &WebRtcGetUserMediaBrowserTest::OnTraceDataCollected, | 114 &WebRtcGetUserMediaBrowserTest::OnTraceDataCollected, |
| 109 base::Unretained(this))); | 115 base::Unretained(this))); |
| 110 message_loop_runner_->Run(); | 116 message_loop_runner_->Run(); |
| 111 } | 117 } |
| 112 | 118 |
| 113 void OnTraceDataCollected( | 119 void OnTraceDataCollected( |
| 114 const scoped_refptr<base::RefCountedString>& events_str_ptr, | 120 const scoped_refptr<base::RefCountedString>& events_str_ptr, |
| 115 bool has_more_events) { | 121 bool has_more_events) { |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 {640, 640, 360, 360, 10, 30}, | 776 {640, 640, 360, 360, 10, 30}, |
| 771 {640, 640, 480, 480, 10, 30}, | 777 {640, 640, 480, 480, 10, 30}, |
| 772 {960, 960, 720, 720, 10, 30}, | 778 {960, 960, 720, 720, 10, 30}, |
| 773 {1280, 1280, 720, 720, 10, 30}}; | 779 {1280, 1280, 720, 720, 10, 30}}; |
| 774 | 780 |
| 775 INSTANTIATE_TEST_CASE_P(UserMedia, | 781 INSTANTIATE_TEST_CASE_P(UserMedia, |
| 776 WebRtcConstraintsBrowserTest, | 782 WebRtcConstraintsBrowserTest, |
| 777 testing::ValuesIn(kAllUserMediaSizes)); | 783 testing::ValuesIn(kAllUserMediaSizes)); |
| 778 | 784 |
| 779 } // namespace content | 785 } // namespace content |
| OLD | NEW |