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/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
191 private: | 191 private: |
192 // Checks state after one of the DO_START* commands. | 192 // Checks state after one of the DO_START* commands. |
193 void VerifyFileAndStateAfterStart( | 193 void VerifyFileAndStateAfterStart( |
194 NetLogTempFile::LogType expected_log_type, | 194 NetLogTempFile::LogType expected_log_type, |
195 const std::string& expected_log_type_string, | 195 const std::string& expected_log_type_string, |
196 net::NetLogCaptureMode expected_capture_mode) const { | 196 net::NetLogCaptureMode expected_capture_mode) const { |
197 EXPECT_EQ(NetLogTempFile::STATE_LOGGING, net_log_temp_file_->state()); | 197 EXPECT_EQ(NetLogTempFile::STATE_LOGGING, net_log_temp_file_->state()); |
198 EXPECT_EQ("LOGGING", GetStateString()); | 198 EXPECT_EQ("LOGGING", GetStateString()); |
199 EXPECT_EQ(expected_log_type, net_log_temp_file_->log_type()); | 199 EXPECT_EQ(expected_log_type, net_log_temp_file_->log_type()); |
200 EXPECT_EQ(expected_log_type_string, GetLogTypeString()); | 200 EXPECT_EQ(expected_log_type_string, GetLogTypeString()); |
201 | 201 |
mmenke
2015/05/06 15:14:41
Since you removed the check here, we have no check
eroman
2015/05/06 17:01:04
Oops my bad (I meant to add a check back for this)
| |
202 EXPECT_EQ(expected_capture_mode, net_log_->GetCaptureMode()); | |
203 | |
204 // Check GetFilePath returns false when still writing to the file. | 202 // Check GetFilePath returns false when still writing to the file. |
205 base::FilePath net_export_file_path; | 203 base::FilePath net_export_file_path; |
206 EXPECT_FALSE(net_log_temp_file_->GetFilePath(&net_export_file_path)); | 204 EXPECT_FALSE(net_log_temp_file_->GetFilePath(&net_export_file_path)); |
207 | 205 |
208 VerifyNetExportLogExists(); | 206 VerifyNetExportLogExists(); |
209 } | 207 } |
210 | 208 |
211 void VerifyFileAndStateAfterDoStop( | 209 void VerifyFileAndStateAfterDoStop( |
212 NetLogTempFile::LogType expected_log_type, | 210 NetLogTempFile::LogType expected_log_type, |
213 const std::string& expected_log_type_string) const { | 211 const std::string& expected_log_type_string) const { |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
391 // Log an event. | 389 // Log an event. |
392 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); | 390 net_log_->AddGlobalEntry(net::NetLog::TYPE_CANCELLED); |
393 | 391 |
394 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); | 392 net_log_temp_file_->ProcessCommand(NetLogTempFile::DO_STOP); |
395 VerifyFileAndStateAfterDoStop(); | 393 VerifyFileAndStateAfterDoStop(); |
396 | 394 |
397 int64 new_stop_file_size; | 395 int64 new_stop_file_size; |
398 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); | 396 EXPECT_TRUE(base::GetFileSize(net_export_log_, &new_stop_file_size)); |
399 EXPECT_GE(new_stop_file_size, stop_file_size); | 397 EXPECT_GE(new_stop_file_size, stop_file_size); |
400 } | 398 } |
OLD | NEW |