| 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" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 class WebRtcGetUserMediaBrowserTest : public WebRtcContentBrowserTestBase { | 102 class WebRtcGetUserMediaBrowserTest : public WebRtcContentBrowserTestBase { |
| 103 public: | 103 public: |
| 104 WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) { | 104 WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) { |
| 105 // Automatically grant device permission. | 105 // Automatically grant device permission. |
| 106 AppendUseFakeUIForMediaStreamFlag(); | 106 AppendUseFakeUIForMediaStreamFlag(); |
| 107 } | 107 } |
| 108 ~WebRtcGetUserMediaBrowserTest() override {} | 108 ~WebRtcGetUserMediaBrowserTest() override {} |
| 109 | 109 |
| 110 void StartTracing() { | 110 void StartTracing() { |
| 111 CHECK(trace_log_ == NULL) << "Can only can start tracing once"; | 111 // Can only can start tracing once |
| 112 CHECK(trace_log_ == NULL); |
| 112 trace_log_ = base::trace_event::TraceLog::GetInstance(); | 113 trace_log_ = base::trace_event::TraceLog::GetInstance(); |
| 113 base::trace_event::TraceConfig trace_config( | 114 base::trace_event::TraceConfig trace_config( |
| 114 "video", base::trace_event::RECORD_UNTIL_FULL); | 115 "video", base::trace_event::RECORD_UNTIL_FULL); |
| 115 trace_log_->SetEnabled(trace_config, | 116 trace_log_->SetEnabled(trace_config, |
| 116 base::trace_event::TraceLog::RECORDING_MODE); | 117 base::trace_event::TraceLog::RECORDING_MODE); |
| 117 // Check that we are indeed recording. | 118 // Check that we are indeed recording. |
| 118 EXPECT_EQ(trace_log_->GetNumTracesRecorded(), 1); | 119 EXPECT_EQ(trace_log_->GetNumTracesRecorded(), 1); |
| 119 } | 120 } |
| 120 | 121 |
| 121 void StopTracing() { | 122 void StopTracing() { |
| 122 CHECK(message_loop_runner_.get() == NULL) | 123 // Calling StopTracing more than once |
| 123 << "Calling StopTracing more than once"; | 124 CHECK(message_loop_runner_.get() == NULL); |
| 124 | 125 |
| 125 { | 126 { |
| 126 base::ThreadRestrictions::ScopedAllowIO allow_thread_join_caused_by_test; | 127 base::ThreadRestrictions::ScopedAllowIO allow_thread_join_caused_by_test; |
| 127 trace_log_->SetDisabled(); | 128 trace_log_->SetDisabled(); |
| 128 } | 129 } |
| 129 | 130 |
| 130 message_loop_runner_ = new MessageLoopRunner; | 131 message_loop_runner_ = new MessageLoopRunner; |
| 131 trace_log_->Flush(base::Bind( | 132 trace_log_->Flush(base::Bind( |
| 132 &WebRtcGetUserMediaBrowserTest::OnTraceDataCollected, | 133 &WebRtcGetUserMediaBrowserTest::OnTraceDataCollected, |
| 133 base::Unretained(this))); | 134 base::Unretained(this))); |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 base::Bind(&VerifyDisableLocalEcho, true)); | 758 base::Bind(&VerifyDisableLocalEcho, true)); |
| 758 call = GenerateGetUserMediaWithDisableLocalEcho( | 759 call = GenerateGetUserMediaWithDisableLocalEcho( |
| 759 "getUserMediaAndExpectSuccess", "true"); | 760 "getUserMediaAndExpectSuccess", "true"); |
| 760 ExecuteJavascriptAndWaitForOk(call); | 761 ExecuteJavascriptAndWaitForOk(call); |
| 761 | 762 |
| 762 manager->SetGenerateStreamCallbackForTesting( | 763 manager->SetGenerateStreamCallbackForTesting( |
| 763 MediaStreamManager::GenerateStreamTestCallback()); | 764 MediaStreamManager::GenerateStreamTestCallback()); |
| 764 } | 765 } |
| 765 | 766 |
| 766 } // namespace content | 767 } // namespace content |
| OLD | NEW |