Index: net/spdy/spdy_session_test_util.h |
=================================================================== |
--- net/spdy/spdy_session_test_util.h (revision 0) |
+++ net/spdy/spdy_session_test_util.h (revision 0) |
@@ -0,0 +1,44 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NET_SPDY_SPDY_SESSION_TEST_UTIL_H_ |
+#define NET_SPDY_SPDY_SESSION_TEST_UTIL_H_ |
+ |
+#include <string> |
+ |
+#include "base/basictypes.h" |
+#include "base/message_loop.h" |
+#include "base/pending_task.h" |
+ |
+namespace net { |
+ |
+// An object of this type intercepts the completion of all tasks on |
+// MessageLoop::current() and checks how many tasks posted from the given |
+// |file_name| (for example, spdy_session.cc) and |function_name| (for example, |
+// DoRead) are completed. |
Ryan Sleevi
2013/02/07 02:43:50
// SpdySessionTestTaskObserver is a MessageLoop::T
ramant (doing other things)
2013/02/07 20:03:55
Done.
|
+class SpdySessionTestTaskObserver : public MessageLoop::TaskObserver { |
+ public: |
+ // |file_name| and |function_name| specify the names of file and function from |
+ // which any tasks that are posted, are observed. |
+ SpdySessionTestTaskObserver(const std::string& file_name, |
Ryan Sleevi
2013/02/07 02:43:50
// Creates a SpdySessionTaskObserver that will rec
ramant (doing other things)
2013/02/07 20:03:55
Done.
|
+ const std::string& function_name); |
+ virtual ~SpdySessionTestTaskObserver(); |
+ |
+ // Implements MessageLoop::TaskObserver. |
+ virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE; |
+ virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE; |
+ |
+ // Returns number of times tasks posted from the given |function_name| and |
+ // |file_name| have been completed. |
Ryan Sleevi
2013/02/07 02:43:50
// Returns the number of tasks posted by the given
ramant (doing other things)
2013/02/07 20:03:55
Done.
|
+ uint32 posted_count() const { return posted_count_; } |
+ |
+ private: |
+ uint32 posted_count_; |
+ std::string file_name_; |
+ std::string function_name_; |
+}; |
+ |
+} // namespace net |
+ |
+#endif // NET_SPDY_SPDY_SESSION_TEST_UTIL_H_ |