summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/disk_cache_test_util.h
diff options
context:
space:
mode:
authorgavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 22:39:39 +0000
committergavinp@chromium.org <gavinp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-10 22:39:39 +0000
commit70740b7a042b011ee45764c777799f762c4d5076 (patch)
treeb80bde5d25c3da9fdcbcca9bc6b7a92b53510bd7 /net/disk_cache/disk_cache_test_util.h
parentb7a059d8e08d6c02f718552793de33cbabb6e77a (diff)
downloadchromium_src-70740b7a042b011ee45764c777799f762c4d5076.zip
chromium_src-70740b7a042b011ee45764c777799f762c4d5076.tar.gz
chromium_src-70740b7a042b011ee45764c777799f762c4d5076.tar.bz2
Deflake SimpleCache reads when multiple operations in flight.
When multiple Reads/Writes are in flight, they can race each other for updates to the size of the entry. By moving the updates to coincide with the beginning of the blocking operation, we remove flakes. Unit tests still require that reads can fast fail; but not while operations are pending (they use the single operation interface), so we still pass unit tests with the tighter (and actually correct) behaviour that we only fast fail when no other operations are pending. R=pasko@chromium.org,felipeg,rdsmith,pliard BUG=239223 Review URL: https://chromiumcodereview.appspot.com/15085016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199559 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/disk_cache_test_util.h')
-rw-r--r--net/disk_cache/disk_cache_test_util.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/disk_cache/disk_cache_test_util.h b/net/disk_cache/disk_cache_test_util.h
index f6d1f46..2c9a573 100644
--- a/net/disk_cache/disk_cache_test_util.h
+++ b/net/disk_cache/disk_cache_test_util.h
@@ -85,17 +85,20 @@ class MessageLoopHelper {
class CallbackTest {
public:
// Creates a new CallbackTest object. When the callback is called, it will
- // update |helper| with the result of the call. If |reuse| is false and a
- // callback is called more than once, or if |reuse| is true and a callback
- // is called more than twice, an error will be reported to |helper|.
+ // update |helper|. If |reuse| is false and a callback is called more than
+ // once, or if |reuse| is true and a callback is called more than twice, an
+ // error will be reported to |helper|.
CallbackTest(MessageLoopHelper* helper, bool reuse);
~CallbackTest();
- void Run(int params);
+ void Run(int result);
+
+ int last_result() const { return last_result_; }
private:
MessageLoopHelper* helper_;
int reuse_;
+ int last_result_;
DISALLOW_COPY_AND_ASSIGN(CallbackTest);
};