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

Side by Side Diff: base/lazy_instance_unittest.cc

Issue 249363004: Revert of Style cleanup in preparation for auto-linting base/. (Closed)
Patch Set: Created 6 years, 8 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
« no previous file with comments | « base/keyboard_code_conversion_gtk.cc ('k') | base/linked_ptr.h » ('j') | 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) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/atomic_sequence_num.h" 6 #include "base/atomic_sequence_num.h"
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/simple_thread.h" 8 #include "base/simple_thread.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 23 matching lines...) Expand all
34 34
35 static int constructed; 35 static int constructed;
36 private: 36 private:
37 int some_int_; 37 int some_int_;
38 }; 38 };
39 39
40 int SlowConstructor::constructed = 0; 40 int SlowConstructor::constructed = 0;
41 41
42 class SlowDelegate : public base::DelegateSimpleThread::Delegate { 42 class SlowDelegate : public base::DelegateSimpleThread::Delegate {
43 public: 43 public:
44 explicit SlowDelegate(base::LazyInstance<SlowConstructor>* lazy) 44 SlowDelegate(base::LazyInstance<SlowConstructor>* lazy) : lazy_(lazy) { }
45 : lazy_(lazy) {}
46
47 virtual void Run() { 45 virtual void Run() {
48 EXPECT_EQ(12, lazy_->Get().some_int()); 46 EXPECT_EQ(12, lazy_->Get().some_int());
49 EXPECT_EQ(12, lazy_->Pointer()->some_int()); 47 EXPECT_EQ(12, lazy_->Pointer()->some_int());
50 } 48 }
51 49
52 private: 50 private:
53 base::LazyInstance<SlowConstructor>* lazy_; 51 base::LazyInstance<SlowConstructor>* lazy_;
54 }; 52 };
55 53
56 } // namespace 54 } // namespace
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 86
89 base::DelegateSimpleThreadPool pool("lazy_instance_cons", 5); 87 base::DelegateSimpleThreadPool pool("lazy_instance_cons", 5);
90 pool.AddWork(&delegate, 20); 88 pool.AddWork(&delegate, 20);
91 EXPECT_EQ(0, SlowConstructor::constructed); 89 EXPECT_EQ(0, SlowConstructor::constructed);
92 90
93 pool.Start(); 91 pool.Start();
94 pool.JoinAll(); 92 pool.JoinAll();
95 EXPECT_EQ(1, SlowConstructor::constructed); 93 EXPECT_EQ(1, SlowConstructor::constructed);
96 } 94 }
97 } 95 }
OLDNEW
« no previous file with comments | « base/keyboard_code_conversion_gtk.cc ('k') | base/linked_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698