1 // Copyright 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.
5 #include "base/barrier_closure.h"
8 #include "testing/gtest/include/gtest/gtest.h"
12 void Increment(int* count
) { (*count
)++; }
14 TEST(BarrierClosureTest
, RunImmediatelyForZeroClosures
) {
16 base::Closure
doneClosure(base::Bind(&Increment
, base::Unretained(&count
)));
18 base::Closure barrierClosure
= base::BarrierClosure(0, doneClosure
);
22 TEST(BarrierClosureTest
, RunAfterNumClosures
) {
24 base::Closure
doneClosure(base::Bind(&Increment
, base::Unretained(&count
)));
26 base::Closure barrierClosure
= base::BarrierClosure(2, doneClosure
);