OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/trace_event/trace_event.h" | 6 #include "base/trace_event/trace_event.h" |
7 #include "content/public/browser/background_tracing_manager.h" | 7 #include "content/public/browser/background_tracing_manager.h" |
8 #include "content/public/browser/background_tracing_preemptive_config.h" | 8 #include "content/public/browser/background_tracing_preemptive_config.h" |
9 #include "content/public/browser/background_tracing_reactive_config.h" | 9 #include "content/public/browser/background_tracing_reactive_config.h" |
10 #include "content/public/test/content_browser_test.h" | 10 #include "content/public/test/content_browser_test.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 class BackgroundTracingManagerUploadConfigWrapper { | 25 class BackgroundTracingManagerUploadConfigWrapper { |
26 public: | 26 public: |
27 BackgroundTracingManagerUploadConfigWrapper(const base::Closure& callback) | 27 BackgroundTracingManagerUploadConfigWrapper(const base::Closure& callback) |
28 : callback_(callback), receive_count_(0) { | 28 : callback_(callback), receive_count_(0) { |
29 receive_callback_ = | 29 receive_callback_ = |
30 base::Bind(&BackgroundTracingManagerUploadConfigWrapper::Upload, | 30 base::Bind(&BackgroundTracingManagerUploadConfigWrapper::Upload, |
31 base::Unretained(this)); | 31 base::Unretained(this)); |
32 } | 32 } |
33 | 33 |
34 void Upload(const scoped_refptr<base::RefCountedString>& file_contents, | 34 void Upload(const scoped_refptr<base::RefCountedString>& file_contents, |
| 35 scoped_ptr<base::DictionaryValue> metadata, |
35 base::Callback<void()> done_callback) { | 36 base::Callback<void()> done_callback) { |
36 receive_count_ += 1; | 37 receive_count_ += 1; |
37 EXPECT_TRUE(file_contents); | 38 EXPECT_TRUE(file_contents); |
38 | 39 |
39 size_t compressed_length = file_contents->data().length(); | 40 size_t compressed_length = file_contents->data().length(); |
40 const size_t kOutputBufferLength = 10 * 1024 * 1024; | 41 const size_t kOutputBufferLength = 10 * 1024 * 1024; |
41 std::vector<char> output_str(kOutputBufferLength); | 42 std::vector<char> output_str(kOutputBufferLength); |
42 | 43 |
43 z_stream stream = {0}; | 44 z_stream stream = {0}; |
44 stream.avail_in = compressed_length; | 45 stream.avail_in = compressed_length; |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( | 580 BackgroundTracingManager::GetInstance()->TriggerNamedEvent( |
580 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), false)); | 581 handle, base::Bind(&StartedFinalizingCallback, base::Closure(), false)); |
581 | 582 |
582 run_loop.Run(); | 583 run_loop.Run(); |
583 | 584 |
584 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); | 585 EXPECT_TRUE(upload_config_wrapper.get_receive_count() == 1); |
585 } | 586 } |
586 } | 587 } |
587 | 588 |
588 } // namespace content | 589 } // namespace content |
OLD | NEW |