OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/net/net_log_temp_file.h" | 5 #include "chrome/browser/net/net_log_temp_file.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); | 226 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); |
227 VerifyFileAndStateAfterDoStop(); | 227 VerifyFileAndStateAfterDoStop(); |
228 | 228 |
229 int64 stop_file_size; | 229 int64 stop_file_size; |
230 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size)); | 230 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size)); |
231 EXPECT_GE(stop_file_size, start_file_size); | 231 EXPECT_GE(stop_file_size, start_file_size); |
232 | 232 |
233 // Add some junk at the end of the file. | 233 // Add some junk at the end of the file. |
234 std::string junk_data("Hello"); | 234 std::string junk_data("Hello"); |
235 EXPECT_GT(file_util::AppendToFile( | 235 EXPECT_GT(base::AppendToFile( |
236 net_export_log_, junk_data.c_str(), junk_data.size()), 0); | 236 net_export_log_, junk_data.c_str(), junk_data.size()), 0); |
237 | 237 |
238 int64 junk_file_size; | 238 int64 junk_file_size; |
239 EXPECT_TRUE(base::GetFileSize(net_export_log_, &junk_file_size)); | 239 EXPECT_TRUE(base::GetFileSize(net_export_log_, &junk_file_size)); |
240 EXPECT_GT(junk_file_size, stop_file_size); | 240 EXPECT_GT(junk_file_size, stop_file_size); |
241 | 241 |
242 // Execute DO_START/DO_STOP commands and make sure the file is back to the | 242 // Execute DO_START/DO_STOP commands and make sure the file is back to the |
243 // size before addition of junk data. | 243 // size before addition of junk data. |
244 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_START); | 244 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_START); |
245 VerifyFileAndStateAfterDoStart(); | 245 VerifyFileAndStateAfterDoStart(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // Log an event. | 277 // Log an event. |
278 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); | 278 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); |
279 | 279 |
280 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); | 280 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); |
281 VerifyFileAndStateAfterDoStop(); | 281 VerifyFileAndStateAfterDoStop(); |
282 | 282 |
283 int64 new_stop_file_size; | 283 int64 new_stop_file_size; |
284 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); | 284 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); |
285 EXPECT_GE(new_stop_file_size, stop_file_size); | 285 EXPECT_GE(new_stop_file_size, stop_file_size); |
286 } | 286 } |
OLD | NEW |