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

Side by Side Diff: webkit/fileapi/file_system_url_request_job_unittest.cc

Issue 11787028: New FileSystemURL cracking (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test on Win Created 7 years, 11 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 (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 "webkit/fileapi/file_system_url_request_job.h" 5 #include "webkit/fileapi/file_system_url_request_job.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 TestRequestHelper(url, headers, true); 126 TestRequestHelper(url, headers, true);
127 } 127 }
128 128
129 void TestRequestNoRun(const GURL& url) { 129 void TestRequestNoRun(const GURL& url) {
130 TestRequestHelper(url, NULL, false); 130 TestRequestHelper(url, NULL, false);
131 } 131 }
132 132
133 void CreateDirectory(const base::StringPiece& dir_name) { 133 void CreateDirectory(const base::StringPiece& dir_name) {
134 FileSystemFileUtil* file_util = file_system_context_-> 134 FileSystemFileUtil* file_util = file_system_context_->
135 sandbox_provider()->GetFileUtil(kFileSystemTypeTemporary); 135 sandbox_provider()->GetFileUtil(kFileSystemTypeTemporary);
136 FileSystemURL url(GURL("http://remote"), 136 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
137 kFileSystemTypeTemporary, 137 GURL("http://remote"),
138 FilePath().AppendASCII(dir_name)); 138 kFileSystemTypeTemporary,
139 FilePath().AppendASCII(dir_name));
139 140
140 FileSystemOperationContext context(file_system_context_); 141 FileSystemOperationContext context(file_system_context_);
141 context.set_allowed_bytes_growth(1024); 142 context.set_allowed_bytes_growth(1024);
142 143
143 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateDirectory( 144 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateDirectory(
144 &context, 145 &context,
145 url, 146 url,
146 false /* exclusive */, 147 false /* exclusive */,
147 false /* recursive */)); 148 false /* recursive */));
148 } 149 }
149 150
150 void WriteFile(const base::StringPiece& file_name, 151 void WriteFile(const base::StringPiece& file_name,
151 const char* buf, int buf_size) { 152 const char* buf, int buf_size) {
152 FileSystemFileUtil* file_util = file_system_context_-> 153 FileSystemFileUtil* file_util = file_system_context_->
153 sandbox_provider()->GetFileUtil(kFileSystemTypeTemporary); 154 sandbox_provider()->GetFileUtil(kFileSystemTypeTemporary);
154 FileSystemURL url(GURL("http://remote"), 155 FileSystemURL url = file_system_context_->CreateCrackedFileSystemURL(
155 kFileSystemTypeTemporary, 156 GURL("http://remote"),
156 FilePath().AppendASCII(file_name)); 157 kFileSystemTypeTemporary,
158 FilePath().AppendASCII(file_name));
157 159
158 FileSystemOperationContext context(file_system_context_); 160 FileSystemOperationContext context(file_system_context_);
159 context.set_allowed_bytes_growth(1024); 161 context.set_allowed_bytes_growth(1024);
160 162
161 base::PlatformFile handle = base::kInvalidPlatformFileValue; 163 base::PlatformFile handle = base::kInvalidPlatformFileValue;
162 bool created = false; 164 bool created = false;
163 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen( 165 ASSERT_EQ(base::PLATFORM_FILE_OK, file_util->CreateOrOpen(
164 &context, 166 &context,
165 url, 167 url,
166 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE, 168 base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE,
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 360
359 TestRequest(CreateFileSystemURL(kFilename)); 361 TestRequest(CreateFileSystemURL(kFilename));
360 362
361 std::string mime_type_from_job; 363 std::string mime_type_from_job;
362 request_->GetMimeType(&mime_type_from_job); 364 request_->GetMimeType(&mime_type_from_job);
363 EXPECT_EQ(mime_type_direct, mime_type_from_job); 365 EXPECT_EQ(mime_type_direct, mime_type_from_job);
364 } 366 }
365 367
366 } // namespace 368 } // namespace
367 } // namespace fileapi 369 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_url_request_job.cc ('k') | webkit/fileapi/file_system_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698