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 #include "net/base/file_stream.h" | 5 #include "net/base/file_stream.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 // Wait until a file closure event is recorded. | 45 // Wait until a file closure event is recorded. |
46 bool WaitForClosure() { | 46 bool WaitForClosure() { |
47 const base::TimeDelta timeout( | 47 const base::TimeDelta timeout( |
48 base::TimeDelta::FromMilliseconds( | 48 base::TimeDelta::FromMilliseconds( |
49 TestTimeouts::action_max_timeout_ms())); | 49 TestTimeouts::action_max_timeout_ms())); |
50 return on_closure_.TimedWait(timeout); | 50 return on_closure_.TimedWait(timeout); |
51 } | 51 } |
52 | 52 |
53 // NetLog overrides: | 53 // NetLog overrides: |
54 virtual void AddEntry(EventType type, | 54 virtual void AddEntry( |
55 const base::TimeTicks& time, | 55 EventType type, |
56 const Source& source, | 56 const Source& source, |
57 EventPhase phase, | 57 EventPhase phase, |
58 EventParameters* extra_parameters) OVERRIDE { | 58 const scoped_refptr<EventParameters>& params) OVERRIDE { |
59 if (type == TYPE_FILE_STREAM_CLOSE) { | 59 if (type == TYPE_FILE_STREAM_CLOSE) { |
60 on_closure_.Signal(); | 60 on_closure_.Signal(); |
61 } | 61 } |
62 } | 62 } |
63 | 63 |
64 virtual uint32 NextID() OVERRIDE { return id_++; } | 64 virtual uint32 NextID() OVERRIDE { return id_++; } |
65 virtual LogLevel GetLogLevel() const OVERRIDE { return LOG_ALL; } | 65 virtual LogLevel GetLogLevel() const OVERRIDE { return LOG_ALL; } |
66 virtual void AddThreadSafeObserver(ThreadSafeObserver* observer, | 66 virtual void AddThreadSafeObserver(ThreadSafeObserver* observer, |
67 LogLevel log_level) OVERRIDE { | 67 LogLevel log_level) OVERRIDE { |
68 NOTIMPLEMENTED(); | 68 NOTIMPLEMENTED(); |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 // Delete the stream without waiting for the close operation to be | 1215 // Delete the stream without waiting for the close operation to be |
1216 // complete. Should be safe. | 1216 // complete. Should be safe. |
1217 stream.reset(); | 1217 stream.reset(); |
1218 // close_callback won't be called. | 1218 // close_callback won't be called. |
1219 EXPECT_FALSE(close_callback.have_result()); | 1219 EXPECT_FALSE(close_callback.have_result()); |
1220 } | 1220 } |
1221 | 1221 |
1222 } // namespace | 1222 } // namespace |
1223 | 1223 |
1224 } // namespace net | 1224 } // namespace net |
OLD | NEW |