| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "storage/browser/fileapi/local_file_stream_writer.h" | 5 #include "storage/browser/fileapi/local_file_stream_writer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 void TearDown() override { | 38 void TearDown() override { |
| 39 // Give another chance for deleted streams to perform Close. | 39 // Give another chance for deleted streams to perform Close. |
| 40 base::RunLoop().RunUntilIdle(); | 40 base::RunLoop().RunUntilIdle(); |
| 41 file_thread_.Stop(); | 41 file_thread_.Stop(); |
| 42 base::RunLoop().RunUntilIdle(); | 42 base::RunLoop().RunUntilIdle(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 base::FilePath Path(const std::string& name) { | 46 base::FilePath Path(const std::string& name) { |
| 47 return temp_dir_.path().AppendASCII(name); | 47 return temp_dir_.GetPath().AppendASCII(name); |
| 48 } | 48 } |
| 49 | 49 |
| 50 int WriteStringToWriter(LocalFileStreamWriter* writer, | 50 int WriteStringToWriter(LocalFileStreamWriter* writer, |
| 51 const std::string& data) { | 51 const std::string& data) { |
| 52 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer(data)); | 52 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer(data)); |
| 53 scoped_refptr<net::DrainableIOBuffer> drainable( | 53 scoped_refptr<net::DrainableIOBuffer> drainable( |
| 54 new net::DrainableIOBuffer(buffer.get(), buffer->size())); | 54 new net::DrainableIOBuffer(buffer.get(), buffer->size())); |
| 55 | 55 |
| 56 while (drainable->BytesRemaining() > 0) { | 56 while (drainable->BytesRemaining() > 0) { |
| 57 net::TestCompletionCallback callback; | 57 net::TestCompletionCallback callback; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); | 173 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); |
| 174 ASSERT_EQ(net::ERR_IO_PENDING, result); | 174 ASSERT_EQ(net::ERR_IO_PENDING, result); |
| 175 | 175 |
| 176 net::TestCompletionCallback callback; | 176 net::TestCompletionCallback callback; |
| 177 writer->Cancel(callback.callback()); | 177 writer->Cancel(callback.callback()); |
| 178 int cancel_result = callback.WaitForResult(); | 178 int cancel_result = callback.WaitForResult(); |
| 179 EXPECT_EQ(net::OK, cancel_result); | 179 EXPECT_EQ(net::OK, cancel_result); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace content | 182 } // namespace content |
| OLD | NEW |