OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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) rather | |
6 // than as part of test_shell_tests because they rely on being able to | |
7 // instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses TYPE_UI, | |
8 // which net::TestCompletionCallback doesn't allow. | |
9 | |
10 #include "webkit/fileapi/local_file_stream_writer.h" | 5 #include "webkit/fileapi/local_file_stream_writer.h" |
11 | 6 |
12 #include <string> | 7 #include <string> |
13 | 8 |
14 #include "base/callback.h" | 9 #include "base/callback.h" |
15 #include "base/file_util.h" | 10 #include "base/file_util.h" |
16 #include "base/logging.h" | 11 #include "base/logging.h" |
17 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
18 #include "base/scoped_temp_dir.h" | 13 #include "base/scoped_temp_dir.h" |
19 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 147 |
153 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer("xxx")); | 148 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer("xxx")); |
154 int result = writer->Write(buffer, buffer->size(), base::Bind(&NeverCalled)); | 149 int result = writer->Write(buffer, buffer->size(), base::Bind(&NeverCalled)); |
155 ASSERT_EQ(net::ERR_IO_PENDING, result); | 150 ASSERT_EQ(net::ERR_IO_PENDING, result); |
156 | 151 |
157 net::TestCompletionCallback callback; | 152 net::TestCompletionCallback callback; |
158 writer->Cancel(callback.callback()); | 153 writer->Cancel(callback.callback()); |
159 int cancel_result = callback.WaitForResult(); | 154 int cancel_result = callback.WaitForResult(); |
160 EXPECT_EQ(net::OK, cancel_result); | 155 EXPECT_EQ(net::OK, cancel_result); |
161 } | 156 } |
OLD | NEW |