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

Side by Side Diff: base/file_util_unittest.cc

Issue 93963003: Fix a test failure as GetFileSize() will not set the size if it fails (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 2342 matching lines...) Expand 10 before | Expand all | Expand 10 after
2353 EXPECT_TRUE(file_util::ReadFromFD(fd, buffer, image_size)); 2353 EXPECT_TRUE(file_util::ReadFromFD(fd, buffer, image_size));
2354 delete[] buffer; 2354 delete[] buffer;
2355 } 2355 }
2356 2356
2357 TEST_F(FileUtilTest, NonExistentContentUriTest) { 2357 TEST_F(FileUtilTest, NonExistentContentUriTest) {
2358 base::FilePath path("content://foo.bar"); 2358 base::FilePath path("content://foo.bar");
2359 EXPECT_TRUE(path.IsContentUri()); 2359 EXPECT_TRUE(path.IsContentUri());
2360 EXPECT_FALSE(base::PathExists(path)); 2360 EXPECT_FALSE(base::PathExists(path));
2361 // Size should be smaller than 0. 2361 // Size should be smaller than 0.
2362 int64 size; 2362 int64 size;
2363 file_util::GetFileSize(path, &size); 2363 EXPECT_FALSE(file_util::GetFileSize(path, &size));
2364 EXPECT_GT(0, size);
2365 2364
2366 // We should not be able to read the file. 2365 // We should not be able to read the file.
2367 int fd = base::OpenContentUriForRead(path); 2366 int fd = base::OpenContentUriForRead(path);
2368 EXPECT_EQ(-1, fd); 2367 EXPECT_EQ(-1, fd);
2369 } 2368 }
2370 #endif 2369 #endif
2371 2370
2372 #endif // defined(OS_POSIX) 2371 #endif // defined(OS_POSIX)
2373 2372
2374 } // namespace 2373 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698