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

Side by Side Diff: chrome/browser/media_galleries/fileapi/itunes_file_util_unittest.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 public: 135 public:
136 ItunesFileUtilTest() 136 ItunesFileUtilTest()
137 : io_thread_(content::BrowserThread::IO, &message_loop_) { 137 : io_thread_(content::BrowserThread::IO, &message_loop_) {
138 } 138 }
139 virtual ~ItunesFileUtilTest() {} 139 virtual ~ItunesFileUtilTest() {}
140 140
141 void SetUpDataProvider() { 141 void SetUpDataProvider() {
142 ASSERT_TRUE(fake_library_dir_.CreateUniqueTempDir()); 142 ASSERT_TRUE(fake_library_dir_.CreateUniqueTempDir());
143 ASSERT_EQ( 143 ASSERT_EQ(
144 0, 144 0,
145 file_util::WriteFile( 145 base::WriteFile(
146 fake_library_dir_.path().AppendASCII(kITunesLibraryXML), 146 fake_library_dir_.path().AppendASCII(kITunesLibraryXML),
147 NULL, 147 NULL,
148 0)); 148 0));
149 149
150 itunes_data_provider_.reset( 150 itunes_data_provider_.reset(
151 new TestITunesDataProvider(fake_library_dir_.path())); 151 new TestITunesDataProvider(fake_library_dir_.path()));
152 } 152 }
153 153
154 virtual void SetUp() OVERRIDE { 154 virtual void SetUp() OVERRIDE {
155 ASSERT_TRUE(profile_dir_.CreateUniqueTempDir()); 155 ASSERT_TRUE(profile_dir_.CreateUniqueTempDir());
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 EXPECT_TRUE(contents.back().is_directory); 277 EXPECT_TRUE(contents.back().is_directory);
278 278
279 EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kITunesAutoAddDir).value(), 279 EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kITunesAutoAddDir).value(),
280 contents.front().name); 280 contents.front().name);
281 EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kITunesMusicDir).value(), 281 EXPECT_EQ(base::FilePath::FromUTF8Unsafe(kITunesMusicDir).value(),
282 contents.back().name); 282 contents.back().name);
283 } 283 }
284 284
285 TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerate) { 285 TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerate) {
286 data_provider()->SetProvideAutoAddDir(true); 286 data_provider()->SetProvideAutoAddDir(true);
287 ASSERT_EQ(0, file_util::WriteFile( 287 ASSERT_EQ(0, base::WriteFile(
288 data_provider()->auto_add_path().AppendASCII("baz.ogg"), NULL, 0)); 288 data_provider()->auto_add_path().AppendASCII("baz.ogg"), NULL, 0));
289 289
290 FileSystemOperation::FileEntryList contents; 290 FileSystemOperation::FileEntryList contents;
291 FileSystemURL url = CreateURL( 291 FileSystemURL url = CreateURL(
292 std::string(kITunesMediaDir) + "/" + kITunesAutoAddDir); 292 std::string(kITunesMediaDir) + "/" + kITunesAutoAddDir);
293 bool completed = false; 293 bool completed = false;
294 294
295 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); 295 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed);
296 ASSERT_TRUE(completed); 296 ASSERT_TRUE(completed);
297 ASSERT_EQ(1u, contents.size()); 297 ASSERT_EQ(1u, contents.size());
298 EXPECT_FALSE(contents.front().is_directory); 298 EXPECT_FALSE(contents.front().is_directory);
299 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), 299 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(),
300 contents.front().name); 300 contents.front().name);
301 } 301 }
302 302
303 TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerateNested) { 303 TEST_F(ItunesFileUtilTest, ItunesAutoAddDirEnumerateNested) {
304 data_provider()->SetProvideAutoAddDir(true); 304 data_provider()->SetProvideAutoAddDir(true);
305 base::FilePath nested_dir = 305 base::FilePath nested_dir =
306 data_provider()->auto_add_path().AppendASCII("foo").AppendASCII("bar"); 306 data_provider()->auto_add_path().AppendASCII("foo").AppendASCII("bar");
307 ASSERT_TRUE(base::CreateDirectory(nested_dir)); 307 ASSERT_TRUE(base::CreateDirectory(nested_dir));
308 ASSERT_EQ(0, 308 ASSERT_EQ(0,
309 file_util::WriteFile(nested_dir.AppendASCII("baz.ogg"), NULL, 0)); 309 base::WriteFile(nested_dir.AppendASCII("baz.ogg"), NULL, 0));
310 310
311 FileSystemOperation::FileEntryList contents; 311 FileSystemOperation::FileEntryList contents;
312 FileSystemURL url = CreateURL( 312 FileSystemURL url = CreateURL(
313 std::string(kITunesMediaDir) + "/" + kITunesAutoAddDir); 313 std::string(kITunesMediaDir) + "/" + kITunesAutoAddDir);
314 bool completed = false; 314 bool completed = false;
315 315
316 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); 316 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed);
317 ASSERT_TRUE(completed); 317 ASSERT_TRUE(completed);
318 ASSERT_EQ(1u, contents.size()); 318 ASSERT_EQ(1u, contents.size());
319 EXPECT_TRUE(contents.front().is_directory); 319 EXPECT_TRUE(contents.front().is_directory);
(...skipping 15 matching lines...) Expand all
335 completed = false; 335 completed = false;
336 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed); 336 ReadDirectoryTestHelper(operation_runner(), url, &contents, &completed);
337 ASSERT_TRUE(completed); 337 ASSERT_TRUE(completed);
338 ASSERT_EQ(1u, contents.size()); 338 ASSERT_EQ(1u, contents.size());
339 EXPECT_FALSE(contents.front().is_directory); 339 EXPECT_FALSE(contents.front().is_directory);
340 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(), 340 EXPECT_EQ(base::FilePath().AppendASCII("baz.ogg").value(),
341 contents.front().name); 341 contents.front().name);
342 } 342 }
343 343
344 } // namespace itunes 344 } // namespace itunes
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698