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

Side by Side Diff: base/callback_registry_unittest.cc

Issue 23645019: C++ Readability Review for caitkp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/callback_registry.h" 5 #include "base/callback_registry.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace base { 13 namespace base {
14 namespace { 14 namespace {
15 15
16 class Listener { 16 class Listener {
17 public: 17 public:
18 Listener() : total_(0), scaler_(1) {} 18 Listener() : total_(0), scaler_(1) {}
19 explicit Listener(int scaler) : total_(0), scaler_(scaler) {} 19 explicit Listener(int scaler) : total_(0), scaler_(scaler) {}
20 void IncrementTotal() { total_++; } 20 void IncrementTotal() { total_++; }
21 void IncrementByMultipleOfScaler(int x) { total_ += x * scaler_; } 21 void IncrementByMultipleOfScaler(int x) { total_ += x * scaler_; }
22 22
23 int total_; 23 int total_;
milos 2013/10/01 17:54:21 In general all data members should be private, see
Cait (Slow) 2013/10/01 22:51:27 Done.
24 24
25 private: 25 private:
26 int scaler_; 26 int scaler_;
27 DISALLOW_COPY_AND_ASSIGN(Listener); 27 DISALLOW_COPY_AND_ASSIGN(Listener);
28 }; 28 };
29 29
30 class Remover { 30 class Remover {
31 public: 31 public:
32 Remover() : total_(0) {} 32 Remover() : total_(0) {}
33 void IncrementTotalAndRemove() { 33 void IncrementTotalAndRemove() {
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 275
276 // Sanity check: notifying an empty list is a no-op. 276 // Sanity check: notifying an empty list is a no-op.
277 TEST(CallbackRegistryTest, EmptyList) { 277 TEST(CallbackRegistryTest, EmptyList) {
278 CallbackRegistry<void(void)> cb_reg; 278 CallbackRegistry<void(void)> cb_reg;
279 279
280 cb_reg.Notify(); 280 cb_reg.Notify();
281 } 281 }
282 282
283 } // namespace 283 } // namespace
284 } // namespace base 284 } // namespace base
285 // NOSUBMIT: Force git to add file for readability.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698