| 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" | 5 #include "content/public/browser/tracing_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 class TracingControllerTestEndpoint : public TraceDataEndpoint { | 61 class TracingControllerTestEndpoint : public TraceDataEndpoint { |
| 62 public: | 62 public: |
| 63 TracingControllerTestEndpoint( | 63 TracingControllerTestEndpoint( |
| 64 base::Callback<void(std::unique_ptr<const base::DictionaryValue>, | 64 base::Callback<void(std::unique_ptr<const base::DictionaryValue>, |
| 65 base::RefCountedString*)> done_callback) | 65 base::RefCountedString*)> done_callback) |
| 66 : done_callback_(done_callback) {} | 66 : done_callback_(done_callback) {} |
| 67 | 67 |
| 68 void ReceiveTraceChunk(const std::string& chunk) override { | 68 void ReceiveTraceChunk(std::unique_ptr<std::string> chunk) override { |
| 69 EXPECT_FALSE(chunk.empty()); | 69 EXPECT_FALSE(chunk->empty()); |
| 70 trace_ += chunk; | 70 trace_ += *chunk; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void ReceiveTraceFinalContents( | 73 void ReceiveTraceFinalContents( |
| 74 std::unique_ptr<const base::DictionaryValue> metadata) override { | 74 std::unique_ptr<const base::DictionaryValue> metadata) override { |
| 75 scoped_refptr<base::RefCountedString> chunk_ptr = | 75 scoped_refptr<base::RefCountedString> chunk_ptr = |
| 76 base::RefCountedString::TakeString(&trace_); | 76 base::RefCountedString::TakeString(&trace_); |
| 77 | 77 |
| 78 BrowserThread::PostTask( | 78 BrowserThread::PostTask( |
| 79 BrowserThread::UI, FROM_HERE, | 79 BrowserThread::UI, FROM_HERE, |
| 80 base::Bind(done_callback_, base::Passed(std::move(metadata)), | 80 base::Bind(done_callback_, base::Passed(std::move(metadata)), |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 | 435 |
| 436 TracingController* controller = TracingController::GetInstance(); | 436 TracingController* controller = TracingController::GetInstance(); |
| 437 EXPECT_TRUE(controller->StartTracing( | 437 EXPECT_TRUE(controller->StartTracing( |
| 438 TraceConfig(), | 438 TraceConfig(), |
| 439 TracingController::StartTracingDoneCallback())); | 439 TracingController::StartTracingDoneCallback())); |
| 440 EXPECT_TRUE(controller->StopTracing(NULL)); | 440 EXPECT_TRUE(controller->StopTracing(NULL)); |
| 441 base::RunLoop().RunUntilIdle(); | 441 base::RunLoop().RunUntilIdle(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace content | 444 } // namespace content |
| OLD | NEW |