OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_DISK_CACHE_DISK_CACHE_TEST_UTIL_H_ | 5 #ifndef NET_DISK_CACHE_DISK_CACHE_TEST_UTIL_H_ |
6 #define NET_DISK_CACHE_DISK_CACHE_TEST_UTIL_H_ | 6 #define NET_DISK_CACHE_DISK_CACHE_TEST_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 // ----------------------------------------------------------------------- | 55 // ----------------------------------------------------------------------- |
56 | 56 |
57 // Simple callback to process IO completions from the cache. It allows tests | 57 // Simple callback to process IO completions from the cache. It allows tests |
58 // with multiple simultaneous IO operations. | 58 // with multiple simultaneous IO operations. |
59 class CallbackTest : public CallbackRunner< Tuple1<int> > { | 59 class CallbackTest : public CallbackRunner< Tuple1<int> > { |
60 public: | 60 public: |
61 explicit CallbackTest(bool reuse); | 61 explicit CallbackTest(bool reuse); |
62 virtual ~CallbackTest(); | 62 virtual ~CallbackTest(); |
63 | 63 |
| 64 int result() const { return result_; } |
64 virtual void RunWithParams(const Tuple1<int>& params); | 65 virtual void RunWithParams(const Tuple1<int>& params); |
65 int result() const { return result_; } | |
66 | 66 |
67 private: | 67 private: |
68 int result_; | 68 int result_; |
69 int reuse_; | 69 int reuse_; |
70 DISALLOW_COPY_AND_ASSIGN(CallbackTest); | 70 DISALLOW_COPY_AND_ASSIGN(CallbackTest); |
71 }; | 71 }; |
72 | 72 |
73 // ----------------------------------------------------------------------- | 73 // ----------------------------------------------------------------------- |
74 | 74 |
75 // Simple helper to deal with the message loop on a test. | 75 // Simple helper to deal with the message loop on a test. |
(...skipping 20 matching lines...) Expand all Loading... |
96 base::RepeatingTimer<MessageLoopHelper> timer_; | 96 base::RepeatingTimer<MessageLoopHelper> timer_; |
97 int num_callbacks_; | 97 int num_callbacks_; |
98 int num_iterations_; | 98 int num_iterations_; |
99 int last_; | 99 int last_; |
100 bool completed_; | 100 bool completed_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(MessageLoopHelper); | 102 DISALLOW_COPY_AND_ASSIGN(MessageLoopHelper); |
103 }; | 103 }; |
104 | 104 |
105 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_UTIL_H_ | 105 #endif // NET_DISK_CACHE_DISK_CACHE_TEST_UTIL_H_ |
OLD | NEW |