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

Side by Side Diff: base/at_exit_unittest.cc

Issue 7831021: Support for registering arbitrary Tasks with AtExitManager. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « base/at_exit.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/bind.h"
6 7
7 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
8 9
9 namespace { 10 namespace {
10 11
11 int g_test_counter_1 = 0; 12 int g_test_counter_1 = 0;
12 int g_test_counter_2 = 0; 13 int g_test_counter_2 = 0;
13 14
14 void IncrementTestCounter1(void* unused) { 15 void IncrementTestCounter1(void* unused) {
15 ++g_test_counter_1; 16 ++g_test_counter_1;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 EXPECT_EQ(1, g_test_counter_1); 71 EXPECT_EQ(1, g_test_counter_1);
71 EXPECT_EQ(1, g_test_counter_2); 72 EXPECT_EQ(1, g_test_counter_2);
72 } 73 }
73 74
74 TEST_F(AtExitTest, Param) { 75 TEST_F(AtExitTest, Param) {
75 base::AtExitManager::RegisterCallback(&ExpectParamIsNull, NULL); 76 base::AtExitManager::RegisterCallback(&ExpectParamIsNull, NULL);
76 base::AtExitManager::RegisterCallback(&ExpectParamIsCounter, 77 base::AtExitManager::RegisterCallback(&ExpectParamIsCounter,
77 &g_test_counter_1); 78 &g_test_counter_1);
78 base::AtExitManager::ProcessCallbacksNow(); 79 base::AtExitManager::ProcessCallbacksNow();
79 } 80 }
81
82 TEST_F(AtExitTest, Task) {
83 ZeroTestCounters();
84 base::AtExitManager::RegisterTask(base::Bind(ExpectParamIsCounter,
85 &g_test_counter_1));
86 base::AtExitManager::ProcessCallbacksNow();
87 }
OLDNEW
« no previous file with comments | « base/at_exit.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698