Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome/browser/media/webrtc_log_uploader_unittest.cc

Issue 211033006: Move destruction of WebRtcLogUploader to post threads teardown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor fix to unit test + rebase. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 ASSERT_TRUE(VerifyLastLineHasLocalIdOnly()); 168 ASSERT_TRUE(VerifyLastLineHasLocalIdOnly());
169 169
170 ASSERT_TRUE(AddLinesToTestFile(10)); 170 ASSERT_TRUE(AddLinesToTestFile(10));
171 ASSERT_TRUE(VerifyNumberOfLines(60)); 171 ASSERT_TRUE(VerifyNumberOfLines(60));
172 ASSERT_TRUE(VerifyLastLineHasAllInfo()); 172 ASSERT_TRUE(VerifyLastLineHasAllInfo());
173 173
174 webrtc_log_uploader_->AddLocallyStoredLogInfoToUploadListFile(test_list_path_, 174 webrtc_log_uploader_->AddLocallyStoredLogInfoToUploadListFile(test_list_path_,
175 kTestLocalId); 175 kTestLocalId);
176 ASSERT_TRUE(VerifyNumberOfLines(expected_line_limit)); 176 ASSERT_TRUE(VerifyNumberOfLines(expected_line_limit));
177 ASSERT_TRUE(VerifyLastLineHasLocalIdOnly()); 177 ASSERT_TRUE(VerifyLastLineHasLocalIdOnly());
178
179 webrtc_log_uploader_->StartShutdown();
178 } 180 }
179 181
180 TEST_F(WebRtcLogUploaderTest, AddUploadedLogInfoToUploadListFile) { 182 TEST_F(WebRtcLogUploaderTest, AddUploadedLogInfoToUploadListFile) {
181 // Get a temporary filename. We don't want the file to exist to begin with 183 // Get a temporary filename. We don't want the file to exist to begin with
182 // since that's the normal use case, hence the delete. 184 // since that's the normal use case, hence the delete.
183 ASSERT_TRUE(base::CreateTemporaryFile(&test_list_path_)); 185 ASSERT_TRUE(base::CreateTemporaryFile(&test_list_path_));
184 EXPECT_TRUE(base::DeleteFile(test_list_path_, false)); 186 EXPECT_TRUE(base::DeleteFile(test_list_path_, false));
185 scoped_ptr<WebRtcLogUploader> webrtc_log_uploader_(new WebRtcLogUploader()); 187 scoped_ptr<WebRtcLogUploader> webrtc_log_uploader_(new WebRtcLogUploader());
186 188
187 webrtc_log_uploader_->AddLocallyStoredLogInfoToUploadListFile(test_list_path_, 189 webrtc_log_uploader_->AddLocallyStoredLogInfoToUploadListFile(test_list_path_,
188 kTestLocalId); 190 kTestLocalId);
189 ASSERT_TRUE(VerifyNumberOfLines(1)); 191 ASSERT_TRUE(VerifyNumberOfLines(1));
190 ASSERT_TRUE(VerifyLastLineHasLocalIdOnly()); 192 ASSERT_TRUE(VerifyLastLineHasLocalIdOnly());
191 193
192 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile( 194 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(
193 test_list_path_, kTestLocalId, kTestReportId); 195 test_list_path_, kTestLocalId, kTestReportId);
194 ASSERT_TRUE(VerifyNumberOfLines(1)); 196 ASSERT_TRUE(VerifyNumberOfLines(1));
195 ASSERT_TRUE(VerifyLastLineHasAllInfo()); 197 ASSERT_TRUE(VerifyLastLineHasAllInfo());
196 198
197 // Use a local ID that should not be found in the list. 199 // Use a local ID that should not be found in the list.
198 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile( 200 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(
199 test_list_path_, "dummy id", kTestReportId); 201 test_list_path_, "dummy id", kTestReportId);
200 ASSERT_TRUE(VerifyNumberOfLines(2)); 202 ASSERT_TRUE(VerifyNumberOfLines(2));
201 ASSERT_TRUE(VerifyLastLineHasUploadTimeAndIdOnly()); 203 ASSERT_TRUE(VerifyLastLineHasUploadTimeAndIdOnly());
204
205 webrtc_log_uploader_->StartShutdown();
202 } 206 }
OLDNEW
« no previous file with comments | « chrome/browser/media/webrtc_log_uploader.cc ('k') | chrome/browser/media/webrtc_logging_handler_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698