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

Side by Side Diff: base/files/file_util_unittest.cc

Issue 1255073002: clang/win: Fix most -Wunused-function warnings in Chromium code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mac Created 5 years, 5 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
« no previous file with comments | « no previous file | chrome/app/image_pre_reader_win.cc » ('j') | content/common/sandbox_win.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 std::wstring ReadTextFile(const FilePath& filename) { 237 std::wstring ReadTextFile(const FilePath& filename) {
238 wchar_t contents[64]; 238 wchar_t contents[64];
239 std::wifstream file; 239 std::wifstream file;
240 file.open(filename.value().c_str()); 240 file.open(filename.value().c_str());
241 EXPECT_TRUE(file.is_open()); 241 EXPECT_TRUE(file.is_open());
242 file.getline(contents, arraysize(contents)); 242 file.getline(contents, arraysize(contents));
243 file.close(); 243 file.close();
244 return std::wstring(contents); 244 return std::wstring(contents);
245 } 245 }
246 246
247 #if defined(OS_WIN)
248 uint64 FileTimeAsUint64(const FILETIME& ft) {
249 ULARGE_INTEGER u;
250 u.LowPart = ft.dwLowDateTime;
251 u.HighPart = ft.dwHighDateTime;
252 return u.QuadPart;
253 }
254 #endif
255
256 TEST_F(FileUtilTest, FileAndDirectorySize) { 247 TEST_F(FileUtilTest, FileAndDirectorySize) {
257 // Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize 248 // Create three files of 20, 30 and 3 chars (utf8). ComputeDirectorySize
258 // should return 53 bytes. 249 // should return 53 bytes.
259 FilePath file_01 = temp_dir_.path().Append(FPL("The file 01.txt")); 250 FilePath file_01 = temp_dir_.path().Append(FPL("The file 01.txt"));
260 CreateTextFile(file_01, L"12345678901234567890"); 251 CreateTextFile(file_01, L"12345678901234567890");
261 int64 size_f1 = 0; 252 int64 size_f1 = 0;
262 ASSERT_TRUE(GetFileSize(file_01, &size_f1)); 253 ASSERT_TRUE(GetFileSize(file_01, &size_f1));
263 EXPECT_EQ(20ll, size_f1); 254 EXPECT_EQ(20ll, size_f1);
264 255
265 FilePath subdir_path = temp_dir_.path().Append(FPL("Level2")); 256 FilePath subdir_path = temp_dir_.path().Append(FPL("Level2"));
(...skipping 2261 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 // Trying to close it should crash. This is important for security. 2518 // Trying to close it should crash. This is important for security.
2528 EXPECT_DEATH(CloseWithScopedFD(fds[1]), ""); 2519 EXPECT_DEATH(CloseWithScopedFD(fds[1]), "");
2529 #endif 2520 #endif
2530 } 2521 }
2531 2522
2532 #endif // defined(OS_POSIX) 2523 #endif // defined(OS_POSIX)
2533 2524
2534 } // namespace 2525 } // namespace
2535 2526
2536 } // namespace base 2527 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/app/image_pre_reader_win.cc » ('j') | content/common/sandbox_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698