| 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/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/test/trace_event_analyzer.h" | 8 #include "base/test/trace_event_analyzer.h" |
| 9 #include "base/trace_event/trace_event_impl.h" | 9 #include "base/trace_event/trace_event_impl.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 | 75 |
| 76 namespace content { | 76 namespace content { |
| 77 | 77 |
| 78 class WebRtcGetUserMediaBrowserTest: public WebRtcContentBrowserTest { | 78 class WebRtcGetUserMediaBrowserTest: public WebRtcContentBrowserTest { |
| 79 public: | 79 public: |
| 80 WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) {} | 80 WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) {} |
| 81 ~WebRtcGetUserMediaBrowserTest() override {} | 81 ~WebRtcGetUserMediaBrowserTest() override {} |
| 82 | 82 |
| 83 void StartTracing() { | 83 void StartTracing() { |
| 84 CHECK(trace_log_ == NULL) << "Can only can start tracing once"; | 84 CHECK(trace_log_ == NULL) << "Can only can start tracing once"; |
| 85 trace_log_ = base::debug::TraceLog::GetInstance(); | 85 trace_log_ = base::trace_event::TraceLog::GetInstance(); |
| 86 base::debug::TraceOptions trace_options(base::debug::RECORD_UNTIL_FULL); | 86 base::trace_event::TraceOptions trace_options( |
| 87 base::trace_event::RECORD_UNTIL_FULL); |
| 87 trace_options.enable_sampling = true; | 88 trace_options.enable_sampling = true; |
| 88 trace_log_->SetEnabled(base::debug::CategoryFilter("video"), | 89 trace_log_->SetEnabled(base::trace_event::CategoryFilter("video"), |
| 89 base::debug::TraceLog::RECORDING_MODE, | 90 base::trace_event::TraceLog::RECORDING_MODE, |
| 90 trace_options); | 91 trace_options); |
| 91 // Check that we are indeed recording. | 92 // Check that we are indeed recording. |
| 92 EXPECT_EQ(trace_log_->GetNumTracesRecorded(), 1); | 93 EXPECT_EQ(trace_log_->GetNumTracesRecorded(), 1); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void StopTracing() { | 96 void StopTracing() { |
| 96 CHECK(message_loop_runner_.get() == NULL) | 97 CHECK(message_loop_runner_.get() == NULL) |
| 97 << "Calling StopTracing more than once"; | 98 << "Calling StopTracing more than once"; |
| 98 trace_log_->SetDisabled(); | 99 trace_log_->SetDisabled(); |
| 99 message_loop_runner_ = new MessageLoopRunner; | 100 message_loop_runner_ = new MessageLoopRunner; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 audio_ids->push_back(device_id); | 225 audio_ids->push_back(device_id); |
| 225 } else if (kind == "video") { | 226 } else if (kind == "video") { |
| 226 video_ids->push_back(device_id); | 227 video_ids->push_back(device_id); |
| 227 } | 228 } |
| 228 } | 229 } |
| 229 ASSERT_FALSE(audio_ids->empty()); | 230 ASSERT_FALSE(audio_ids->empty()); |
| 230 ASSERT_FALSE(video_ids->empty()); | 231 ASSERT_FALSE(video_ids->empty()); |
| 231 } | 232 } |
| 232 | 233 |
| 233 private: | 234 private: |
| 234 base::debug::TraceLog* trace_log_; | 235 base::trace_event::TraceLog* trace_log_; |
| 235 scoped_refptr<base::RefCountedString> recorded_trace_data_; | 236 scoped_refptr<base::RefCountedString> recorded_trace_data_; |
| 236 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 237 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
| 237 }; | 238 }; |
| 238 | 239 |
| 239 // These tests will all make a getUserMedia call with different constraints and | 240 // These tests will all make a getUserMedia call with different constraints and |
| 240 // see that the success callback is called. If the error callback is called or | 241 // see that the success callback is called. If the error callback is called or |
| 241 // none of the callbacks are called the tests will simply time out and fail. | 242 // none of the callbacks are called the tests will simply time out and fail. |
| 242 | 243 |
| 243 // Test fails under MSan, http://crbug.com/445745 | 244 // Test fails under MSan, http://crbug.com/445745 |
| 244 #if defined(MEMORY_SANITIZER) | 245 #if defined(MEMORY_SANITIZER) |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 {640, 640, 360, 360, 10, 30}, | 720 {640, 640, 360, 360, 10, 30}, |
| 720 {640, 640, 480, 480, 10, 30}, | 721 {640, 640, 480, 480, 10, 30}, |
| 721 {960, 960, 720, 720, 10, 30}, | 722 {960, 960, 720, 720, 10, 30}, |
| 722 {1280, 1280, 720, 720, 10, 30}}; | 723 {1280, 1280, 720, 720, 10, 30}}; |
| 723 | 724 |
| 724 INSTANTIATE_TEST_CASE_P(UserMedia, | 725 INSTANTIATE_TEST_CASE_P(UserMedia, |
| 725 WebRtcConstraintsBrowserTest, | 726 WebRtcConstraintsBrowserTest, |
| 726 testing::ValuesIn(kAllUserMediaSizes)); | 727 testing::ValuesIn(kAllUserMediaSizes)); |
| 727 | 728 |
| 728 } // namespace content | 729 } // namespace content |
| OLD | NEW |