| 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.h" | 10 #include "base/message_loop.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 | 72 |
| 73 // CreateTemporaryFileInDir may return a legacy 8.3 file name on windows. | 73 // CreateTemporaryFileInDir may return a legacy 8.3 file name on windows. |
| 74 // Need to use the original directory name for string comparisons. | 74 // Need to use the original directory name for string comparisons. |
| 75 ASSERT_TRUE(net_log_temp_file_->GetNetExportLog()); | 75 ASSERT_TRUE(net_log_temp_file_->GetNetExportLog()); |
| 76 net_export_log_ = net_log_temp_file_->log_path_; | 76 net_export_log_ = net_log_temp_file_->log_path_; |
| 77 ASSERT_FALSE(net_export_log_.empty()); | 77 ASSERT_FALSE(net_export_log_.empty()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 virtual void TearDown() OVERRIDE { | 80 virtual void TearDown() OVERRIDE { |
| 81 // Delete the temporary file we have created. | 81 // Delete the temporary file we have created. |
| 82 ASSERT_TRUE(file_util::Delete(net_export_log_, false)); | 82 ASSERT_TRUE(base::Delete(net_export_log_, false)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 std::string GetStateString() const { | 85 std::string GetStateString() const { |
| 86 scoped_ptr<base::DictionaryValue> dict(net_log_temp_file_->GetState()); | 86 scoped_ptr<base::DictionaryValue> dict(net_log_temp_file_->GetState()); |
| 87 std::string state; | 87 std::string state; |
| 88 EXPECT_TRUE(dict->GetString("state", &state)); | 88 EXPECT_TRUE(dict->GetString("state", &state)); |
| 89 return state; | 89 return state; |
| 90 } | 90 } |
| 91 | 91 |
| 92 // Make sure the export file has been created and is non-empty, as net | 92 // Make sure the export file has been created and is non-empty, as net |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // Log an event. | 278 // Log an event. |
| 279 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); | 279 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); |
| 280 | 280 |
| 281 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); | 281 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); |
| 282 VerifyFileAndStateAfterDoStop(); | 282 VerifyFileAndStateAfterDoStop(); |
| 283 | 283 |
| 284 int64 new_stop_file_size; | 284 int64 new_stop_file_size; |
| 285 EXPECT_TRUE(file_util::GetFileSize(net_export_log_, &new_stop_file_size)); | 285 EXPECT_TRUE(file_util::GetFileSize(net_export_log_, &new_stop_file_size)); |
| 286 EXPECT_GE(new_stop_file_size, stop_file_size); | 286 EXPECT_GE(new_stop_file_size, stop_file_size); |
| 287 } | 287 } |
| OLD | NEW |