OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 return true; | 82 return true; |
83 } | 83 } |
84 | 84 |
85 base::FilePath test_list_path_; | 85 base::FilePath test_list_path_; |
86 }; | 86 }; |
87 | 87 |
88 TEST_F(WebRtcLogUploaderTest, AddUploadedLogInfoToUploadListFile) { | 88 TEST_F(WebRtcLogUploaderTest, AddUploadedLogInfoToUploadListFile) { |
89 // Get a temporary filename. We don't want the file to exist to begin with | 89 // Get a temporary filename. We don't want the file to exist to begin with |
90 // since that's the normal use case, hence the delete. | 90 // since that's the normal use case, hence the delete. |
91 ASSERT_TRUE(file_util::CreateTemporaryFile(&test_list_path_)); | 91 ASSERT_TRUE(base::CreateTemporaryFile(&test_list_path_)); |
92 EXPECT_TRUE(base::DeleteFile(test_list_path_, false)); | 92 EXPECT_TRUE(base::DeleteFile(test_list_path_, false)); |
93 scoped_ptr<WebRtcLogUploader> webrtc_log_uploader_( | 93 scoped_ptr<WebRtcLogUploader> webrtc_log_uploader_( |
94 new WebRtcLogUploader()); | 94 new WebRtcLogUploader()); |
95 | 95 |
96 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, | 96 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, |
97 kTestReportId); | 97 kTestReportId); |
98 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, | 98 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, |
99 kTestReportId); | 99 kTestReportId); |
100 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(2)); | 100 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(2)); |
101 | 101 |
102 const int expected_line_limit = 50; | 102 const int expected_line_limit = 50; |
103 ASSERT_TRUE(AddLinesToTestFile(expected_line_limit - 2)); | 103 ASSERT_TRUE(AddLinesToTestFile(expected_line_limit - 2)); |
104 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); | 104 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); |
105 | 105 |
106 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, | 106 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, |
107 kTestReportId); | 107 kTestReportId); |
108 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); | 108 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); |
109 | 109 |
110 ASSERT_TRUE(AddLinesToTestFile(10)); | 110 ASSERT_TRUE(AddLinesToTestFile(10)); |
111 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(60)); | 111 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(60)); |
112 | 112 |
113 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, | 113 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(test_list_path_, |
114 kTestReportId); | 114 kTestReportId); |
115 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); | 115 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); |
116 } | 116 } |
OLD | NEW |