| 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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 VerifyNetExportLog(); | 148 VerifyNetExportLog(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 scoped_ptr<ChromeNetLog> net_log_; | 151 scoped_ptr<ChromeNetLog> net_log_; |
| 152 // |net_log_temp_file_| is initialized after |net_log_| so that it can stop | 152 // |net_log_temp_file_| is initialized after |net_log_| so that it can stop |
| 153 // obvserving on destruction. | 153 // obvserving on destruction. |
| 154 scoped_ptr<TestNetLogTempFile> net_log_temp_file_; | 154 scoped_ptr<TestNetLogTempFile> net_log_temp_file_; |
| 155 base::FilePath net_export_log_; | 155 base::FilePath net_export_log_; |
| 156 | 156 |
| 157 private: | 157 private: |
| 158 MessageLoop message_loop_; | 158 base::MessageLoop message_loop_; |
| 159 content::TestBrowserThread file_user_blocking_thread_; | 159 content::TestBrowserThread file_user_blocking_thread_; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 TEST_F(NetLogTempFileTest, EnsureInitFailure) { | 162 TEST_F(NetLogTempFileTest, EnsureInitFailure) { |
| 163 net_log_temp_file_->set_lie_about_net_export_log_directory(true); | 163 net_log_temp_file_->set_lie_about_net_export_log_directory(true); |
| 164 | 164 |
| 165 EXPECT_FALSE(net_log_temp_file_->EnsureInit()); | 165 EXPECT_FALSE(net_log_temp_file_->EnsureInit()); |
| 166 VerifyFilePathAndStateAfterEnsureInitFailure(); | 166 VerifyFilePathAndStateAfterEnsureInitFailure(); |
| 167 | 167 |
| 168 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_START); | 168 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_START); |
| (...skipping 109 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 |