Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_SPDY_SPDY_SESSION_TEST_UTIL_H_ | |
| 6 #define NET_SPDY_SPDY_SESSION_TEST_UTIL_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/message_loop.h" | |
| 12 #include "base/pending_task.h" | |
| 13 | |
| 14 namespace net { | |
| 15 | |
| 16 // An object of this type intercepts the completion of all tasks on | |
| 17 // MessageLoop::current() and checks how many tasks posted from the given | |
| 18 // |file_name| (for example, spdy_session.cc) and |function_name| (for example, | |
| 19 // 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.
| |
| 20 class SpdySessionTestTaskObserver : public MessageLoop::TaskObserver { | |
| 21 public: | |
| 22 // |file_name| and |function_name| specify the names of file and function from | |
| 23 // which any tasks that are posted, are observed. | |
| 24 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.
| |
| 25 const std::string& function_name); | |
| 26 virtual ~SpdySessionTestTaskObserver(); | |
| 27 | |
| 28 // Implements MessageLoop::TaskObserver. | |
| 29 virtual void WillProcessTask(const base::PendingTask& pending_task) OVERRIDE; | |
| 30 virtual void DidProcessTask(const base::PendingTask& pending_task) OVERRIDE; | |
| 31 | |
| 32 // Returns number of times tasks posted from the given |function_name| and | |
| 33 // |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.
| |
| 34 uint32 posted_count() const { return posted_count_; } | |
| 35 | |
| 36 private: | |
| 37 uint32 posted_count_; | |
| 38 std::string file_name_; | |
| 39 std::string function_name_; | |
| 40 }; | |
| 41 | |
| 42 } // namespace net | |
| 43 | |
| 44 #endif // NET_SPDY_SPDY_SESSION_TEST_UTIL_H_ | |
| OLD | NEW |