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

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

Issue 9007055: Check response code before writing blob to file. (Closed) Base URL: git://localhost/chromium.git@master
Patch Set: '' Created 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit)
6 // rather than as part of test_shell_tests because they rely on being able 6 // rather than as part of test_shell_tests because they rely on being able
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses
8 // TYPE_UI, which URLRequest doesn't allow. 8 // TYPE_UI, which URLRequest doesn't allow.
9 // 9 //
10 10
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 TEST_F(FileSystemOperationWriteTest, TestWriteInvalidBlobUrl) { 263 TEST_F(FileSystemOperationWriteTest, TestWriteInvalidBlobUrl) {
264 scoped_refptr<TestURLRequestContext> url_request_context( 264 scoped_refptr<TestURLRequestContext> url_request_context(
265 new TestURLRequestContext()); 265 new TestURLRequestContext());
266 266
267 operation()->Write(url_request_context, URLForPath(virtual_path_), 267 operation()->Write(url_request_context, URLForPath(virtual_path_),
268 GURL("blob:invalid"), 0); 268 GURL("blob:invalid"), 0);
269 MessageLoop::current()->Run(); 269 MessageLoop::current()->Run();
270 270
271 EXPECT_EQ(0, bytes_written()); 271 EXPECT_EQ(0, bytes_written());
272 EXPECT_EQ(base::PLATFORM_FILE_OK, status()); 272 EXPECT_EQ(base::PLATFORM_FILE_ERROR_FAILED, status());
273 EXPECT_TRUE(complete()); 273 EXPECT_TRUE(complete());
274 } 274 }
275 275
276 TEST_F(FileSystemOperationWriteTest, TestWriteInvalidFile) { 276 TEST_F(FileSystemOperationWriteTest, TestWriteInvalidFile) {
277 GURL blob_url("blob:writeinvalidfile"); 277 GURL blob_url("blob:writeinvalidfile");
278 scoped_refptr<webkit_blob::BlobData> blob_data(new webkit_blob::BlobData()); 278 scoped_refptr<webkit_blob::BlobData> blob_data(new webkit_blob::BlobData());
279 blob_data->AppendData("It\'ll not be written."); 279 blob_data->AppendData("It\'ll not be written.");
280 280
281 scoped_refptr<TestURLRequestContext> url_request_context( 281 scoped_refptr<TestURLRequestContext> url_request_context(
282 new TestURLRequestContext()); 282 new TestURLRequestContext());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 url_request_context->blob_storage_controller()->RemoveBlob(blob_url); 340 url_request_context->blob_storage_controller()->RemoveBlob(blob_url);
341 341
342 EXPECT_EQ(10, bytes_written()); 342 EXPECT_EQ(10, bytes_written());
343 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status()); 343 EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, status());
344 EXPECT_TRUE(complete()); 344 EXPECT_TRUE(complete());
345 } 345 }
346 346
347 // TODO(ericu,dmikurube): Add tests for Cancel. 347 // TODO(ericu,dmikurube): Add tests for Cancel.
348 348
349 } // namespace fileapi 349 } // namespace fileapi
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/file_writer_delegate.cc » ('j') | webkit/fileapi/file_writer_delegate.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698