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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 using storage::FileStreamWriter; | 21 using storage::FileStreamWriter; |
22 using storage::LocalFileStreamWriter; | 22 using storage::LocalFileStreamWriter; |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 class LocalFileStreamWriterTest : public testing::Test { | 26 class LocalFileStreamWriterTest : public testing::Test { |
27 public: | 27 public: |
28 LocalFileStreamWriterTest() | 28 LocalFileStreamWriterTest() |
29 : file_thread_("FileUtilProxyTestFileThread") {} | 29 : file_thread_("FileUtilProxyTestFileThread") {} |
30 | 30 |
31 virtual void SetUp() OVERRIDE { | 31 virtual void SetUp() override { |
32 ASSERT_TRUE(file_thread_.Start()); | 32 ASSERT_TRUE(file_thread_.Start()); |
33 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 33 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
34 } | 34 } |
35 | 35 |
36 virtual void TearDown() OVERRIDE { | 36 virtual void TearDown() override { |
37 // Give another chance for deleted streams to perform Close. | 37 // Give another chance for deleted streams to perform Close. |
38 base::RunLoop().RunUntilIdle(); | 38 base::RunLoop().RunUntilIdle(); |
39 file_thread_.Stop(); | 39 file_thread_.Stop(); |
40 base::RunLoop().RunUntilIdle(); | 40 base::RunLoop().RunUntilIdle(); |
41 } | 41 } |
42 | 42 |
43 protected: | 43 protected: |
44 base::FilePath Path(const std::string& name) { | 44 base::FilePath Path(const std::string& name) { |
45 return temp_dir_.path().AppendASCII(name); | 45 return temp_dir_.path().AppendASCII(name); |
46 } | 46 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); | 171 writer->Write(buffer.get(), buffer->size(), base::Bind(&NeverCalled)); |
172 ASSERT_EQ(net::ERR_IO_PENDING, result); | 172 ASSERT_EQ(net::ERR_IO_PENDING, result); |
173 | 173 |
174 net::TestCompletionCallback callback; | 174 net::TestCompletionCallback callback; |
175 writer->Cancel(callback.callback()); | 175 writer->Cancel(callback.callback()); |
176 int cancel_result = callback.WaitForResult(); | 176 int cancel_result = callback.WaitForResult(); |
177 EXPECT_EQ(net::OK, cancel_result); | 177 EXPECT_EQ(net::OK, cancel_result); |
178 } | 178 } |
179 | 179 |
180 } // namespace content | 180 } // namespace content |
OLD | NEW |