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 <stdint.h> |
| 6 |
5 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
6 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
7 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
8 #include "base/strings/pattern.h" | 10 #include "base/strings/pattern.h" |
| 11 #include "build/build_config.h" |
9 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/tracing_controller.h" | 13 #include "content/public/browser/tracing_controller.h" |
11 #include "content/public/test/browser_test_utils.h" | 14 #include "content/public/test/browser_test_utils.h" |
12 #include "content/public/test/content_browser_test.h" | 15 #include "content/public/test/content_browser_test.h" |
13 #include "content/public/test/content_browser_test_utils.h" | 16 #include "content/public/test/content_browser_test_utils.h" |
14 #include "content/shell/browser/shell.h" | 17 #include "content/shell/browser/shell.h" |
15 | 18 |
16 using base::trace_event::RECORD_CONTINUOUSLY; | 19 using base::trace_event::RECORD_CONTINUOUSLY; |
17 using base::trace_event::RECORD_UNTIL_FULL; | 20 using base::trace_event::RECORD_UNTIL_FULL; |
18 using base::trace_event::TraceConfig; | 21 using base::trace_event::TraceConfig; |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 last_metadata_.reset(metadata.release()); | 128 last_metadata_.reset(metadata.release()); |
126 last_data_ = data->data(); | 129 last_data_ = data->data(); |
127 EXPECT_TRUE(data->size() > 0); | 130 EXPECT_TRUE(data->size() > 0); |
128 quit_callback.Run(); | 131 quit_callback.Run(); |
129 } | 132 } |
130 | 133 |
131 void StopTracingFileDoneCallbackTest(base::Closure quit_callback, | 134 void StopTracingFileDoneCallbackTest(base::Closure quit_callback, |
132 const base::FilePath& file_path) { | 135 const base::FilePath& file_path) { |
133 disable_recording_done_callback_count_++; | 136 disable_recording_done_callback_count_++; |
134 EXPECT_TRUE(PathExists(file_path)); | 137 EXPECT_TRUE(PathExists(file_path)); |
135 int64 file_size; | 138 int64_t file_size; |
136 base::GetFileSize(file_path, &file_size); | 139 base::GetFileSize(file_path, &file_size); |
137 EXPECT_TRUE(file_size > 0); | 140 EXPECT_TRUE(file_size > 0); |
138 quit_callback.Run(); | 141 quit_callback.Run(); |
139 last_actual_recording_file_path_ = file_path; | 142 last_actual_recording_file_path_ = file_path; |
140 } | 143 } |
141 | 144 |
142 void StartMonitoringDoneCallbackTest(base::Closure quit_callback) { | 145 void StartMonitoringDoneCallbackTest(base::Closure quit_callback) { |
143 enable_monitoring_done_callback_count_++; | 146 enable_monitoring_done_callback_count_++; |
144 quit_callback.Run(); | 147 quit_callback.Run(); |
145 } | 148 } |
146 | 149 |
147 void StopMonitoringDoneCallbackTest(base::Closure quit_callback) { | 150 void StopMonitoringDoneCallbackTest(base::Closure quit_callback) { |
148 disable_monitoring_done_callback_count_++; | 151 disable_monitoring_done_callback_count_++; |
149 quit_callback.Run(); | 152 quit_callback.Run(); |
150 } | 153 } |
151 | 154 |
152 void CaptureMonitoringSnapshotDoneCallbackTest( | 155 void CaptureMonitoringSnapshotDoneCallbackTest( |
153 base::Closure quit_callback, const base::FilePath& file_path) { | 156 base::Closure quit_callback, const base::FilePath& file_path) { |
154 capture_monitoring_snapshot_done_callback_count_++; | 157 capture_monitoring_snapshot_done_callback_count_++; |
155 EXPECT_TRUE(PathExists(file_path)); | 158 EXPECT_TRUE(PathExists(file_path)); |
156 int64 file_size; | 159 int64_t file_size; |
157 base::GetFileSize(file_path, &file_size); | 160 base::GetFileSize(file_path, &file_size); |
158 EXPECT_TRUE(file_size > 0); | 161 EXPECT_TRUE(file_size > 0); |
159 quit_callback.Run(); | 162 quit_callback.Run(); |
160 last_actual_monitoring_file_path_ = file_path; | 163 last_actual_monitoring_file_path_ = file_path; |
161 } | 164 } |
162 | 165 |
163 int get_categories_done_callback_count() const { | 166 int get_categories_done_callback_count() const { |
164 return get_categories_done_callback_count_; | 167 return get_categories_done_callback_count_; |
165 } | 168 } |
166 | 169 |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 trace_config, | 617 trace_config, |
615 TracingController::StartMonitoringDoneCallback())); | 618 TracingController::StartMonitoringDoneCallback())); |
616 controller->CaptureMonitoringSnapshot(NULL); | 619 controller->CaptureMonitoringSnapshot(NULL); |
617 base::RunLoop().RunUntilIdle(); | 620 base::RunLoop().RunUntilIdle(); |
618 EXPECT_TRUE(controller->StopMonitoring( | 621 EXPECT_TRUE(controller->StopMonitoring( |
619 TracingController::StopMonitoringDoneCallback())); | 622 TracingController::StopMonitoringDoneCallback())); |
620 base::RunLoop().RunUntilIdle(); | 623 base::RunLoop().RunUntilIdle(); |
621 } | 624 } |
622 | 625 |
623 } // namespace content | 626 } // namespace content |
OLD | NEW |