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_writer.h" | 5 #include "webkit/fileapi/local_file_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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 | 146 |
152 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer("xxx")); | 147 scoped_refptr<net::StringIOBuffer> buffer(new net::StringIOBuffer("xxx")); |
153 int result = writer->Write(buffer, buffer->size(), base::Bind(&NeverCalled)); | 148 int result = writer->Write(buffer, buffer->size(), base::Bind(&NeverCalled)); |
154 ASSERT_EQ(net::ERR_IO_PENDING, result); | 149 ASSERT_EQ(net::ERR_IO_PENDING, result); |
155 | 150 |
156 net::TestCompletionCallback callback; | 151 net::TestCompletionCallback callback; |
157 writer->Cancel(callback.callback()); | 152 writer->Cancel(callback.callback()); |
158 int cancel_result = callback.WaitForResult(); | 153 int cancel_result = callback.WaitForResult(); |
159 EXPECT_EQ(net::OK, cancel_result); | 154 EXPECT_EQ(net::OK, cancel_result); |
160 } | 155 } |
OLD | NEW |