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

Side by Side Diff: utils/cross/temporary_file_test.cc

Issue 203077: This updated the GYP deps file to the last known good revision of Chrome,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: Created 11 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
« no previous file with comments | « utils/cross/temporary_file.cc ('k') | 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 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 class TemporaryFileTest : public testing::Test { 43 class TemporaryFileTest : public testing::Test {
44 }; 44 };
45 45
46 TEST_F(TemporaryFileTest, BasicConstruction) { 46 TEST_F(TemporaryFileTest, BasicConstruction) {
47 TemporaryFile temporary_file; 47 TemporaryFile temporary_file;
48 EXPECT_TRUE(temporary_file.path().empty()); 48 EXPECT_TRUE(temporary_file.path().empty());
49 } 49 }
50 50
51 TEST_F(TemporaryFileTest, BasicFunction) { 51 TEST_F(TemporaryFileTest, BasicFunction) {
52 FilePath path; 52 FilePath path;
53 file_util::CreateTemporaryFileName(&path); 53 file_util::CreateTemporaryFile(&path);
54 EXPECT_TRUE(file_util::PathExists(path)); 54 EXPECT_TRUE(file_util::PathExists(path));
55 { 55 {
56 TemporaryFile temporary_file(path); 56 TemporaryFile temporary_file(path);
57 EXPECT_TRUE(file_util::PathExists(path)); 57 EXPECT_TRUE(file_util::PathExists(path));
58 EXPECT_EQ(path.value(), temporary_file.path().value()); 58 EXPECT_EQ(path.value(), temporary_file.path().value());
59 EXPECT_TRUE(file_util::PathExists(temporary_file.path())); 59 EXPECT_TRUE(file_util::PathExists(temporary_file.path()));
60 } 60 }
61 EXPECT_FALSE(file_util::PathExists(path)); 61 EXPECT_FALSE(file_util::PathExists(path));
62 } 62 }
63 63
64 TEST_F(TemporaryFileTest, Reset) { 64 TEST_F(TemporaryFileTest, Reset) {
65 FilePath path; 65 FilePath path;
66 FilePath path1; 66 FilePath path1;
67 file_util::CreateTemporaryFileName(&path); 67 file_util::CreateTemporaryFile(&path);
68 file_util::CreateTemporaryFileName(&path1); 68 file_util::CreateTemporaryFile(&path1);
69 EXPECT_TRUE(file_util::PathExists(path)); 69 EXPECT_TRUE(file_util::PathExists(path));
70 EXPECT_TRUE(file_util::PathExists(path1)); 70 EXPECT_TRUE(file_util::PathExists(path1));
71 { 71 {
72 TemporaryFile temporary_file(path1); 72 TemporaryFile temporary_file(path1);
73 EXPECT_EQ(path1.value(), temporary_file.path().value()); 73 EXPECT_EQ(path1.value(), temporary_file.path().value());
74 EXPECT_TRUE(file_util::PathExists(path1)); 74 EXPECT_TRUE(file_util::PathExists(path1));
75 EXPECT_TRUE(file_util::PathExists(temporary_file.path())); 75 EXPECT_TRUE(file_util::PathExists(temporary_file.path()));
76 temporary_file.Reset(path); 76 temporary_file.Reset(path);
77 EXPECT_TRUE(file_util::PathExists(path)); 77 EXPECT_TRUE(file_util::PathExists(path));
78 EXPECT_EQ(path.value(), temporary_file.path().value()); 78 EXPECT_EQ(path.value(), temporary_file.path().value());
79 EXPECT_FALSE(file_util::PathExists(path1)); 79 EXPECT_FALSE(file_util::PathExists(path1));
80 EXPECT_TRUE(file_util::PathExists(path)); 80 EXPECT_TRUE(file_util::PathExists(path));
81 EXPECT_TRUE(file_util::PathExists(temporary_file.path())); 81 EXPECT_TRUE(file_util::PathExists(temporary_file.path()));
82 } 82 }
83 EXPECT_FALSE(file_util::PathExists(path)); 83 EXPECT_FALSE(file_util::PathExists(path));
84 EXPECT_FALSE(file_util::PathExists(path1)); 84 EXPECT_FALSE(file_util::PathExists(path1));
85 } 85 }
86 86
87 TEST_F(TemporaryFileTest, Release) { 87 TEST_F(TemporaryFileTest, Release) {
88 FilePath path; 88 FilePath path;
89 file_util::CreateTemporaryFileName(&path); 89 file_util::CreateTemporaryFile(&path);
90 EXPECT_TRUE(file_util::PathExists(path)); 90 EXPECT_TRUE(file_util::PathExists(path));
91 { 91 {
92 TemporaryFile temporary_file(path); 92 TemporaryFile temporary_file(path);
93 EXPECT_TRUE(file_util::PathExists(path)); 93 EXPECT_TRUE(file_util::PathExists(path));
94 EXPECT_TRUE(file_util::PathExists(temporary_file.path())); 94 EXPECT_TRUE(file_util::PathExists(temporary_file.path()));
95 temporary_file.Release(); 95 temporary_file.Release();
96 } 96 }
97 EXPECT_TRUE(file_util::PathExists(path)); 97 EXPECT_TRUE(file_util::PathExists(path));
98 } 98 }
99 99
100 TEST_F(TemporaryFileTest, Create) { 100 TEST_F(TemporaryFileTest, Create) {
101 FilePath test_path; 101 FilePath test_path;
102 { 102 {
103 TemporaryFile temporary_file; 103 TemporaryFile temporary_file;
104 TemporaryFile::Create(&temporary_file); 104 TemporaryFile::Create(&temporary_file);
105 EXPECT_FALSE(temporary_file.path().empty()); 105 EXPECT_FALSE(temporary_file.path().empty());
106 EXPECT_TRUE(file_util::PathExists(temporary_file.path())); 106 EXPECT_TRUE(file_util::PathExists(temporary_file.path()));
107 EXPECT_TRUE(file_util::PathIsWritable(temporary_file.path())); 107 EXPECT_TRUE(file_util::PathIsWritable(temporary_file.path()));
108 test_path = temporary_file.path(); 108 test_path = temporary_file.path();
109 } 109 }
110 EXPECT_FALSE(file_util::PathExists(test_path)); 110 EXPECT_FALSE(file_util::PathExists(test_path));
111 } 111 }
112 112
113 } // namespace o3d 113 } // namespace o3d
OLDNEW
« no previous file with comments | « utils/cross/temporary_file.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698