1 // Copyright 2014 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 "chrome/browser/sync_file_system/drive_backend/callback_tracker.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace sync_file_system
{
10 namespace drive_backend
{
14 void Receiver(bool* called
) {
16 EXPECT_FALSE(*called
);
22 TEST(CallbackTrackerTest
, AbortAll
) {
23 CallbackTracker tracker
;
27 base::Closure callback
= tracker
.Register(base::Bind(&Receiver
, &aborted
),
28 base::Bind(&Receiver
, &invoked
));
31 EXPECT_FALSE(invoked
);
35 EXPECT_FALSE(invoked
);
38 TEST(CallbackTrackerTest
, Invoke
) {
39 CallbackTracker tracker
;
43 base::Closure callback
= tracker
.Register(base::Bind(&Receiver
, &aborted
),
44 base::Bind(&Receiver
, &invoked
));
46 EXPECT_FALSE(aborted
);
49 // Second call should not do anything.
52 EXPECT_FALSE(invoked
);
55 EXPECT_FALSE(aborted
);
58 } // namespace drive_backend
59 } // namespace sync_file_system