Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(424)

Side by Side Diff: net/base/file_stream_unittest.cc

Issue 10692155: Switch to TimeDelta interfaces for process waiting functions in net and ipc. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/sync_socket_unittest.cc ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 26 matching lines...) Expand all
37 // (i.e. TYPE_FILE_STREAM_CLOSE event is recorded). 37 // (i.e. TYPE_FILE_STREAM_CLOSE event is recorded).
38 class NetLogForNotifyingFileClosure : public NetLog { 38 class NetLogForNotifyingFileClosure : public NetLog {
39 public: 39 public:
40 NetLogForNotifyingFileClosure() 40 NetLogForNotifyingFileClosure()
41 : last_id_(0), 41 : last_id_(0),
42 on_closure_(false /* manual_reset */, false /* initially_signaled */) { 42 on_closure_(false /* manual_reset */, false /* initially_signaled */) {
43 } 43 }
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(TestTimeouts::action_max_timeout());
48 base::TimeDelta::FromMilliseconds(
49 TestTimeouts::action_max_timeout_ms()));
50 return on_closure_.TimedWait(timeout); 48 return on_closure_.TimedWait(timeout);
51 } 49 }
52 50
53 // NetLog overrides: 51 // NetLog overrides:
54 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE { 52 virtual void OnAddEntry(const net::NetLog::Entry& entry) OVERRIDE {
55 if (entry.type() == TYPE_FILE_STREAM_CLOSE) 53 if (entry.type() == TYPE_FILE_STREAM_CLOSE)
56 on_closure_.Signal(); 54 on_closure_.Signal();
57 } 55 }
58 56
59 virtual uint32 NextID() OVERRIDE { return ++last_id_; } 57 virtual uint32 NextID() OVERRIDE { return ++last_id_; }
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 // Delete the stream without waiting for the close operation to be 1253 // Delete the stream without waiting for the close operation to be
1256 // complete. Should be safe. 1254 // complete. Should be safe.
1257 stream.reset(); 1255 stream.reset();
1258 // close_callback won't be called. 1256 // close_callback won't be called.
1259 EXPECT_FALSE(close_callback.have_result()); 1257 EXPECT_FALSE(close_callback.have_result());
1260 } 1258 }
1261 1259
1262 } // namespace 1260 } // namespace
1263 1261
1264 } // namespace net 1262 } // namespace net
OLDNEW
« no previous file with comments | « ipc/sync_socket_unittest.cc ('k') | net/dns/dns_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698