| OLD | NEW |
| 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 #include "webkit/fileapi/webfilewriter_base.h" | 5 #include "webkit/fileapi/webfilewriter_base.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 EXPECT_TRUE(testable_writer_->received_cancel_); | 378 EXPECT_TRUE(testable_writer_->received_cancel_); |
| 379 EXPECT_FALSE(testable_writer_->received_write_); | 379 EXPECT_FALSE(testable_writer_->received_write_); |
| 380 | 380 |
| 381 // Check that the client gets called correctly. | 381 // Check that the client gets called correctly. |
| 382 EXPECT_TRUE(received_did_fail_); | 382 EXPECT_TRUE(received_did_fail_); |
| 383 EXPECT_EQ(WebKit::WebFileErrorAbort, fail_error_received_); | 383 EXPECT_EQ(WebKit::WebFileErrorAbort, fail_error_received_); |
| 384 EXPECT_FALSE(received_did_truncate_); | 384 EXPECT_FALSE(received_did_truncate_); |
| 385 EXPECT_EQ(0, received_did_write_count_); | 385 EXPECT_EQ(0, received_did_write_count_); |
| 386 } | 386 } |
| 387 | 387 |
| 388 TEST_F(FileWriterTest, DeleteInOldCompletionCallbacks) { | 388 TEST_F(FileWriterTest, DeleteInCompletionCallbacks) { |
| 389 delete_in_client_callback_ = true; | 389 delete_in_client_callback_ = true; |
| 390 writer()->write(kBasicFileWrite_Offset, GURL("blob://bloburl/")); | 390 writer()->write(kBasicFileWrite_Offset, GURL("blob://bloburl/")); |
| 391 EXPECT_FALSE(testable_writer_.get()); | 391 EXPECT_FALSE(testable_writer_.get()); |
| 392 | 392 |
| 393 reset(); | 393 reset(); |
| 394 delete_in_client_callback_ = true; | 394 delete_in_client_callback_ = true; |
| 395 writer()->truncate(kBasicFileTruncate_Offset); | 395 writer()->truncate(kBasicFileTruncate_Offset); |
| 396 EXPECT_FALSE(testable_writer_.get()); | 396 EXPECT_FALSE(testable_writer_.get()); |
| 397 | 397 |
| 398 reset(); | 398 reset(); |
| 399 delete_in_client_callback_ = true; | 399 delete_in_client_callback_ = true; |
| 400 writer()->write(kErrorFileWrite_Offset, GURL("blob://bloburl/")); | 400 writer()->write(kErrorFileWrite_Offset, GURL("blob://bloburl/")); |
| 401 EXPECT_FALSE(testable_writer_.get()); | 401 EXPECT_FALSE(testable_writer_.get()); |
| 402 | 402 |
| 403 reset(); | 403 reset(); |
| 404 delete_in_client_callback_ = true; | 404 delete_in_client_callback_ = true; |
| 405 writer()->truncate(kErrorFileTruncate_Offset); | 405 writer()->truncate(kErrorFileTruncate_Offset); |
| 406 EXPECT_FALSE(testable_writer_.get()); | 406 EXPECT_FALSE(testable_writer_.get()); |
| 407 | 407 |
| 408 // Not crashing counts as passing. | 408 // Not crashing counts as passing. |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace fileapi | 411 } // namespace fileapi |
| OLD | NEW |