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/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); | 291 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); |
292 VerifyFileAndStateAfterDoStop(); | 292 VerifyFileAndStateAfterDoStop(); |
293 | 293 |
294 int64 stop_file_size; | 294 int64 stop_file_size; |
295 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size)); | 295 EXPECT_TRUE(base::GetFileSize(net_export_log_, &stop_file_size)); |
296 EXPECT_GE(stop_file_size, start_file_size); | 296 EXPECT_GE(stop_file_size, start_file_size); |
297 | 297 |
298 // Add some junk at the end of the file. | 298 // Add some junk at the end of the file. |
299 std::string junk_data("Hello"); | 299 std::string junk_data("Hello"); |
300 EXPECT_GT(base::AppendToFile( | 300 EXPECT_TRUE(base::AppendToFile(net_export_log_, junk_data.c_str(), |
301 net_export_log_, junk_data.c_str(), junk_data.size()), 0); | 301 junk_data.size())); |
302 | 302 |
303 int64 junk_file_size; | 303 int64 junk_file_size; |
304 EXPECT_TRUE(base::GetFileSize(net_export_log_, &junk_file_size)); | 304 EXPECT_TRUE(base::GetFileSize(net_export_log_, &junk_file_size)); |
305 EXPECT_GT(junk_file_size, stop_file_size); | 305 EXPECT_GT(junk_file_size, stop_file_size); |
306 | 306 |
307 // Execute DO_START/DO_STOP commands and make sure the file is back to the | 307 // Execute DO_START/DO_STOP commands and make sure the file is back to the |
308 // size before addition of junk data. | 308 // size before addition of junk data. |
309 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_START); | 309 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_START); |
310 VerifyFileAndStateAfterDoStart(); | 310 VerifyFileAndStateAfterDoStart(); |
311 | 311 |
(...skipping 30 matching lines...) Expand all Loading... |
342 // Log an event. | 342 // Log an event. |
343 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); | 343 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); |
344 | 344 |
345 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); | 345 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); |
346 VerifyFileAndStateAfterDoStop(); | 346 VerifyFileAndStateAfterDoStop(); |
347 | 347 |
348 int64 new_stop_file_size; | 348 int64 new_stop_file_size; |
349 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); | 349 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); |
350 EXPECT_GE(new_stop_file_size, stop_file_size); | 350 EXPECT_GE(new_stop_file_size, stop_file_size); |
351 } | 351 } |
OLD | NEW |