| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(const 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, | 74 std::unique_ptr<const base::DictionaryValue> metadata) override { |
| 75 const std::string& contents) override { | |
| 76 EXPECT_EQ(trace_, contents); | |
| 77 | |
| 78 std::string tmp = contents; | |
| 79 scoped_refptr<base::RefCountedString> chunk_ptr = | 75 scoped_refptr<base::RefCountedString> chunk_ptr = |
| 80 base::RefCountedString::TakeString(&tmp); | 76 base::RefCountedString::TakeString(&trace_); |
| 81 | 77 |
| 82 BrowserThread::PostTask( | 78 BrowserThread::PostTask( |
| 83 BrowserThread::UI, FROM_HERE, | 79 BrowserThread::UI, FROM_HERE, |
| 84 base::Bind(done_callback_, base::Passed(std::move(metadata)), | 80 base::Bind(done_callback_, base::Passed(std::move(metadata)), |
| 85 base::RetainedRef(chunk_ptr))); | 81 base::RetainedRef(chunk_ptr))); |
| 86 } | 82 } |
| 87 | 83 |
| 88 protected: | 84 protected: |
| 89 ~TracingControllerTestEndpoint() override {} | 85 ~TracingControllerTestEndpoint() override {} |
| 90 | 86 |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 435 |
| 440 TracingController* controller = TracingController::GetInstance(); | 436 TracingController* controller = TracingController::GetInstance(); |
| 441 EXPECT_TRUE(controller->StartTracing( | 437 EXPECT_TRUE(controller->StartTracing( |
| 442 TraceConfig(), | 438 TraceConfig(), |
| 443 TracingController::StartTracingDoneCallback())); | 439 TracingController::StartTracingDoneCallback())); |
| 444 EXPECT_TRUE(controller->StopTracing(NULL)); | 440 EXPECT_TRUE(controller->StopTracing(NULL)); |
| 445 base::RunLoop().RunUntilIdle(); | 441 base::RunLoop().RunUntilIdle(); |
| 446 } | 442 } |
| 447 | 443 |
| 448 } // namespace content | 444 } // namespace content |
| OLD | NEW |