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

Unified Diff: net/spdy/spdy_session_test_util.h

Issue 11644088: SPDY - implement greedy approach to read all the data and process it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698