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

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

Issue 100573002: Move directory creation functions to base namespace. (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
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 98 }
99 99
100 private: 100 private:
101 // Create the test files, filesystem objects, etc. 101 // Create the test files, filesystem objects, etc.
102 void SetupOnFileThread(const std::string& filename, 102 void SetupOnFileThread(const std::string& filename,
103 const std::string& content, 103 const std::string& content,
104 bool expected_result) { 104 bool expected_result) {
105 ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); 105 ASSERT_TRUE(base_dir_.CreateUniqueTempDir());
106 base::FilePath base = base_dir_.path(); 106 base::FilePath base = base_dir_.path();
107 base::FilePath src_path = base.AppendASCII("src_fs"); 107 base::FilePath src_path = base.AppendASCII("src_fs");
108 ASSERT_TRUE(file_util::CreateDirectory(src_path)); 108 ASSERT_TRUE(base::CreateDirectory(src_path));
109 109
110 ScopedVector<fileapi::FileSystemBackend> additional_providers; 110 ScopedVector<fileapi::FileSystemBackend> additional_providers;
111 additional_providers.push_back(new fileapi::TestFileSystemBackend( 111 additional_providers.push_back(new fileapi::TestFileSystemBackend(
112 base::MessageLoopProxy::current().get(), src_path)); 112 base::MessageLoopProxy::current().get(), src_path));
113 additional_providers.push_back(new MediaFileSystemBackend( 113 additional_providers.push_back(new MediaFileSystemBackend(
114 base, base::MessageLoopProxy::current().get())); 114 base, base::MessageLoopProxy::current().get()));
115 file_system_context_ = 115 file_system_context_ =
116 fileapi::CreateFileSystemContextWithAdditionalProvidersForTesting( 116 fileapi::CreateFileSystemContextWithAdditionalProvidersForTesting(
117 NULL, additional_providers.Pass(), base); 117 NULL, additional_providers.Pass(), base);
118 118
119 move_src_ = file_system_context_->CreateCrackedFileSystemURL( 119 move_src_ = file_system_context_->CreateCrackedFileSystemURL(
120 GURL(kOrigin), fileapi::kFileSystemTypeTest, 120 GURL(kOrigin), fileapi::kFileSystemTypeTest,
121 base::FilePath::FromUTF8Unsafe(filename)); 121 base::FilePath::FromUTF8Unsafe(filename));
122 122
123 test_file_size_ = content.size(); 123 test_file_size_ = content.size();
124 base::FilePath test_file = src_path.AppendASCII(filename); 124 base::FilePath test_file = src_path.AppendASCII(filename);
125 ASSERT_EQ(test_file_size_, 125 ASSERT_EQ(test_file_size_,
126 file_util::WriteFile(test_file, content.data(), test_file_size_)); 126 file_util::WriteFile(test_file, content.data(), test_file_size_));
127 127
128 base::FilePath dest_path = base.AppendASCII("dest_fs"); 128 base::FilePath dest_path = base.AppendASCII("dest_fs");
129 ASSERT_TRUE(file_util::CreateDirectory(dest_path)); 129 ASSERT_TRUE(base::CreateDirectory(dest_path));
130 std::string dest_fsid = 130 std::string dest_fsid =
131 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForPath( 131 fileapi::IsolatedContext::GetInstance()->RegisterFileSystemForPath(
132 fileapi::kFileSystemTypeNativeMedia, dest_path, NULL); 132 fileapi::kFileSystemTypeNativeMedia, dest_path, NULL);
133 133
134 size_t extension_index = filename.find_last_of("."); 134 size_t extension_index = filename.find_last_of(".");
135 ASSERT_NE(std::string::npos, extension_index); 135 ASSERT_NE(std::string::npos, extension_index);
136 std::string extension = filename.substr(extension_index); 136 std::string extension = filename.substr(extension_index);
137 std::string dest_root_fs_url = fileapi::GetIsolatedFileSystemRootURIString( 137 std::string dest_root_fs_url = fileapi::GetIsolatedFileSystemRootURIString(
138 GURL(kOrigin), dest_fsid, "dest_fs/"); 138 GURL(kOrigin), dest_fsid, "dest_fs/");
139 move_dest_ = file_system_context_->CrackURL(GURL( 139 move_dest_ = file_system_context_->CrackURL(GURL(
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 test_file = test_file.AppendASCII("no_streams.webm"); 270 test_file = test_file.AppendASCII("no_streams.webm");
271 MoveTestFromFile("no_streams.webm", test_file, false); 271 MoveTestFromFile("no_streams.webm", test_file, false);
272 } 272 }
273 273
274 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) { 274 IN_PROC_BROWSER_TEST_F(MediaFileValidatorTest, ValidVideo) {
275 base::FilePath test_file = GetMediaTestDir(); 275 base::FilePath test_file = GetMediaTestDir();
276 ASSERT_FALSE(test_file.empty()); 276 ASSERT_FALSE(test_file.empty());
277 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm"); 277 test_file = test_file.AppendASCII("bear-320x240-multitrack.webm");
278 MoveTestFromFile("multitrack.webm", test_file, true); 278 MoveTestFromFile("multitrack.webm", test_file, true);
279 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698