| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/public/browser/tracing_controller.h" |
| 6 |
| 5 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> |
| 6 | 9 |
| 7 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 10 #include "base/strings/pattern.h" | 13 #include "base/strings/pattern.h" |
| 11 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 12 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/tracing_controller.h" | |
| 14 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
| 15 #include "content/public/test/content_browser_test.h" | 17 #include "content/public/test/content_browser_test.h" |
| 16 #include "content/public/test/content_browser_test_utils.h" | 18 #include "content/public/test/content_browser_test_utils.h" |
| 17 #include "content/shell/browser/shell.h" | 19 #include "content/shell/browser/shell.h" |
| 18 | 20 |
| 19 using base::trace_event::RECORD_CONTINUOUSLY; | 21 using base::trace_event::RECORD_CONTINUOUSLY; |
| 20 using base::trace_event::RECORD_UNTIL_FULL; | 22 using base::trace_event::RECORD_UNTIL_FULL; |
| 21 using base::trace_event::TraceConfig; | 23 using base::trace_event::TraceConfig; |
| 22 | 24 |
| 23 namespace content { | 25 namespace content { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 scoped_ptr<const base::DictionaryValue> metadata, | 72 scoped_ptr<const base::DictionaryValue> metadata, |
| 71 const std::string& contents) override { | 73 const std::string& contents) override { |
| 72 EXPECT_EQ(trace_, contents); | 74 EXPECT_EQ(trace_, contents); |
| 73 | 75 |
| 74 std::string tmp = contents; | 76 std::string tmp = contents; |
| 75 scoped_refptr<base::RefCountedString> chunk_ptr = | 77 scoped_refptr<base::RefCountedString> chunk_ptr = |
| 76 base::RefCountedString::TakeString(&tmp); | 78 base::RefCountedString::TakeString(&tmp); |
| 77 | 79 |
| 78 BrowserThread::PostTask( | 80 BrowserThread::PostTask( |
| 79 BrowserThread::UI, FROM_HERE, | 81 BrowserThread::UI, FROM_HERE, |
| 80 base::Bind(done_callback_, base::Passed(metadata.Pass()), chunk_ptr)); | 82 base::Bind(done_callback_, base::Passed(std::move(metadata)), |
| 83 chunk_ptr)); |
| 81 } | 84 } |
| 82 | 85 |
| 83 protected: | 86 protected: |
| 84 ~TracingControllerTestEndpoint() override {} | 87 ~TracingControllerTestEndpoint() override {} |
| 85 | 88 |
| 86 std::string trace_; | 89 std::string trace_; |
| 87 base::Callback<void(scoped_ptr<const base::DictionaryValue>, | 90 base::Callback<void(scoped_ptr<const base::DictionaryValue>, |
| 88 base::RefCountedString*)> done_callback_; | 91 base::RefCountedString*)> done_callback_; |
| 89 }; | 92 }; |
| 90 | 93 |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 trace_config, | 620 trace_config, |
| 618 TracingController::StartMonitoringDoneCallback())); | 621 TracingController::StartMonitoringDoneCallback())); |
| 619 controller->CaptureMonitoringSnapshot(NULL); | 622 controller->CaptureMonitoringSnapshot(NULL); |
| 620 base::RunLoop().RunUntilIdle(); | 623 base::RunLoop().RunUntilIdle(); |
| 621 EXPECT_TRUE(controller->StopMonitoring( | 624 EXPECT_TRUE(controller->StopMonitoring( |
| 622 TracingController::StopMonitoringDoneCallback())); | 625 TracingController::StopMonitoringDoneCallback())); |
| 623 base::RunLoop().RunUntilIdle(); | 626 base::RunLoop().RunUntilIdle(); |
| 624 } | 627 } |
| 625 | 628 |
| 626 } // namespace content | 629 } // namespace content |
| OLD | NEW |