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

Side by Side Diff: webrtc/base/fileutils_unittest.cc

Issue 2718663005: Replace NULL with nullptr or null in webrtc/base/. (Closed)
Patch Set: Fixing Windows and formatting issues. Created 3 years, 9 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 | « webrtc/base/fileutils.cc ('k') | webrtc/base/firewallsocketserver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include <memory> 11 #include <memory>
12 12
13 #include "webrtc/base/fileutils.h" 13 #include "webrtc/base/fileutils.h"
14 #include "webrtc/base/gunit.h" 14 #include "webrtc/base/gunit.h"
15 #include "webrtc/base/pathutils.h" 15 #include "webrtc/base/pathutils.h"
16 #include "webrtc/base/stream.h" 16 #include "webrtc/base/stream.h"
17 17
18 namespace rtc { 18 namespace rtc {
19 19
20 #if defined (WEBRTC_ANDROID) 20 #if defined (WEBRTC_ANDROID)
21 // Fails on Android: https://bugs.chromium.org/p/webrtc/issues/detail?id=4364. 21 // Fails on Android: https://bugs.chromium.org/p/webrtc/issues/detail?id=4364.
22 #define MAYBE_FilesystemTest DISABLED_FilesystemTest 22 #define MAYBE_FilesystemTest DISABLED_FilesystemTest
23 #else 23 #else
24 #define MAYBE_FilesystemTest FilesystemTest 24 #define MAYBE_FilesystemTest FilesystemTest
25 #endif 25 #endif
26 26
27 // Make sure we can get a temp folder for the later tests. 27 // Make sure we can get a temp folder for the later tests.
28 TEST(MAYBE_FilesystemTest, GetTemporaryFolder) { 28 TEST(MAYBE_FilesystemTest, GetTemporaryFolder) {
29 Pathname path; 29 Pathname path;
30 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); 30 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, nullptr));
31 } 31 }
32 32
33 // Test creating a temp file, reading it back in, and deleting it. 33 // Test creating a temp file, reading it back in, and deleting it.
34 TEST(MAYBE_FilesystemTest, TestOpenFile) { 34 TEST(MAYBE_FilesystemTest, TestOpenFile) {
35 Pathname path; 35 Pathname path;
36 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); 36 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, nullptr));
37 path.SetPathname(Filesystem::TempFilename(path, "ut")); 37 path.SetPathname(Filesystem::TempFilename(path, "ut"));
38 38
39 FileStream* fs; 39 FileStream* fs;
40 char buf[256]; 40 char buf[256];
41 size_t bytes; 41 size_t bytes;
42 42
43 fs = Filesystem::OpenFile(path, "wb"); 43 fs = Filesystem::OpenFile(path, "wb");
44 ASSERT_TRUE(fs != NULL); 44 ASSERT_TRUE(fs != nullptr);
45 EXPECT_EQ(SR_SUCCESS, fs->Write("test", 4, &bytes, NULL)); 45 EXPECT_EQ(SR_SUCCESS, fs->Write("test", 4, &bytes, nullptr));
46 EXPECT_EQ(4U, bytes); 46 EXPECT_EQ(4U, bytes);
47 delete fs; 47 delete fs;
48 48
49 EXPECT_TRUE(Filesystem::IsFile(path)); 49 EXPECT_TRUE(Filesystem::IsFile(path));
50 50
51 fs = Filesystem::OpenFile(path, "rb"); 51 fs = Filesystem::OpenFile(path, "rb");
52 ASSERT_TRUE(fs != NULL); 52 ASSERT_TRUE(fs != nullptr);
53 EXPECT_EQ(SR_SUCCESS, fs->Read(buf, sizeof(buf), &bytes, NULL)); 53 EXPECT_EQ(SR_SUCCESS, fs->Read(buf, sizeof(buf), &bytes, nullptr));
54 EXPECT_EQ(4U, bytes); 54 EXPECT_EQ(4U, bytes);
55 delete fs; 55 delete fs;
56 56
57 EXPECT_TRUE(Filesystem::DeleteFile(path)); 57 EXPECT_TRUE(Filesystem::DeleteFile(path));
58 EXPECT_FALSE(Filesystem::IsFile(path)); 58 EXPECT_FALSE(Filesystem::IsFile(path));
59 } 59 }
60 60
61 // Test opening a non-existent file. 61 // Test opening a non-existent file.
62 TEST(MAYBE_FilesystemTest, TestOpenBadFile) { 62 TEST(MAYBE_FilesystemTest, TestOpenBadFile) {
63 Pathname path; 63 Pathname path;
64 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, NULL)); 64 EXPECT_TRUE(Filesystem::GetTemporaryFolder(path, true, nullptr));
65 path.SetFilename("not an actual file"); 65 path.SetFilename("not an actual file");
66 66
67 EXPECT_FALSE(Filesystem::IsFile(path)); 67 EXPECT_FALSE(Filesystem::IsFile(path));
68 68
69 FileStream* fs = Filesystem::OpenFile(path, "rb"); 69 FileStream* fs = Filesystem::OpenFile(path, "rb");
70 EXPECT_FALSE(fs != NULL); 70 EXPECT_FALSE(fs != nullptr);
71 } 71 }
72 72
73 } // namespace rtc 73 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/fileutils.cc ('k') | webrtc/base/firewallsocketserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698