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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "chrome/browser/media/webrtc_log_uploader.h" 14 #include "chrome/browser/media/webrtc_log_uploader.h"
15 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
16 16
17 const char kTestReportId[] = "123456789"; 17 const char kTestReportId[] = "123456789";
18 const char kTestTime[] = "987654321"; 18 const char kTestTime[] = "987654321";
19 19
20 class WebRtcLogUploaderTest : public testing::Test { 20 class WebRtcLogUploaderTest : public testing::Test {
21 public: 21 public:
22 WebRtcLogUploaderTest() {} 22 WebRtcLogUploaderTest() {}
23 23
24 bool VerifyNumberOfLinesAndContentsOfLastLine(int expected_lines) { 24 bool VerifyNumberOfLinesAndContentsOfLastLine(int expected_lines) {
25 std::string contents; 25 std::string contents;
26 int read = file_util::ReadFileToString(test_list_path_, &contents); 26 int read = base::ReadFileToString(test_list_path_, &contents);
27 EXPECT_GT(read, 0); 27 EXPECT_GT(read, 0);
28 if (read <= 0) 28 if (read <= 0)
29 return false; 29 return false;
30 30
31 // Verify expected number of lines. Since every line should end with '\n', 31 // Verify expected number of lines. Since every line should end with '\n',
32 // there should be an additional empty line after splitting. 32 // there should be an additional empty line after splitting.
33 std::vector<std::string> lines; 33 std::vector<std::string> lines;
34 base::SplitString(contents, '\n', &lines); 34 base::SplitString(contents, '\n', &lines);
35 EXPECT_EQ(expected_lines + 1, static_cast<int>(lines.size())); 35 EXPECT_EQ(expected_lines + 1, static_cast<int>(lines.size()));
36 if (expected_lines + 1 != static_cast<int>(lines.size())) 36 if (expected_lines + 1 != static_cast<int>(lines.size()))
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(kTestReportId); 105 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(kTestReportId);
106 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); 106 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit));
107 107
108 ASSERT_TRUE(AddLinesToTestFile(10)); 108 ASSERT_TRUE(AddLinesToTestFile(10));
109 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(60)); 109 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(60));
110 110
111 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(kTestReportId); 111 webrtc_log_uploader_->AddUploadedLogInfoToUploadListFile(kTestReportId);
112 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit)); 112 ASSERT_TRUE(VerifyNumberOfLinesAndContentsOfLastLine(expected_line_limit));
113 } 113 }
OLDNEW
« no previous file with comments | « chrome/browser/media/webrtc_log_uploader.cc ('k') | chrome/browser/media_galleries/fileapi/itunes_finder_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698