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

Unified Diff: net/spdy/spdy_session_test_util.h

Issue 13834009: SPDY - Re-land greedy read support for SpdySession (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: histograms to track bytes_read during init Created 7 years, 8 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
diff --git a/net/spdy/spdy_session_test_util.h b/net/spdy/spdy_session_test_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..8f75e2a63e49ae4dd7ce84f1349e4caf867cdc9a
--- /dev/null
+++ b/net/spdy/spdy_session_test_util.h
@@ -0,0 +1,46 @@
+// 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 {
+
+// SpdySessionTestTaskObserver is a MessageLoop::TaskObserver that monitors the
+// completion of all tasks executed by the current MessageLoop, recording the
+// number of tasks that refer to a specific function and filename.
+class SpdySessionTestTaskObserver : public MessageLoop::TaskObserver {
+ public:
+ // Creates a SpdySessionTaskObserver that will record all tasks that are
+ // executed that were posted by the function named by |function_name|, located
+ // in the file |file_name|.
+ // Example:
+ // file_name = "foo.cc"
+ // function = "DoFoo"
+ SpdySessionTestTaskObserver(const std::string& file_name,
+ 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 the number of tasks posted by the given function and file.
+ uint16 executed_count() const { return executed_count_; }
+
+ private:
+ uint16 executed_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