Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: ios/chrome/browser/callback_counter_unittest.mm

Issue 2580363002: Upstream Chrome on iOS source code [1/11]. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 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.
4
5 #include "ios/chrome/browser/callback_counter.h"
6
7 #include "base/bind.h"
8 #include "base/mac/bind_objc_block.h"
9 #include "base/memory/ref_counted.h"
10 #import "base/test/ios/wait_util.h"
11 #include "testing/platform_test.h"
12
13 // Tests that CallbackCounter works with 2 callbacks.
14 TEST(CallbackCounterTest, Basic) {
15 __block BOOL block_was_called = NO;
16 scoped_refptr<CallbackCounter> callback_counter =
17 new CallbackCounter(base::BindBlock(^{
18 block_was_called = YES;
19 }));
20
21 // Enqueue the first callback.
22 callback_counter->IncrementCount();
23 dispatch_async(dispatch_get_main_queue(), ^{
24 callback_counter->DecrementCount();
25 });
26
27 // Enqueue the second callback.
28 callback_counter->IncrementCount();
29 dispatch_async(dispatch_get_main_queue(), ^{
30 callback_counter->DecrementCount();
31 });
32
33 base::test::ios::WaitUntilCondition(^bool() {
34 return block_was_called;
35 });
36 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/callback_counter.mm ('k') | ios/chrome/browser/context_menu/context_menu_egtest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698