| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 net_log_temp_file_(new TestNetLogTempFile(net_log_.get())), | 58 net_log_temp_file_(new TestNetLogTempFile(net_log_.get())), |
| 59 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, | 59 file_user_blocking_thread_(BrowserThread::FILE_USER_BLOCKING, |
| 60 &message_loop_) { | 60 &message_loop_) { |
| 61 } | 61 } |
| 62 | 62 |
| 63 // ::testing::Test implementation: | 63 // ::testing::Test implementation: |
| 64 virtual void SetUp() OVERRIDE { | 64 virtual void SetUp() OVERRIDE { |
| 65 // Get a temporary file name for unit tests. | 65 // Get a temporary file name for unit tests. |
| 66 base::FilePath net_log_dir; | 66 base::FilePath net_log_dir; |
| 67 ASSERT_TRUE(net_log_temp_file_->GetNetExportLogDirectory(&net_log_dir)); | 67 ASSERT_TRUE(net_log_temp_file_->GetNetExportLogDirectory(&net_log_dir)); |
| 68 ASSERT_TRUE(file_util::CreateTemporaryFileInDir(net_log_dir, | 68 ASSERT_TRUE(base::CreateTemporaryFileInDir(net_log_dir, &net_export_log_)); |
| 69 &net_export_log_)); | |
| 70 | 69 |
| 71 net_log_temp_file_->log_filename_ = net_export_log_.BaseName().value(); | 70 net_log_temp_file_->log_filename_ = net_export_log_.BaseName().value(); |
| 72 | 71 |
| 73 // CreateTemporaryFileInDir may return a legacy 8.3 file name on windows. | 72 // CreateTemporaryFileInDir may return a legacy 8.3 file name on windows. |
| 74 // Need to use the original directory name for string comparisons. | 73 // Need to use the original directory name for string comparisons. |
| 75 ASSERT_TRUE(net_log_temp_file_->GetNetExportLog()); | 74 ASSERT_TRUE(net_log_temp_file_->GetNetExportLog()); |
| 76 net_export_log_ = net_log_temp_file_->log_path_; | 75 net_export_log_ = net_log_temp_file_->log_path_; |
| 77 ASSERT_FALSE(net_export_log_.empty()); | 76 ASSERT_FALSE(net_export_log_.empty()); |
| 78 } | 77 } |
| 79 | 78 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // Log an event. | 277 // Log an event. |
| 279 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); | 278 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); |
| 280 | 279 |
| 281 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); | 280 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); |
| 282 VerifyFileAndStateAfterDoStop(); | 281 VerifyFileAndStateAfterDoStop(); |
| 283 | 282 |
| 284 int64 new_stop_file_size; | 283 int64 new_stop_file_size; |
| 285 EXPECT_TRUE(file_util::GetFileSize(net_export_log_, &new_stop_file_size)); | 284 EXPECT_TRUE(file_util::GetFileSize(net_export_log_, &new_stop_file_size)); |
| 286 EXPECT_GE(new_stop_file_size, stop_file_size); | 285 EXPECT_GE(new_stop_file_size, stop_file_size); |
| 287 } | 286 } |
| OLD | NEW |