| OLD | NEW |
| 1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-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 #include "net/disk_cache/disk_cache_test_util.h" | 5 #include "net/disk_cache/disk_cache_test_util.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 ScopedTestCache::~ScopedTestCache() { | 119 ScopedTestCache::~ScopedTestCache() { |
| 120 file_util::Delete(path(), true); | 120 file_util::Delete(path(), true); |
| 121 } | 121 } |
| 122 | 122 |
| 123 // ----------------------------------------------------------------------- | 123 // ----------------------------------------------------------------------- |
| 124 | 124 |
| 125 volatile int g_cache_tests_received = 0; | 125 volatile int g_cache_tests_received = 0; |
| 126 volatile bool g_cache_tests_error = 0; | 126 volatile bool g_cache_tests_error = 0; |
| 127 | 127 |
| 128 CallbackTest::CallbackTest(bool reuse) : result_(-1), reuse_(reuse ? 0 : 1) {} |
| 129 |
| 130 CallbackTest::~CallbackTest() {} |
| 131 |
| 128 // On the actual callback, increase the number of tests received and check for | 132 // On the actual callback, increase the number of tests received and check for |
| 129 // errors (an unexpected test received) | 133 // errors (an unexpected test received) |
| 130 void CallbackTest::RunWithParams(const Tuple1<int>& params) { | 134 void CallbackTest::RunWithParams(const Tuple1<int>& params) { |
| 131 if (reuse_) { | 135 if (reuse_) { |
| 132 DCHECK(1 == reuse_); | 136 DCHECK(1 == reuse_); |
| 133 if (2 == reuse_) | 137 if (2 == reuse_) |
| 134 g_cache_tests_error = true; | 138 g_cache_tests_error = true; |
| 135 reuse_++; | 139 reuse_++; |
| 136 } | 140 } |
| 137 | 141 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } else { | 178 } else { |
| 175 // Not finished yet. See if we have to abort. | 179 // Not finished yet. See if we have to abort. |
| 176 if (last_ == g_cache_tests_received) | 180 if (last_ == g_cache_tests_received) |
| 177 num_iterations_++; | 181 num_iterations_++; |
| 178 else | 182 else |
| 179 last_ = g_cache_tests_received; | 183 last_ = g_cache_tests_received; |
| 180 if (40 == num_iterations_) | 184 if (40 == num_iterations_) |
| 181 MessageLoop::current()->Quit(); | 185 MessageLoop::current()->Quit(); |
| 182 } | 186 } |
| 183 } | 187 } |
| OLD | NEW |