Chromium Code Reviews| Index: base/callback_helpers_unittest.cc |
| diff --git a/base/bind_helpers_unittest.cc b/base/callback_helpers_unittest.cc |
| similarity index 54% |
| rename from base/bind_helpers_unittest.cc |
| rename to base/callback_helpers_unittest.cc |
| index 3ef2d7543540464ddefc06c14d9726078d18a2b0..4c40bf3e795f0a3a1fd2c8a2d87d83e4f3c7289e 100644 |
| --- a/base/bind_helpers_unittest.cc |
| +++ b/base/callback_helpers_unittest.cc |
| @@ -1,11 +1,11 @@ |
| -// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "base/bind_helpers.h" |
| +#include "base/callback_helpers.h" |
| -#include "base/callback.h" |
| #include "base/bind.h" |
| +#include "base/callback.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| namespace { |
| @@ -36,4 +36,26 @@ TEST(BindHelpersTest, TestScopedClosureRunnerRelease) { |
| EXPECT_EQ(1, run_count); |
| } |
| +TEST(BindHelpersTest, TestScopedClosureRunnerReset) { |
| + int run_count_1 = 0; |
| + int run_count_2 = 0; |
| + { |
| + base::ScopedClosureRunner runner; |
| + runner.Reset(base::Bind(&Increment, &run_count_1)); |
| + runner.Reset(base::Bind(&Increment, &run_count_2)); |
| + EXPECT_EQ(1, run_count_1); |
| + EXPECT_EQ(0, run_count_2); |
| + } |
| + EXPECT_EQ(1, run_count_2); |
| + |
| + int run_count = 0; |
|
awong
2013/08/29 21:00:39
Call this run_count_3?
|
| + { |
| + base::ScopedClosureRunner runner(base::Bind(&Increment, &run_count)); |
| + EXPECT_EQ(0, run_count); |
| + runner.Reset(); |
| + EXPECT_EQ(1, run_count); |
| + } |
| + EXPECT_EQ(1, run_count); |
| +} |
| + |
| } // namespace |