| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); | 413 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); |
| 414 NavigateToURL(shell(), url); | 414 NavigateToURL(shell(), url); |
| 415 // Put getUserMedia to work and let it run for a couple of seconds. | 415 // Put getUserMedia to work and let it run for a couple of seconds. |
| 416 ASSERT_TRUE(ExecuteJavascript(base::StringPrintf( | 416 ASSERT_TRUE(ExecuteJavascript(base::StringPrintf( |
| 417 "%s({video: true}, 10);", kGetUserMediaAndWaitAndStop))); | 417 "%s({video: true}, 10);", kGetUserMediaAndWaitAndStop))); |
| 418 | 418 |
| 419 // Make sure the stream is up and running, then start collecting traces. | 419 // Make sure the stream is up and running, then start collecting traces. |
| 420 ExpectTitle("Running..."); | 420 ExpectTitle("Running..."); |
| 421 base::debug::TraceLog* trace_log = base::debug::TraceLog::GetInstance(); | 421 base::debug::TraceLog* trace_log = base::debug::TraceLog::GetInstance(); |
| 422 trace_log->SetEnabled(base::debug::CategoryFilter("video"), | 422 trace_log->SetEnabled(base::debug::CategoryFilter("video"), |
| 423 base::debug::TraceLog::RECORDING_MODE, |
| 423 base::debug::TraceLog::ENABLE_SAMPLING); | 424 base::debug::TraceLog::ENABLE_SAMPLING); |
| 424 // Check that we are indeed recording. | 425 // Check that we are indeed recording. |
| 425 ASSERT_EQ(trace_log->GetNumTracesRecorded(), 1); | 426 ASSERT_EQ(trace_log->GetNumTracesRecorded(), 1); |
| 426 | 427 |
| 427 // Wait until the page title changes to "OK". Do not sleep() here since that | 428 // Wait until the page title changes to "OK". Do not sleep() here since that |
| 428 // would stop both this code and the browser underneath. | 429 // would stop both this code and the browser underneath. |
| 429 ExpectTitle("OK"); | 430 ExpectTitle("OK"); |
| 430 | 431 |
| 431 // Note that we need to stop the trace recording before flushing the data. | 432 // Note that we need to stop the trace recording before flushing the data. |
| 432 trace_log->SetDisabled(); | 433 trace_log->SetDisabled(); |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 EXPECT_TRUE(base::PathExists(dump_file)); | 784 EXPECT_TRUE(base::PathExists(dump_file)); |
| 784 int64 file_size = 0; | 785 int64 file_size = 0; |
| 785 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); | 786 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); |
| 786 EXPECT_EQ(0, file_size); | 787 EXPECT_EQ(0, file_size); |
| 787 | 788 |
| 788 base::DeleteFile(dump_file, false); | 789 base::DeleteFile(dump_file, false); |
| 789 } | 790 } |
| 790 | 791 |
| 791 | 792 |
| 792 } // namespace content | 793 } // namespace content |
| OLD | NEW |