OLD | NEW |
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 <string> | 5 #include <string> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 FileWriterDelegate::WriteProgressStatus write_status() const { | 56 FileWriterDelegate::WriteProgressStatus write_status() const { |
57 return write_status_; | 57 return write_status_; |
58 } | 58 } |
59 | 59 |
60 void DidWrite(base::File::Error status, int64 bytes, | 60 void DidWrite(base::File::Error status, int64 bytes, |
61 FileWriterDelegate::WriteProgressStatus write_status) { | 61 FileWriterDelegate::WriteProgressStatus write_status) { |
62 write_status_ = write_status; | 62 write_status_ = write_status; |
63 if (status == base::File::FILE_OK) { | 63 if (status == base::File::FILE_OK) { |
64 bytes_written_ += bytes; | 64 bytes_written_ += bytes; |
65 if (write_status_ != FileWriterDelegate::SUCCESS_IO_PENDING) | 65 if (write_status_ != FileWriterDelegate::SUCCESS_IO_PENDING) |
66 base::MessageLoop::current()->Quit(); | 66 base::MessageLoop::current()->QuitWhenIdle(); |
67 } else { | 67 } else { |
68 EXPECT_EQ(base::File::FILE_OK, status_); | 68 EXPECT_EQ(base::File::FILE_OK, status_); |
69 status_ = status; | 69 status_ = status; |
70 base::MessageLoop::current()->Quit(); | 70 base::MessageLoop::current()->QuitWhenIdle(); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 private: | 74 private: |
75 // For post-operation status. | 75 // For post-operation status. |
76 base::File::Error status_; | 76 base::File::Error status_; |
77 int64 bytes_written_; | 77 int64 bytes_written_; |
78 FileWriterDelegate::WriteProgressStatus write_status_; | 78 FileWriterDelegate::WriteProgressStatus write_status_; |
79 }; | 79 }; |
80 | 80 |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 file_writer_delegate_.reset(); | 489 file_writer_delegate_.reset(); |
490 | 490 |
491 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); | 491 EXPECT_EQ(pre_write_usage + allowed_growth, usage()); |
492 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); | 492 EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); |
493 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); | 493 EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written()); |
494 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); | 494 EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status()); |
495 } | 495 } |
496 } | 496 } |
497 | 497 |
498 } // namespace content | 498 } // namespace content |
OLD | NEW |